MathematicalSystems.jl icon indicating copy to clipboard operation
MathematicalSystems.jl copied to clipboard

Add nonlinear system with parameters and time dependency

Open mforets opened this issue 5 years ago • 3 comments

This is f!(dx, x, p, t) (in-place version) and f(x, p, t) (out-of-place version). It is the "canonical" function signature in DifferentialEquations.jl

We can call this internally a NonlinearContinuousSystem. Example:

f(x, p, t) = 1.01*x
p = @ivp(x' = f(x, p, t), x(0) ∈ 0..1)

solve(p, T=1.0) # only time horizon is given; initial time is implicitly 0
solve(p, tspan=(0.0, 1.0))

mforets avatar Feb 21 '20 17:02 mforets

What methods do we need to add, such that DifferentialEquations.solve(p,tspan=(0.0, 1.0)) works?

ueliwechsler avatar Feb 22 '20 18:02 ueliwechsler

One has to extract the vector field from the initial-value problem and construct the corresponding ODEProblem. Additional arguments and problem options can just be passed through. With the idea of VectorField from this comment, i prototyped this feature in ReachabilityAnalysis.jl, so you can do:

julia> using ReachabilityAnalysis, DifferentialEquations

julia> prob = @ivp(x' = 1.0x, x(0) ∈ [1/2])
julia> sol = DifferentialEquations.solve(prob, tspan=(0.0, 1.0))

retcode: Success
Interpolation: Automatic order switching interpolation
t: 5-element Array{Float64,1}:
 0.0                
 0.10003996803834632
 0.3480875036720596 
 0.6831749823340594 
 1.0                
u: 5-element Array{Array{Float64,1},1}:
 [0.5]               
 [0.5526075452476473]
 [0.7081780893966387]
 [0.9900773318307845]
 [1.3591408544074437]

mforets avatar Mar 04 '20 13:03 mforets

This looks really nice, cool :) I also had a go at the vector field functionality. See #160 for the comment.

ueliwechsler avatar Mar 05 '20 22:03 ueliwechsler