Skip to content

Commit a90dd13

Browse files
Update ode_simple_nonlinear_prob.jl
1 parent 1974092 commit a90dd13

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ function vanderpol(du, u, p, t)
5858
du[2] = μ * ((1 - x^2) * y - x)
5959
end
6060

61+
function vanderpol_jac(J, u, p, t)
62+
x = u[1]
63+
y = u[2]
64+
μ = p[1]
65+
J[1,1] = 0
66+
J[2,1] = -2μ - 1
67+
J[1,2] = 1
68+
J[2,2] = μ * (1 - x^2)
69+
end
70+
6171
"""
6272
Van der Pol Equations
6373
@@ -72,7 +82,8 @@ with ``μ=1.0`` and ``u_0=[\\sqrt{3}, 0]`` (where ``u[1] = x``, ``u[2] = y``)
7282
7383
Non-stiff parameters.
7484
"""
75-
prob_ode_vanderpol = ODEProblem(vanderpol, [sqrt(3), 0.0], (0.0, 1.0), [1.0])
85+
prob_ode_vanderpol = ODEProblem(ODEFunction(vanderpol, jac=vanderpol_jac),
86+
[sqrt(3), 0.0], (0.0, 1.0), [1.0])
7687

7788
"""
7889
Van der Pol Equations
@@ -435,4 +446,4 @@ where ``s=77.27``, ``w=0.161`` and ``q=8.375⋅10^{-6}``.
435446
Reference: [demoorego.pdf](http://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoOrego/demoorego.pdf)
436447
Notebook: [Orego.ipynb](http://nbviewer.jupyter.org/github/JuliaDiffEq/DiffEqBenchmarks.jl/blob/master/StiffODE/Orego.ipynb)
437448
"""
438-
prob_ode_orego = ODEProblem(orego, [1.0, 2.0, 3.0], (0.0, 30.0), [77.27, 8.375e-6, 0.161])
449+
prob_ode_orego = ODEProblem(orego, [1.0, 2.0, 3.0], (0.0, 30.0), [77.27, 8.375e-6, 0.161])

0 commit comments

Comments
 (0)