OrdinaryDiffEqLinear
Specialized methods for linear and semi-linear differential equations where the system can be written in matrix form du/dt = A(t,u) * u
or du/dt = A(t) * u
. These methods exploit the linear structure to provide exact solutions or highly accurate integration.
Key Properties
Linear ODE methods provide:
- Exact solutions for time-independent linear systems
- Geometric integration preserving Lie group structure
- High-order Magnus expansions for time-dependent linear systems
- Lie group methods for matrix differential equations
- Excellent stability for a wide range of linear systems
- Specialized algorithms for different types of linear operators
When to Use Linear Methods
These methods are essential for:
- Linear systems
du/dt = A * u
with constant or time-dependent matrices - Matrix differential equations on Lie groups (rotation matrices, etc.)
- Quantum dynamics with Hamiltonian evolution
- Linear oscillators and harmonic systems
- Time-dependent linear systems with periodic or smooth coefficients
- Geometric mechanics requiring preservation of group structure
Mathematical Background
For linear systems du/dt = A(t) * u
, the exact solution is u(t) = exp(∫A(s)ds) * u₀
. Linear methods approximate this matrix exponential using various mathematical techniques like Magnus expansions, Lie group integrators, and specialized exponential methods.
Solver Selection Guide
Time and state-independent (constant A)
LinearExponential
: Exact solution fordu/dt = A * u
with constant matrix A
Time-dependent, state-independent (A(t))
MagnusMidpoint
: Second-order Magnus methodMagnusLeapfrog
: Second-order Magnus leapfrog schemeMagnusGauss4
: Fourth-order with Gauss quadratureMagnusGL4
: Fourth-order Gauss-Legendre Magnus methodMagnusGL6
: Sixth-order Gauss-Legendre Magnus methodMagnusGL8
: Eighth-order Gauss-Legendre Magnus methodMagnusNC6
: Sixth-order Newton-Cotes Magnus methodMagnusNC8
: Eighth-order Newton-Cotes Magnus method
State-dependent (A(u))
LieEuler
: First-order Lie group methodRKMK2
: Second-order Runge-Kutta-Munthe-Kaas methodRKMK4
: Fourth-order Runge-Kutta-Munthe-Kaas methodLieRK4
: Fourth-order Lie Runge-Kutta methodCG2
: Second-order Crouch-Grossman methodCG4a
: Fourth-order Crouch-Grossman methodCayleyEuler
: First-order method using Cayley transformations
Adaptive methods
MagnusAdapt4
: Fourth-order adaptive Magnus method
Time and state-dependent (A(t,u))
CG3
: Third-order Crouch-Grossman method for most general case
Method Selection Guidelines
- For constant linear systems:
LinearExponential
(exact) - For time-dependent systems: Magnus methods based on desired order
- For matrix Lie groups: Lie group methods (RKMK, LieRK4, CG)
- For high accuracy: Higher-order Magnus methods (GL6, GL8)
- For adaptive integration:
MagnusAdapt4
Special Considerations
These methods require:
- Proper problem formulation with identified linear structure
- Matrix operator interface for operator-based problems
- Understanding of Lie group structure for geometric problems
Installation
To be able to access the solvers in OrdinaryDiffEqLinear
, you must first install them use the Julia package manager:
using Pkg
Pkg.add("OrdinaryDiffEqLinear")
This will only install the solvers listed at the bottom of this page. If you want to explore other solvers for your problem, you will need to install some of the other libraries listed in the navigation bar on the left.
Example usage
using OrdinaryDiffEqLinear, SciMLOperators
function update_func(A, u, p, t)
A[1, 1] = 0
A[2, 1] = sin(u[1])
A[1, 2] = -1
A[2, 2] = 0
end
A0 = ones(2, 2)
A = MatrixOperator(A0, update_func = update_func)
u0 = ones(2)
tspan = (0.0, 30.0)
prob = ODEProblem(A, u0, tspan)
sol = solve(prob, LieRK4(), dt = 1 / 4)
Full list of solvers
Time and State-Independent Solvers
OrdinaryDiffEqLinear.LinearExponential
— TypeLinearExponential(; krylov = :off,
m = 10,
iop = 0)
Semilinear ODE solver Exact solution formula for linear, time-independent problems.
Keyword Arguments
krylov
::off
: cache the operator beforehand. Requires Matrix(A) method defined for the operator A.:simple
: uses simple Krylov approximations with fixed subspace size m.:adaptive
: uses adaptive Krylov approximations with internal timestepping.
m
: Controls the size of Krylov subspace ifkrylov=:simple
, and the initial subspace size ifkrylov=:adaptive
.iop
: If not zero, determines the length of the incomplete orthogonalization procedure Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@book{strogatz2018nonlinear, title={Nonlinear dynamics and chaos: with applications to physics, biology, chemistry, and engineering}, author={Strogatz, Steven H}, year={2018}, publisher={CRC press}}
Time-Dependent and State-Independent Solvers
OrdinaryDiffEqLinear.MagnusMidpoint
— TypeMagnusMidpoint(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Second order Magnus Midpoint method.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
https://joshuagoings.com/2017/06/15/magnus/
OrdinaryDiffEqLinear.MagnusLeapfrog
— TypeMagnusLeapfrog(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Second order Magnus Leapfrog method.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
https://joshuagoings.com/2017/06/15/magnus/
OrdinaryDiffEqLinear.MagnusGauss4
— TypeMagnusGauss4(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Fourth order Magnus method approximated using a two stage Gauss quadrature.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{hairer2011solving, title={Solving differential equations on manifolds}, author={Hairer, Ernst}, journal={Lecture notes}, year={2011} }
OrdinaryDiffEqLinear.MagnusNC6
— TypeMagnusNC6(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Sixth order Magnus method approximated using Newton-Cotes quadrature.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{blanes2000improved, title={Improved high order integrators based on the Magnus expansion}, author={Blanes, Sergio and Casas, Fernando and Ros, Javier}, journal={BIT Numerical Mathematics}, volume={40}, number={3}, pages={434–450}, year={2000}, publisher={Springer} }
OrdinaryDiffEqLinear.MagnusGL6
— TypeMagnusGL6(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Sixth order Magnus method approximated using Gauss-Legendre quadrature.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{blanes2000improved, title={Improved high order integrators based on the Magnus expansion}, author={Blanes, Sergio and Casas, Fernando and Ros, Javier}, journal={BIT Numerical Mathematics}, volume={40}, number={3}, pages={434–450}, year={2000}, publisher={Springer} }
OrdinaryDiffEqLinear.MagnusGL8
— TypeMagnusGL8(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Eighth order Magnus method approximated using Newton-Cotes quadrature.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{blanes2000improved, title={Improved high order integrators based on the Magnus expansion}, author={Blanes, Sergio and Casas, Fernando and Ros, Javier}, journal={BIT Numerical Mathematics}, volume={40}, number={3}, pages={434–450}, year={2000}, publisher={Springer} }
OrdinaryDiffEqLinear.MagnusNC8
— TypeMagnusNC8(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Eighth order Magnus method approximated using Gauss-Legendre quadrature.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{blanes2000improved, title={Improved high order integrators based on the Magnus expansion}, author={Blanes, Sergio and Casas, Fernando and Ros, Javier}, journal={BIT Numerical Mathematics}, volume={40}, number={3}, pages={434–450}, year={2000}, publisher={Springer} }
OrdinaryDiffEqLinear.MagnusGL4
— TypeMagnusGL4(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Fourth order Magnus method approximated using Gauss-Legendre quadrature.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{blanes2009magnus, title={The Magnus expansion and some of its applications}, author={Blanes, Sergio and Casas, Fernando and Oteo, Jose-Angel and Ros, Jos{'e}}, journal={Physics reports}, volume={470}, number={5-6}, pages={151–238}, year={2009}, publisher={Elsevier} }
State-Dependent Solvers
OrdinaryDiffEqLinear.LieEuler
— TypeLieEuler(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver description
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{celledoni2014introduction, title={An introduction to Lie group integrators–basics, new developments and applications}, author={Celledoni, Elena and Marthinsen, H{�a}kon and Owren, Brynjulf}, journal={Journal of Computational Physics}, volume={257}, pages={1040–1061}, year={2014}, publisher={Elsevier} }
OrdinaryDiffEqLinear.RKMK2
— TypeRKMK2(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Second order Runge–Kutta–Munthe-Kaas method.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{celledoni2014introduction, title={An introduction to Lie group integrators–basics, new developments and applications}, author={Celledoni, Elena and Marthinsen, H{�a}kon and Owren, Brynjulf}, journal={Journal of Computational Physics}, volume={257}, pages={1040–1061}, year={2014}, publisher={Elsevier} }
OrdinaryDiffEqLinear.RKMK4
— TypeRKMK4(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Fourth order Runge–Kutta–Munthe-Kaas method.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{celledoni2014introduction, title={An introduction to Lie group integrators–basics, new developments and applications}, author={Celledoni, Elena and Marthinsen, H{�a}kon and Owren, Brynjulf}, journal={Journal of Computational Physics}, volume={257}, pages={1040–1061}, year={2014}, publisher={Elsevier} }
OrdinaryDiffEqLinear.LieRK4
— TypeLieRK4(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Fourth order Lie Runge-Kutta method.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{celledoni2014introduction, title={An introduction to Lie group integrators–basics, new developments and applications}, author={Celledoni, Elena and Marthinsen, H{�a}kon and Owren, Brynjulf}, journal={Journal of Computational Physics}, volume={257}, pages={1040–1061}, year={2014}, publisher={Elsevier} }
OrdinaryDiffEqLinear.CG2
— TypeCG2(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Second order Crouch–Grossman method.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{celledoni2014introduction, title={An introduction to Lie group integrators–basics, new developments and applications}, author={Celledoni, Elena and Marthinsen, H{�a}kon and Owren, Brynjulf}, journal={Journal of Computational Physics}, volume={257}, pages={1040–1061}, year={2014}, publisher={Elsevier} }
OrdinaryDiffEqLinear.CG4a
— TypeCG4a(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Fourth order Crouch-Grossman method.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{jackiewicz2000construction, title={Construction of Runge–Kutta methods of Crouch–Grossman type of high order}, author={Jackiewicz, Zdzislaw and Marthinsen, Arne and Owren, Brynjulf}, journal={Advances in Computational Mathematics}, volume={13}, pages={405–415}, year={2000}, publisher={Springer} }
OrdinaryDiffEqLinear.MagnusAdapt4
— TypeMagnusAdapt4()
Semilinear ODE solver Fourth Order Adaptive Magnus method.
Keyword Arguments
References
@article{li2008adaptive, title={Adaptive explicit Magnus numerical method for nonlinear dynamical systems}, author={Li, Wen-cheng and Deng, Zi-chen}, journal={Applied Mathematics and Mechanics}, volume={29}, number={9}, pages={1111–1118}, year={2008}, publisher={Springer}}
OrdinaryDiffEqLinear.CayleyEuler
— TypeCayleyEuler()
Semilinear ODE solver First order method using Cayley transformations.
Keyword Arguments
References
@article{iserles2000lie, title={Lie-group methods}, author={Iserles, Arieh and Munthe-Kaas, Hans Z and Norsett, Syvert P and Zanna, Antonella}, journal={Acta numerica}, volume={9}, pages={215–365}, year={2000}, publisher={Cambridge University Press}}
Time and State-Dependent Operators
OrdinaryDiffEqLinear.CG3
— TypeCG3(; krylov = false,
m = 30,
iop = 0)
Semilinear ODE solver Third order Crouch-Grossman method.
Keyword Arguments
krylov
: Determines whether Krylov approximation or operator caching is used, the latter only available for semilinear problems.krylov=true
is much faster for larger systems and is thus recommended whenever there are >100 ODEs.m
: Controls the size of Krylov subspace.iop
: If not zero, determines the length of the incomplete orthogonalization procedure (IOP). Note that if the linear operator/Jacobian is hermitian, then the Lanczos algorithm will always be used and the IOP setting is ignored.
References
@article{crouch1993numerical, title={Numerical integration of ordinary differential equations on manifolds}, author={Crouch, Peter E and Grossman, R}, journal={Journal of Nonlinear Science}, volume={3}, pages={1–33}, year={1993}, publisher={Springer} }