From 8eaa427c4c54639863b03d609a02c12ed64996ee Mon Sep 17 00:00:00 2001 From: Karl Wessel Date: Tue, 8 Oct 2024 06:59:47 +0200 Subject: [PATCH] use more robust definition of initial conditions for perturbation example --- docs/src/examples/perturbation.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/src/examples/perturbation.md b/docs/src/examples/perturbation.md index 6fb094f8af..3ebdc3488a 100644 --- a/docs/src/examples/perturbation.md +++ b/docs/src/examples/perturbation.md @@ -106,8 +106,7 @@ unknowns(sys) ```@example perturbation # the initial conditions # everything is zero except the initial velocity -u0 = zeros(2order + 2) -u0[2] = 1.0 # yˍt₁ +u0 = Dict([unknowns(sys) .=> 0; D(y[1]) => 1]) prob = ODEProblem(sys, u0, (0, 3.0)) sol = solve(prob; dtmax = 0.01); @@ -169,8 +168,7 @@ We continue with converting 'eqs' to an `ODEProblem`, solving it, and finally pl ```@example perturbation # the initial conditions -u0 = zeros(2order + 2) -u0[1] = 1.0 # yˍt₁ +u0 = Dict([unknowns(sys) .=> 0; D(y[1]) => 1]) prob = ODEProblem(sys, u0, (0, 50.0)) sol = solve(prob; dtmax = 0.01)