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 systemsdu/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 for du/dt = A * u with constant matrix A

Time-dependent, state-independent (A(t))

  • MagnusMidpoint: Second-order Magnus method
  • MagnusLeapfrog: Second-order Magnus leapfrog scheme
  • MagnusGauss4: Fourth-order with Gauss quadrature
  • MagnusGL4: Fourth-order Gauss-Legendre Magnus method
  • MagnusGL6: Sixth-order Gauss-Legendre Magnus method
  • MagnusGL8: Eighth-order Gauss-Legendre Magnus method
  • MagnusNC6: Sixth-order Newton-Cotes Magnus method
  • MagnusNC8: Eighth-order Newton-Cotes Magnus method

State-dependent (A(u))

  • LieEuler: First-order Lie group method
  • RKMK2: Second-order Runge-Kutta-Munthe-Kaas method
  • RKMK4: Fourth-order Runge-Kutta-Munthe-Kaas method
  • LieRK4: Fourth-order Lie Runge-Kutta method
  • CG2: Second-order Crouch-Grossman method
  • CG4a: Fourth-order Crouch-Grossman method
  • CayleyEuler: 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.LinearExponentialType
LinearExponential(; 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 if krylov=:simple, and the initial subspace size if krylov=: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}}

source

Time-Dependent and State-Independent Solvers

OrdinaryDiffEqLinear.MagnusMidpointType
MagnusMidpoint(; 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/

source
OrdinaryDiffEqLinear.MagnusLeapfrogType
MagnusLeapfrog(; 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/

source
OrdinaryDiffEqLinear.MagnusGauss4Type
MagnusGauss4(; 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} }

source
OrdinaryDiffEqLinear.MagnusNC6Type
MagnusNC6(; 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} }

source
OrdinaryDiffEqLinear.MagnusGL6Type
MagnusGL6(; 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} }

source
OrdinaryDiffEqLinear.MagnusGL8Type
MagnusGL8(; 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} }

source
OrdinaryDiffEqLinear.MagnusNC8Type
MagnusNC8(; 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} }

source
OrdinaryDiffEqLinear.MagnusGL4Type
MagnusGL4(; 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} }

source

State-Dependent Solvers

OrdinaryDiffEqLinear.LieEulerType
LieEuler(; 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} }

source
OrdinaryDiffEqLinear.RKMK2Type
RKMK2(; 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} }

source
OrdinaryDiffEqLinear.RKMK4Type
RKMK4(; 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} }

source
OrdinaryDiffEqLinear.LieRK4Type
LieRK4(; 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} }

source
OrdinaryDiffEqLinear.CG2Type
CG2(; 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} }

source
OrdinaryDiffEqLinear.CG4aType
CG4a(; 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} }

source
OrdinaryDiffEqLinear.MagnusAdapt4Type
MagnusAdapt4()

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}}

source
OrdinaryDiffEqLinear.CayleyEulerType
CayleyEuler()

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}}

source

Time and State-Dependent Operators

OrdinaryDiffEqLinear.CG3Type
CG3(; 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} }

source