# Trajectory DynamicalSystems.jl, DifferentialEquations.jl

**URL:** <https://discourse.julialang.org/t/trajectory-dynamicalsystems-jl-differentialequations-jl/90659>\
**Category:** Modelling & Simulations\
**Created:** [November 22, 2022, 5:06pm UTC](https://discourse.julialang.org/t/trajectory-dynamicalsystems-jl-differentialequations-jl/90659 "2022-11-22T17:06:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergey\_Novak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sergey_novak/32/37716_2.png) [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Post date:** [November 22, 2022, 5:06pm UTC](https://discourse.julialang.org/t/trajectory-dynamicalsystems-jl-differentialequations-jl/90659/1 "2022-11-22T17:06:56Z")

</div>

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?

```julia
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))

```

---

<div class="post-metadata">

**Author:** ![Sergey\_Novak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sergey_novak/32/37716_2.png) [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Post date:** [November 22, 2022, 5:26pm UTC](https://discourse.julialang.org/t/trajectory-dynamicalsystems-jl-differentialequations-jl/90659/2 "2022-11-22T17:26:09Z")

</div>

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
