Skip to content

Commit 5048309

Browse files
Merge pull request #1793 from SciML/ChrisRackauckas-patch-5
More robust README example
2 parents 56ce7e5 + 0f6d4aa commit 5048309

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ lower it to a first order system, symbolically generate the Jacobian function
3838
for the numerical integrator, and solve it.
3939

4040
```julia
41-
using ModelingToolkit, OrdinaryDiffEq
41+
using DifferentialEquations, ModelingToolkit
4242

4343
@parameters t σ ρ β
4444
@variables x(t) y(t) z(t)
@@ -49,7 +49,7 @@ eqs = [D(D(x)) ~ σ*(y-x),
4949
D(z) ~ x*y - β*z]
5050

5151
@named sys = ODESystem(eqs)
52-
sys = ode_order_lowering(sys)
52+
sys = structural_simplify(sys)
5353

5454
u0 = [D(x) => 2.0,
5555
x => 1.0,
@@ -62,8 +62,8 @@ p = [σ => 28.0,
6262

6363
tspan = (0.0,100.0)
6464
prob = ODEProblem(sys,u0,tspan,p,jac=true)
65-
sol = solve(prob,Tsit5())
66-
using Plots; plot(sol,vars=(x,y))
65+
sol = solve(prob)
66+
using Plots; plot(sol,idxs=(x,y))
6767
```
6868

6969
![Lorenz2](https://user-images.githubusercontent.com/1814174/79118645-744eb580-7d5c-11ea-9c37-13c4efd585ca.png)
@@ -75,7 +75,7 @@ interacting Lorenz equations and simulate the resulting Differential-Algebraic
7575
Equation (DAE):
7676

7777
```julia
78-
using ModelingToolkit, OrdinaryDiffEq
78+
using DifferentialEquations, ModelingToolkit
7979

8080
@parameters t σ ρ β
8181
@variables x(t) y(t) z(t)
@@ -111,9 +111,9 @@ p = [lorenz1.σ => 10.0,
111111

112112
tspan = (0.0,100.0)
113113
prob = ODEProblem(connected,u0,tspan,p)
114-
sol = solve(prob,Rodas4())
114+
sol = solve(prob)
115115

116-
using Plots; plot(sol,vars=(a,lorenz1.x,lorenz2.z))
116+
using Plots; plot(sol,idxs=(a,lorenz1.x,lorenz2.z))
117117
```
118118

119119
![](https://user-images.githubusercontent.com/1814174/110242538-87461780-7f24-11eb-983c-4b2c93cfc909.png)

0 commit comments

Comments
 (0)