Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
12.1 Model problem analysis<br />
12 Stiff Integrators<br />
Explicit Runge-Kutta methods with stepsize control (→ Sect. 11.5) seem to be able to provide approximate<br />
solutions for any IVP with good accuracy provided that tolerances are set appropriately.<br />
Example 12.1.1 (Blow-up of explicit Euler method).<br />
As in part II of Ex. 11.3.1:<br />
Everything settled about numerical integration?<br />
Example 12.0.1 (ode45 for stiff problem).<br />
IVP: ẏ = λy 2 (1 − y) , λ := 500 , y(0) = 1<br />
100 .<br />
IVP for logistic ODE, see Ex. 11.1.1<br />
ẏ = f(y) := λy(1 − y) , y(0) = 0.01 .<br />
Explicit Euler method (11.2.1) with uniform timestep h = 1/N, N ∈<br />
{5, 10, 20, 40, 80, 160, 320, 640}.<br />
1 fun = @( t , x ) 500∗x^2∗(1−x ) ;<br />
2 o p tions = odeset ( ’ r e l t o l ’ , 0 . 1 , ’ a b s t o l ’ ,0.001 , ’ s t a t s ’ , ’ on ’ ) ;<br />
3 [ t , y ] = ode45 ( fun , [ 0 1 ] , y0 , o p tions ) ;<br />
Ôº¼½ ½¾º¼<br />
186 successful steps<br />
The option stats = ’on’ makes MATLAB print<br />
55 failed attempts<br />
statistics about the run of the integrators.<br />
1447 function evaluations<br />
Ôº¼¿ ½¾º½<br />
1.4<br />
1.2<br />
ode45 for d t<br />
y = 500.000000 y 2 (1−y)<br />
y(t)<br />
ode45<br />
1.5<br />
ode45 for d t<br />
y = 500.000000 y 2 (1−y)<br />
0.03<br />
10 120<br />
10 100<br />
10 140 timestep h<br />
λ = 10.000000<br />
λ = 30.000000<br />
λ = 60.000000<br />
λ = 90.000000<br />
1.4<br />
1.2<br />
1<br />
y<br />
?<br />
1<br />
0.8<br />
0.6<br />
0.4<br />
0.2<br />
0<br />
0 0.2 0.4 0.6 0.8 1<br />
t<br />
Fig. 154<br />
Stepsize control of ode45 running amok!<br />
y(t)<br />
1<br />
0.5<br />
0.02<br />
0<br />
0 0.2 0.4 0.6 0.8 1<br />
t<br />
Fig. 155<br />
0 0.2 0.4 0.6 0.8 1 0 0.01<br />
The solution is virtually constant from t > 0.2 and, nevertheless, the integrator uses tiny<br />
timesteps until the end of the integration interval.<br />
Stepsize<br />
error (Euclidean norm)<br />
10 80<br />
10 60<br />
10 40<br />
10 20<br />
10 0<br />
10 −20<br />
10 −3 10 −2 10 −1 10 0<br />
Fig. 156<br />
λ large: blow-up of y k for large timestep h λ = 90: — ˆ= y(t), — ˆ= Euler polygon<br />
Explanation: y k way miss the stationary point y = 1 (overshooting).<br />
This leads to a sequence (y k ) k with exponentially increasing oscillations.<br />
y<br />
0.8<br />
0.6<br />
0.4<br />
0.2<br />
0<br />
−0.2<br />
exact solution<br />
−0.4<br />
explicit Euler<br />
0 0.1 0.2 0.3 0.4 0.6 0.7 0.8 0.5<br />
t<br />
0.9 1<br />
Fig. 157<br />
Ôº¼¾ ½¾º½ ✸<br />
Deeper analysis:<br />
For y ≈ 1: f(y) ≈ λ(1 − y) ➣ If y(t 0 ) ≈ 1, then the solution of the IVP will behave like the<br />
solution of ẏ = λ(1 −y), which is a linear ODE. Similary, z(t) := 1 −y(t) will behave like the solution<br />
of the “decay equation” ż = −λz.<br />
Ôº¼ ½¾º½