JuliaDynamics / InteractiveDynamics.jl

Fast, general-purpose interactive applications for complex systems
https://juliadynamics.github.io/InteractiveDynamics.jl/dev/
MIT License
171 stars 25 forks source link

Error in the example of interactive_evolution function #121

Open subhajitbn opened 1 year ago

subhajitbn commented 1 year ago

This is the error that I keep getting while trying to run the example in interactive trajectory evolution.

julia> include("lorenz.jl")
ERROR: LoadError: MethodError: no method matching interactive_evolution(::ContinuousDynamicalSystem{false, SVector{3, Float64}, 3, typeof(DynamicalSystemsBase.Systems.loop), Vector{Float64}, typeof(DynamicalSystemsBase.Systems.loop_jac), SMatrix{3, 3, Float64, 9}, false}, ::Vector{Vector{Float64}}; ps=Dict{Int64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}(2 => 10.0:0.1:50.0, 3 => 1.0:0.01:10.0, 1 => 1.0:0.1:30.0), idxs=(1, 2, 3), tail=1000, diffeq=(alg = Tsit5(stage_limiter! = trivial_limiter!, step_limiter! = trivial_limiter!, thread = static(false)), dt = 0.01, adaptive = false), pnames=Dict(2 => "ρ", 3 => "β", 1 => "σ"), lims=((-30, 30), (-30, 30), (0, 100)))
Closest candidates are:
  interactive_evolution(::DynamicalSystem{IIP}, ::Any; transform, idxs, colors, tail, diffeq, plotkwargs, m, lims) where IIP at C:\Users\subha\.julia\packages\InteractiveDynamics\Xw3Ei\src\chaos\trajanim.jl:42 got unsupported keyword arguments "ps", "pnames"
Stacktrace:
 [1] kwerr(::NamedTuple{(:ps, :idxs, :tail, :diffeq, :pnames, :lims), Tuple{Dict{Int64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, Tuple{Int64, Int64, Int64}, Int64, NamedTuple{(:alg, :dt, :adaptive), Tuple{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Float64, Bool}}, Dict{Int64, String}, Tuple{Tuple{Int64, Int64}, Tuple{Int64, Int64}, Tuple{Int64, Int64}}}}, ::Function, ::ContinuousDynamicalSystem{false, SVector{3, Float64}, 3, typeof(DynamicalSystemsBase.Systems.loop), Vector{Float64}, typeof(DynamicalSystemsBase.Systems.loop_jac), SMatrix{3, 3, Float64, 9}, false}, ::Vector{Vector{Float64}})
   @ Base .\error.jl:165
 [2] top-level scope
   @ C:\Users\subha\OneDrive\Desktop\Code\julia\Lorenz\lorenz.jl:28
 [3] include(fname::String)
   @ Base.MainInclude .\client.jl:476
 [4] top-level scope
   @ REPL[7]:1
in expression starting at C:\Users\subha\OneDrive\Desktop\Code\julia\Lorenz\lorenz.jl:28

I can't quite figure out whether there is something that I'm doing wrong. Any help is much appreciated.

Datseris commented 1 year ago

What code exactly are you running? Can you paste the exact code here? This is probably an unupdated documentation.

subhajitbn commented 1 year ago

This is the code.

using InteractiveDynamics
using DynamicalSystems, GLMakie
using OrdinaryDiffEq

diffeq = (alg = Tsit5(), adaptive = false, dt = 0.01)
ps = Dict(
    1 => 1:0.1:30,
    2 => 10:0.1:50,
    3 => 1:0.01:10.0,
)
pnames = Dict(1 => "σ", 2 => "ρ", 3 => "β")

lims = (
    (-30, 30),
    (-30, 30),
    (0, 100),
)

ds = Systems.lorenz()

u1 = [10,20,40.0]
u3 = [20,10,40.0]
u0s = [u1, u3]

idxs = (1, 2, 3)
diffeq = (alg = Tsit5(), dt = 0.01, adaptive = false)

figure, obs, step, paramvals = interactive_evolution(
    ds, u0s; ps, idxs, tail = 1000, diffeq, pnames, lims
)

# Use the `slidervals` observable to plot fixed points
lorenzfp(ρ,β) = [
    Point3f(sqrt(β*(ρ-1)), sqrt(β*(ρ-1)), ρ-1),
    Point3f(-sqrt(β*(ρ-1)), -sqrt(β*(ρ-1)), ρ-1),
]

fpobs = lift(lorenzfp, slidervals[2], slidervals[3])
ax = content(figure[1,1][1,1])
scatter!(ax, fpobs; markersize = 5000, marker = :diamond, color = :black)