Skip to content

Docs: Perturbation example figure broken by v10 #3757

@moble

Description

@moble

The figure at the bottom of this section claims to be "similar to Figure 7.6.2 in Nonlinear Dynamics and Chaos". The cited figure shows an exponentially damped sinusoid, but the figure in the docs appears to just show a few data points, and does not at all resemble the figure in the book. This plot was working in the v9.79.1 docs.

I verified this for myself with a new project with just the requested dependencies. (See below for details.)

The problem is seemingly in this line:

u0 = Dict([unknowns(sys) .=> 0.0; D(y[0]) => 1.0]) # nonzero initial velocity

I guess that should be something more like

u0 = Dict([unknowns(sys)[begin:end-1] .=> 0.0; unknowns(sys)[end] => 1.0]) # nonzero initial velocity

The computed solution is all zeros, and integrates in just a few steps:

retcode: Success
Interpolation: 3rd order Hermite
t: 8-element Vector{Float64}:
  0.0
  9.999999999999999e-5
  0.0010999999999999998
  0.011099999999999997
  0.11109999999999996
  1.1110999999999995
 11.111099999999993
 50.0
u: 8-element Vector{Vector{Float64}}:
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

julia> using Pkg; Pkg.status()
Status `~/Research/Temp/mtk/Project.toml`
  [961ee093] ModelingToolkit v10.4.0
  [1dea7af3] OrdinaryDiffEq v6.98.0
  [91a5bcdd] Plots v1.40.14
  [0c5d862f] Symbolics v6.42.0

julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 12 × Apple M2 Max
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m2)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions