# Trajectory DynamicalSystems.jl, DifferentialEquations.jl

Hello, i calculate trajectory of system by `ODEProblem` and `solve` from `DifferentialEquations.jl` and `trajectory` from `DynamicalSystems.jl`. With the same integrator parameters, they have different results, why is this?

``````U(y) = U0 + ΔU0 / ( 1 + exp( -50 * ( y - ythr ) ) )
σ(x)= 1 / (1 + exp(-20 * (x - xthr)))

function model(u, p ,t)

E, x, u_, y = u
τ, α, τ_D, J, U0, ΔU0, τ_y, β, xthr, ythr, I0 = p

du1 = (-E + α * log( 1 + exp( ( J * u_ * x * E + I0 ) / α ) )) / τ
du2 = ( 1 - x ) / τ_D - u_ * x * E
du3 = (U(y) - u_) / τ_F + U(y) * ( 1 - u_ ) * E
du4 = -y /  τ_y + β * σ(x)

return SVector(du1, du2, du3, du4)

end

τ = 0.013
α = 1.5
J = 3.07
τ_D = 0.15
U0 = 0.23
τ_F = 1
ΔU0 = 0.305
τ_y = 1.8
β = 0.4375
xthr = 0.9
ythr = 0.5
I0 = -1.45

p = SA[τ, α, τ_D, J, U0, ΔU0, τ_y, β, xthr, ythr, I0]
u0 = SA[1.4, 0.6, 0.0, -2.3];
tspan = (0.0, 2000.0)

prob = ODEProblem(model, u0, tspan, p)
sol = solve(prob, RK4(),  adaptive = false, dt = 0.001);

ds = ContinuousDynamicalSystem(model, u0, p)
tr = trajectory(ds, 2000.0; diffeq = (alg = RK4(),  adaptive = false, dt = 0.001))
``````

I finded problem it consists in redefining. When using setting `adaptive = false, dt = 0.001 ` for `diffeq` `Δt ` is redefining `dt ` in `diffeq`. I’m sorry

1 Like