03.03.2014 Views

Numerical Methods Course Notes Version 0.1 (UCSD Math 174, Fall ...

Numerical Methods Course Notes Version 0.1 (UCSD Math 174, Fall ...

Numerical Methods Course Notes Version 0.1 (UCSD Math 174, Fall ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10.2. RUNGE-KUTTA METHODS 133<br />

We now examine the “proper” choices of the constants. Note that w 1 = 1, w 2 = 0 corresponds<br />

to Euler’s Method, and does not require computation of K 2 . We will pick another choice.<br />

Also notice that the definition of K 2 should be related to Taylor’s theorem in two dimensions.<br />

Let’s look at it:<br />

K 2 /h = f(t + αh, x + βK 1 )<br />

= f(t + αh, x + βhf(t, x))<br />

= f + αhf t + βhff x + 1 (<br />

α 2 h 2 f tt (¯t, ¯x) + αβfh 2 f tx (¯t, ¯x) + β 2 h 2 f 2 f x x(¯t, ¯x) ) .<br />

2<br />

Now reconsider our step:<br />

x(t + h) = x(t) + w 1 K 1 + w 2 K 2<br />

= x(t) + w 1 hf + w 2 hf + w 2 αh 2 f t + w 2 βh 2 ff x + O ( h 3) .<br />

= x(t) + (w 1 + w 2 ) hx ′ (t) + w 2 h 2 (αf t + βff x ) + O ( h 3) .<br />

= x(t) + (w 1 + w 2 ) hx ′ (t) + w 2 h 2 (αf t + βff x ) + O ( h 3) .<br />

If we happen to choose our constants such that<br />

then we get<br />

w 1 + w 2 = 1, αw 2 = 1 2 = βw 2,<br />

x(t + h) = x(t) + hx ′ (t) + 1 2 h2 (f t + ff x ) + O ( h 3)<br />

= x(t) + hx ′ (t) + 1 2 h2 x ′′ (t) + O ( h 3) ,<br />

i.e., our choice of the constants makes the approximate x(t + h) good up to a O ( h 3) term, because<br />

we end up with the Taylor’s series expansion up to that term. cool.<br />

The usual choice of constants is α = β = 1, w 1 = w 2 = 1 2<br />

. This gives the second order Runge-<br />

Kutta Method :<br />

This can be written (and evaluated) as<br />

x(t + h) ← x(t) + h 2 f(t, x) + h f(t + h, x + hf(t, x)).<br />

2<br />

K 1 ← hf(t, x)<br />

K 2 ← hf(t + h, x + K 1 )<br />

x(t + h) ← x(t) + 1 2 (K 1 + K 2 ) .<br />

(10.4)<br />

Another choice is α = β = 2/3, w 1 = 1/4, w 2 = 3/4. This gives<br />

x(t + h) ← x(t) + h 4 f(t, x) + 3h 4 f (<br />

t + 2h 3 , x + 2h 3 f(t, x) )<br />

.<br />

The Runge-Kutta Method of order two has error term O ( h 3) . Sometimes this is not enough<br />

and higher-order Runge-Kutta <strong>Methods</strong> are used. The next Runge-Kutta Method is the order four

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

Saved successfully!

Ooh no, something went wrong!