High performance differential equation solvers for ordinary differential equations, including neural...
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
OrdinaryDiffEq.jl is a component package in the DifferentialEquations ecosystem. It holds the ordinary differential equation solvers and utilities. While completely independent and usable on its own, users interested in using this functionality should check out DifferentialEquations.jl.
OrdinaryDiffEq.jl is part of the SciML common interface, but can be used independently of DifferentialEquations.jl. The only requirement is that the user passes an OrdinaryDiffEq.jl algorithm to
solve. For example, we can solve the ODE tutorial from the docs using the
using OrdinaryDiffEq f(u,p,t) = 1.01*u u0=1/2 tspan = (0.0,1.0) prob = ODEProblem(f,u0,tspan) sol = solve(prob,Tsit5(),reltol=1e-8,abstol=1e-8) using Plots plot(sol,linewidth=5,title="Solution to the linear ODE with a thick line", xaxis="Time (t)",yaxis="u(t) (in μm)",label="My Thick Line!") # legend=false plot!(sol.t, t->0.5*exp(1.01t),lw=3,ls=:dash,label="True Solution!")
That example uses the out-of-place syntax
f(u,p,t), while the inplace syntax (more efficient for systems of equations) is shown in the Lorenz example:
using OrdinaryDiffEq function lorenz(du,u,p,t) du = 10.0(u-u) du = u*(28.0-u) - u du = u*u - (8/3)*u end u0 = [1.0;0.0;0.0] tspan = (0.0,100.0) prob = ODEProblem(lorenz,u0,tspan) sol = solve(prob,Tsit5()) using Plots; plot(sol,vars=(1,2,3))
Very fast static array versions can be specifically compiled to the size of your model. For example:
using OrdinaryDiffEq, StaticArrays function lorenz(u,p,t) SA[10.0(u-u),u*(28.0-u) - u,u*u - (8/3)*u] end u0 = SA[1.0;0.0;0.0] tspan = (0.0,100.0) prob = ODEProblem(lorenz,u0,tspan) sol = solve(prob,Tsit5())
For "refined ODEs" like dynamical equations and
SecondOrderODEProblems, refer to the DiffEqDocs. For example, in DiffEqTutorials.jl we show how to solve equations of motion using symplectic methods:
function HH_acceleration(dv,v,u,p,t) x,y = u dx,dy = dv dv = -x - 2x*y dv = y^2 - y -x^2 end initial_positions = [0.0,0.1] initial_velocities = [0.5,0.0] prob = SecondOrderODEProblem(HH_acceleration,initial_velocities,initial_positions,tspan) sol2 = solve(prob, KahanLi8(), dt=1/10);
Other refined forms are IMEX and semi-linear ODEs (for exponential integrators).