Constant linear equation d/dt x=Ax with DifferentialEquations.jl

In Non-autonomous Linear ODE / Lie Group ODE Solvers · DifferentialEquations.jl are examples for solving d/dt x = A(t) x, time-dependent A, or state dependent A(x), d/dt x = A(x)x, but no example for just constant A. How do I solve d/dt x=Ax for a constant matrix A with LinearExponential solver?

1 Like

Something like:

using OrdinaryDiffEq
_A = [2 -1;-3 -5]/5
A = DiffEqArrayOperator(_A)
prob = ODEProblem(A, [1.0,-1.0], (1.0, 6.0))
sol = solve(prob, LinearExponential())

should do it. PR to the docs if you think that’s a good addition.

3 Likes

I will open a PR shortly. I had to import OrdinaryDiffEq explicitly besides DifferentialEquations. Is this intended?

Not intended. DifferentialEquations.jl should be used in all of the docs, but this is explicitly using only an OrdinaryDiffEq solver so you can just call it directly for lower dependency counts.

1 Like

Ok thanks!