The extrapolation methods of OrdinaryDiffEqExtrapolation.jl, adaptive in both the step size and the order. Each step computes internal discretizations with the step divided by the terms of a subdividing sequence and extrapolates them to a high order; the difference to the extrapolation of the next lower order estimates the error.
Usage
AitkenNeville(
max_order = 10L,
min_order = 1L,
init_order = 5L,
threading = FALSE
)
ExtrapolationMidpointDeuflhard(
min_order = 1L,
init_order = 5L,
max_order = 10L,
sequence = "harmonic",
threading = TRUE,
sequence_factor = 2L
)
ExtrapolationMidpointHairerWanner(
min_order = 2L,
init_order = 5L,
max_order = 10L,
sequence = "harmonic",
threading = TRUE,
sequence_factor = 2L
)
ImplicitDeuflhardExtrapolation(
autodiff = NULL,
concrete_jac = NULL,
linsolve = NULL,
min_order = 1L,
init_order = 5L,
max_order = 10L,
sequence = "harmonic",
threading = FALSE
)
ImplicitHairerWannerExtrapolation(
autodiff = NULL,
concrete_jac = NULL,
linsolve = NULL,
min_order = 2L,
init_order = 5L,
max_order = 10L,
sequence = "harmonic",
threading = FALSE
)
ImplicitEulerExtrapolation(
autodiff = NULL,
concrete_jac = NULL,
linsolve = NULL,
max_order = 12L,
min_order = 3L,
init_order = 5L,
threading = FALSE,
sequence = "harmonic"
)
ImplicitEulerBarycentricExtrapolation(
autodiff = NULL,
concrete_jac = NULL,
linsolve = NULL,
min_order = 3L,
init_order = 5L,
max_order = 12L,
sequence = "harmonic",
threading = FALSE,
sequence_factor = 2L
)Arguments
- max_order, min_order, init_order
The largest, smallest and initial extrapolation order.
- threading
Accepted for compatibility: R computes the internal discretizations one after another (the result equals Julia's threaded one; the evaluation counts follow Julia's threaded bookkeeping where it differs).
- sequence
The subdividing sequence:
"harmonic","romberg"or"bulirsch"(a string or a symbol); other values warn and use"harmonic".- sequence_factor
The even factor applied to the subdividing sequence (odd values warn and use 2).
- autodiff
As for
ImplicitEuler(): how the Jacobian is formed when the problem has none.- concrete_jac, linsolve
Accepted for compatibility and ignored: the out of place methods of Julia solve with
W \ b.
Value
An ODE algorithm for solve.ODEProblem().
Details
AitkenNeville(): explicit Euler on the Romberg sequence with the Aitken and Neville scheme (as in Julia, it keeps the PI step size controller of OrdinaryDiffEq).ExtrapolationMidpointDeuflhard()andExtrapolationMidpointHairerWanner(): explicit midpoint rule with the order and step size control of Deuflhard and of Hairer and Wanner.ImplicitDeuflhardExtrapolation()andImplicitHairerWannerExtrapolation(): the linearly implicit midpoint rule for stiff problems.ImplicitEulerExtrapolation(): linearly implicit Euler with the Richardson table.ImplicitEulerBarycentricExtrapolation(): linearly implicit Euler combined with barycentric weights.
The implicit methods evaluate one Jacobian per step (the jac_fn of the
ODEFunction() if given, else as chosen by autodiff) and solve with
W = h J - I; they
do not support mass matrices, as in Julia. The orders are adjusted to
their valid ranges as in Julia (for example the Hairer and Wanner methods
need min_order + 1 <= init_order <= max_order - 1). max_order above
15 is an error for the methods with Float64 coefficient tables (all but
AitkenNeville() and ImplicitEulerExtrapolation()).
Examples
prob <- ODEProblem(function(u, p, t) c(u[2], -u[1]), c(1, 0), c(0, 1))
sol <- solve(prob, ExtrapolationMidpointDeuflhard(), reltol = 1e-10, abstol = 1e-10)
sol$u[[length(sol$u)]] - c(cos(1), -sin(1))
#> [1] 6.489809e-12 3.851319e-11
stiff <- ODEProblem(function(u, p, t) -50 * (u - t * t), 1, c(0, 1))
solve(stiff, ImplicitEulerExtrapolation(), reltol = 1e-6)$stats$naccept
#> [1] 18