Lie group and Magnus methods for linear problems
Source:R/solvers-linear-lie.R
linear_lie_methods.RdMethods of OrdinaryDiffEqLinear for u' = A(u, t) u, where the problem
is ODEProblem(L, u0, tspan) with a SciML operator L, usually
MatrixOperator(A, update_func) whose update_func(A, u, p, t) returns
the matrix at (u, p, t). All are fixed step methods (pass dt) except
MagnusAdapt4(), which is adaptive.
Usage
MagnusMidpoint(krylov = FALSE, m = 30, iop = 0)
MagnusLeapfrog(krylov = FALSE, m = 30, iop = 0)
LieEuler(krylov = FALSE, m = 30, iop = 0)
MagnusGauss4(krylov = FALSE, m = 30, iop = 0)
MagnusNC6(krylov = FALSE, m = 30, iop = 0)
MagnusGL6(krylov = FALSE, m = 30, iop = 0)
MagnusGL8(krylov = FALSE, m = 30, iop = 0)
MagnusNC8(krylov = FALSE, m = 30, iop = 0)
MagnusGL4(krylov = FALSE, m = 30, iop = 0)
RKMK2(krylov = FALSE, m = 30, iop = 0)
RKMK4(krylov = FALSE, m = 30, iop = 0)
LieRK4(krylov = FALSE, m = 30, iop = 0)
CG2(krylov = FALSE, m = 30, iop = 0)
CG3(krylov = FALSE, m = 30, iop = 0)
CG4a(krylov = FALSE, m = 30, iop = 0)
MagnusAdapt4()
CayleyEuler()
LinearExponential(krylov = c("off", "simple", "adaptive"), m = 10, iop = 0)Details
MagnusMidpoint() and MagnusLeapfrog() are the second order Magnus
midpoint and leapfrog methods, LieEuler() the first order Lie Euler
method, MagnusGauss4(), MagnusGL4(), MagnusGL6(), MagnusGL8(),
MagnusNC6() and MagnusNC8() Magnus methods of orders 4 to 8 with
Gauss, Gauss-Legendre and Newton-Cotes quadratures, RKMK2() and
RKMK4() the Runge-Kutta-Munthe-Kaas methods of orders 2 and 4,
LieRK4() the fourth order Lie Runge-Kutta method, CG2(), CG3() and
CG4a() the Crouch-Grossman methods of orders 2, 3 and 4, and
MagnusAdapt4() the adaptive fourth order Magnus method of Li and Deng.
CayleyEuler() is the first order Cayley method for matrix states U' = A(U, t) U (an ODEProblem of the operator, or a SplitODEProblem whose
first function is the operator), whose step is U V' multiplied by V = (I - dt A / 2)^-1 (I + dt A / 2); the state is the matrix in column
major order. LinearExponential() is the exact solution exp(dt A) u of
a linear problem with a constant operator (one step over the interval
when no dt is given).
With krylov = TRUE the exponential acting on the state is approximated
in a Krylov subspace of dimension m (Arnoldi, or Lanczos for symmetric
matrices); iop sets the length of the incomplete orthogonalization.
LinearExponential(krylov = "simple") uses a fixed subspace and
krylov = "adaptive" the adaptive time stepping of Niesen and Wright
with tolerance reltol.
Examples
L <- MatrixOperator(diag(2), function(A, u, p, t) matrix(c(0, 1, -1, -0.1 * t), 2))
prob <- ODEProblem(L, c(1, 0), c(0, 1))
solve(prob, MagnusGL4(), dt = 0.1)$u[[11]]
#> [1] 0.5477320 0.8134798
solve(ODEProblem(MatrixOperator(matrix(c(-1, 1, 0, -2), 2)), c(1, 1), c(0, 1)),
LinearExponential())$u[[2]]
#> [1] 0.3678794 0.3678794