JuliaDynamics / DynamicalSystems.jl

Award winning software library for nonlinear dynamics and nonlinear timeseries analysis

Home Page:https://juliadynamics.github.io/DynamicalSystemsDocs.jl/dynamicalsystems/dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Passing a ModelingToolkit system to a ContinuousDynamicalSystem

RohanRajagopal opened this issue · comments

I was wondering if there was a way to pass a modelingtoolkit ODESystem to ContinuousDynamicalSystem()

The system is rather big, I wanted to know if I can pass this ODESystem to get the Lyapunov Spectrum.

Thank you very much

Cast the system into an ODEProblem and then pass that to CoupledODEs.

Oh sorry for that, I tried that, but for some reason it didn't work.

Just figured that it was due to one of the parameters being a non-float. Is that expected?

ERROR: MethodError: no method matching nextfloat(::Int64)

Thank you very much.

unfortunately it's impossible to give you any sorts of advice when providing the error information like that. have a look here: https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757

Apologies. Here is a probable MWE

@parameters ω1, a1, b1, c1
@variables t, x1(t), y1(t), z1(t)

D = Differential(t)

eqs_rossler = [
    D(x1) ~ (-ω1*y1- z1) 
    D(y1) ~ ω1*x1 + a1*y1        
    D(z1) ~ b1 + z1 * (x1 - c1)
]

@named sys_rossler = ODESystem(eqs_rossler)
sys_rossler = structural_simplify(sys_rossler)

u0_rossler = [x1 => 0.01,
y1 => 0.01,
z1 => 0.01]

p_rossler = [ω1 => 1,
a1 => 0.1,
b1 => 0.1,
c1 => 9]

tspan = (0, 300)
dt = 10^-2

prob_rossler = ODEProblem(sys_rossler, u0_rossler, tspan, dt=dt, p_rossler)
rossler_ds = ContinuousDynamicalSystem(prob_rossler)

but if tspan = (0,300.) it works. Oh is it to differentiate between Discrete and a ContinuousDynamical Systems.

But, thank you.

yes you need a float time.