Skip to contents

stability_region(z, tab) evaluates the stability function \(r(z) = 1 + z b^T (I - zA)^{-1} e\) of a Runge-Kutta tableau at a real or complex z (embedded = TRUE for the embedded method); the method is stable where \(|r(z)| < 1\). stability_region(z, alg) computes it for an ODE algorithm by taking one step of size 1 of \(u' = zu\) from \(u = 1\).

Usage

stability_region(
  z,
  tab,
  ...,
  embedded = FALSE,
  initial_guess = -3,
  abstol = NULL,
  maxiters = 1000L
)

imaginary_stability_interval(
  tab,
  initial_guess = NULL,
  abstol = NULL,
  maxiters = 1000L
)

Arguments

z

A real or complex number, or (alone) a tableau or algorithm.

tab

A Runge-Kutta tableau (ExplicitRKTableau()) or an ODE algorithm.

...

Unused.

embedded

Use the embedded method of the tableau.

initial_guess

Start of the root search.

abstol, maxiters

Options of the root search.

Value

A number (complex for complex z).

Details

stability_region(tab) and stability_region(alg) (one argument) return the length of the stability region on the negative real axis: the root of \(|r(x)| = 1\) found from initial_guess by a trust region method with finite difference derivatives (SimpleNonlinearSolve's SimpleTrustRegion(autodiff = AutoFiniteDiff())). imaginary_stability_interval() returns the length of the stability interval on the imaginary axis in the same way, from initial_guess (by default the number of stages minus one for a tableau, 20 for an algorithm).

Examples

tab <- constructTsit5ExplicitRK()
stability_region(-1, tab)
#> [1] 0.3674947
stability_region(1i, RK4())
#> [1] 0.5416667+0.8333333i
stability_region(tab)
#> [1] -4.056036
imaginary_stability_interval(RK4())
#> [1] 2.828427