21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The implementation of an s-stage explicit Runge-Kutta single step method according to Def. 11.4.1<br />

is straightforward: The increments k i ∈ R d are computed successively, starting from k 1 = f(t 0 +<br />

c 1 h,y 0 ).<br />

Only s f-evaluations and AXPY operations are required.<br />

• Kutta’s 3/8-rule:<br />

0 0 0 0 0<br />

1 1<br />

3 3 0 0 0<br />

2<br />

3 −1 3 1 0 0 ➣ order = 4<br />

1 1 −1 1 0<br />

1 3 3 1<br />

8 8 8 8<br />

Shorthand notation for (explicit) Runge-Kutta<br />

methods<br />

Butcher scheme ✄<br />

(Note: A is strictly lower triangular s × s-matrix)<br />

c A<br />

b T :=<br />

.<br />

c 1 0 · · · 0<br />

c 2 a 21<br />

... .<br />

. . ... .<br />

b 1 · · · b s<br />

c s a s1 · · · a s,s−1 0<br />

(11.4.5)<br />

Remark 11.4.4 (“Butcher barriers” for explicit RK-SSM).<br />

order p 1 2 3 4 5 6 7 8 ≥ 9<br />

minimal no.s of stages 1 2 3 4 6 7 9 11 ≥ p + 3<br />

✸<br />

No general formula available so far<br />

Note that in Def. 11.4.1 the coefficients b i can be regarded as weights of a quadrature formula on<br />

[0, 1]: apply explicit Runge-Kutta single step method to “ODE” ẏ = f(t).<br />

Known:<br />

order p < number s of stages of RK-SSM<br />

Necessarily<br />

s∑<br />

b i = 1<br />

i=1<br />

Ôº ½½º<br />

△<br />

Ôº ½½º<br />

Example 11.4.3 (Butcher scheme for some explicit RK-SSM).<br />

Remark 11.4.5 (Explicit ODE integrator in MATLAB).<br />

• Explicit Euler method (11.2.1):<br />

0 0<br />

1<br />

➣ order = 1<br />

Syntax:<br />

[t,y] = ode45(odefun,tspan,y0);<br />

• explicit trapezoidal rule (11.4.3):<br />

0 0 0<br />

1 1 0<br />

1<br />

2 1 2<br />

➣ order = 2<br />

odefun : Handle to a function of type @(t,y) ↔ r.h.s. f(t,y)<br />

tspan : vector (t 0 , T) T , initial and final time for numerical integration<br />

y0 : (vector) passing initial state y 0 ∈ R d<br />

• explicit midpoint rule (11.4.4):<br />

0 0 0<br />

1<br />

2<br />

1<br />

2 0<br />

0 1<br />

➣ order = 2<br />

Return values:<br />

t : temporal mesh {t 0 < t 1 < t 2 < · · · < t N−1 = t N = T }<br />

y : sequence (y k ) N k=0 (column vectors)<br />

• Classical 4th-order RK-SSM:<br />

0 0 0 0 0<br />

1<br />

2 1 2 0 0 0<br />

1<br />

2 0 1 2 0 0<br />

1 0 0 1 0<br />

1<br />

6 2 6 6 2 6<br />

1<br />

➣ order = 4<br />

Ôº ½½º<br />

Code 11.4.6: parts of MATLAB integrator ode45<br />

1 function varargout = ode45 ( ode , tspan , y0 , options , v a r a r g i n )<br />

2 % Processing of input parameters omitted<br />

3 % .<br />

4 % Initialize method parameters.<br />

5 pow = 1 / 5 ;<br />

6 A = [ 1 / 5 , 3/10 , 4 /5 , 8 /9 , 1 , 1 ] ;<br />

7 B = [ Ôº ½½º

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!