Skip to content

Commit 8eaa427

Browse files
author
Karl Wessel
committed
use more robust definition of initial conditions for perturbation example
1 parent a7adb53 commit 8eaa427

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

docs/src/examples/perturbation.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ unknowns(sys)
106106
```@example perturbation
107107
# the initial conditions
108108
# everything is zero except the initial velocity
109-
u0 = zeros(2order + 2)
110-
u0[2] = 1.0 # yˍt₁
109+
u0 = Dict([unknowns(sys) .=> 0; D(y[1]) => 1])
111110
112111
prob = ODEProblem(sys, u0, (0, 3.0))
113112
sol = solve(prob; dtmax = 0.01);
@@ -169,8 +168,7 @@ We continue with converting 'eqs' to an `ODEProblem`, solving it, and finally pl
169168

170169
```@example perturbation
171170
# the initial conditions
172-
u0 = zeros(2order + 2)
173-
u0[1] = 1.0 # yˍt₁
171+
u0 = Dict([unknowns(sys) .=> 0; D(y[1]) => 1])
174172
175173
prob = ODEProblem(sys, u0, (0, 50.0))
176174
sol = solve(prob; dtmax = 0.01)

0 commit comments

Comments
 (0)