JuliaDynamics / DynamicalSystems.jl

Award winning software library for nonlinear dynamics and nonlinear timeseries analysis
https://juliadynamics.github.io/DynamicalSystemsDocs.jl/dynamicalsystems/dev/
Other
842 stars 93 forks source link

t0 definition leads to unexpected behaviour with trajectory() #199

Closed pleibers closed 1 year ago

pleibers commented 1 year ago

Evolving a dynamical system with trajectory() and defining a t0 other than 0 the length of the time series stays the same, which is the length of the time series from 0 to T with dt. However, I would expect the length to change, e.g. with t0=T/2 the resulting time series should be half as long if dt stays the same. I couldn't find anything on this, and at what timepoints the series is actually saved.

Minimal Working Example

using DynamicalSystems

T = 100
p = [10.0, 28.0, 8 / 3]
u0 = [0.5, 0.5, 0.5]

function lorenz_rule!(du, u, p, t)
    σ, ρ, β = p
    du[1] = σ * (u[2] - u[1])
    du[2] = u[1] * (ρ - u[3]) - u[2]
    du[3] = u[1] * u[2] - β * u[3]
end

ds = ContinuousDynamicalSystem(lorenz_rule!,u0, p, t0=0.0)
ds2 = ContinuousDynamicalSystem(lorenz_rule!, u0, p, t0=50.0)

ts = trajectory(ds, T, Δt=0.01)
ts2 = trajectory(ds2, T, Δt=0.01)

size(ts,1) == size(ts2,1)
>>>true

Package versions

ChaosTools v2.9.0 DelayEmbeddings v2.4.1 DynamicalSystems v2.3.1 DynamicalSystemsBase v2.8.0 Entropies v1.1.2 RecurrenceAnalysis v1.8.1

pleibers commented 1 year ago

Just now realized T is not the final time, but the time for which the system is evolved, soryr

Datseris commented 1 year ago

no worries!