Why is 'interactive_trajectory()' in 'DynamicalSystems.jl' package giving an error?


The below given code was working few days back but now it is giving an error UndefVarError: `interactive_trajectory` not defined.

using DynamicalSystems
using OrdinaryDiffEq
using GLMakie

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]
	return nothing # always `return nothing` for in-place form!

u0 = [8.0, 1.0, 1.0]	#Initial conditions
p0 = [1.0, 1.0, 1.0]

#Solving coupled differential equations
lorenz = CoupledODEs(lorenz_rule!, u0, p0) 

ps = Dict(
    1 => 0.1:0.1:30,
    2 => 1:0.1:50,
    3 => 1:0.01:10.0,
pnames = Dict(1 => "σ", 2 => "ρ", 3 => "γ")

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

fig, dsobs = interactive_trajectory(
    lorenz, [u0];
    add_controls = true,
    parameter_sliders = ps,
    Δt = 0.01

Could anyone please check why the error is coming now?

Thank you

Does the exact code you posted produce the error in a fresh session?

Maybe you accidentally downgraded DynamicalSystems .jl. What version are you on?

1 Like

Dear @skleinbo,

Yes, the exact code I have posted produces the error in a fresh session.
‘DynamicalSystems.jl’ package is running successfully using ‘Julia v1.9’ in ‘VSCode’. Surprisingly the same code was running a few days back and giving the expected results but not today.

Thank you

It runs for me in a clean environment. I have

(jl_hAosgw) pkg> status
Status `/private/var/folders/51/jntzj7c12js_n4jq6f8_h_j40000gp/T/jl_hAosgw/Project.toml`
  [61744808] DynamicalSystems v3.2.1
  [ee78f7c6] Makie v0.19.9
  [1dea7af3] OrdinaryDiffEq v6.55.0

What is in your environment? What do you get when you do DynamicalSystems.interactive_trajectory [enter]?

1 Like

Dear @skleinbo,

(@v1.9) pkg> status
Status `~/.julia/environments/v1.9/Project.toml`
  [a6e380b2] ControlSystems v1.8.0
  [864edb3b] DataStructures v0.18.15
⌃ [0c46a032] DifferentialEquations v7.2.0
⌃ [61744808] DynamicalSystems v3.0.0
⌃ [e9467ef8] GLMakie v0.7.4
  [7073ff75] IJulia v1.24.2
⌅ [d1acc4aa] IntervalArithmetic v0.17.8
⌃ [138f1668] IntervalConstraintProgramming v0.9.1
⌅ [ee78f7c6] Makie v0.18.4
⌃ [961ee093] ModelingToolkit v8.3.1
⌃ [1dea7af3] OrdinaryDiffEq v6.11.2
  [91a5bcdd] Plots v1.39.0
  [c3e4b0f8] Pluto v0.19.27
⌃ [527681c1] ReversePropagation v0.1.3
⌅ [0c5d862f] Symbolics v4.14.0
  [b4f28e30] TikzGraphs v1.4.0
  [39424ebd] TreeView v0.5.0
  [770da0de] UpdateJulia v0.4.2
  [44cfe95a] Pkg v1.9.2
Info Packages marked with ⌃ and ⌅ have new versions available, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated`

After entering DynamicalSystems.interactive_trajectory, I am getting

UndefVarError: `interactive_trajectory` not defined
 [1] getproperty(x::Module, f::Symbol)
   @ Base ./Base.jl:31
 [2] top-level scope
   @ ~/Documents/Julia VS Code/GUI_DynamicalSystems.jl:43

Ah, you are indeed on an older version that does not include the visualization functions yet. Those were introduced with version 3.1 as far as I can tell. 3.2.1 is the current.

You really must have accidentally downgraded, which can happen if one keeps installing too many packages in one environment. It is generally discouraged to dump everything into the base environment. Instead it’s less error prone to use a new environment for every project, and only keep the bare necessities (Revise, BenchmarkTool, maybe Plots & Makie,…) in the base environment. See 4. Working with Environment · Pkg.jl and

Upgrade DynamicalSystems and it should work again. If you cannot, something is holding back the upgrade. Try ]add DynamicalSystems@3.2 for an error message then.

1 Like