The Computable Differential Equation Lecture ... - Bruce E. Shapiro

The Computable Differential Equation Lecture ... - Bruce E. Shapiro The Computable Differential Equation Lecture ... - Bruce E. Shapiro

bruce.shapiro.com
from bruce.shapiro.com More from this publisher
21.04.2015 Views

104 CHAPTER 5. RUNGE-KUTTA METHODS Figure 5.5: The function RungeKuttaOrderConditions in Mathematica. 5.6 Step Size Control for ERK Methods Computing the local truncation error for a Runge-Kutta method is quite unwieldy and requires the analytic calculation of numerous partial derivatives, making it impractical for an efficient implementation. Instead, we are forced to use an approximation of the error. Suppose we have computed two different solutions: y, of order p, and z, of order p + 1. Then y n = y(t n ) + ch p+1 + O(h p+2 ) (5.132) z n = y(t n ) + O(h p+2 ) (5.133) for some constant c that depends on the method but is independent of h. Subtracting, ch p+1 = |y n − z n | (5.134) The idea is that we have some tolerance ɛ that we do not want to exceed, and when |y n − z n | approaches ɛ, we choose a new step size that satisfies |y n − z n | old h p+1 old ≈ c ≈ |y n − z n | new h p+1 new < νɛ h p+1 new (5.135) Math 582B, Spring 2007 California State University Northridge c○2007, B.E.Shapiro Last revised: May 23, 2007

CHAPTER 5. RUNGE-KUTTA METHODS 105 where ν is a safety fraction, say 50%, giving the level of comfort or closeness we want to allow the error estimate to approach ɛ. Then we choose any h new satisfying ( ) 1 νɛ h new < h old |y n − z n | old p+1 (5.136) Again, when the error becomes significantly smaller than νɛ the process can be reversed, and the step size increased. Or the step size can be adjusted at each calculation to equal the right hand side of 5.136. The problem with this technique is that one needs to perform two calculations, one at each of two different orders. This could potentially double the computation time unless we can find an embedded method – that is, one that has a lower-level computation built into it as part of the higher level computation. If the original and embedded methods are given by and c c A b T (5.137) A ˆb T (5.138) respectively, then we use the shorter notation c A b T ˆb T (5.139) to describe them both together. For example, the forward Euler is embedded in the modified trapezoidal: 0 0 0 1 1 0 (5.140) 1 0 1/2 1/2 One frequently implemented method is the six-stage Runge-Kutta-Fehlberg which has a 4-th order method embedded within a fifth-order method: 0 1/4 1/4 3/8 3/32 9/32 12/13 1932/2197 −7200/2197 7296/2197 1 439/216 −8 3680/513 −845/4104 1/2 −8/27 2 −3544/2565 1859/4104 −11/40 25/216 0 1408/2565 2197/4104 −1/5 0 16/135 0 6656/12825 28561/56430 −9/50 2/55 (5.141) c○2007, B.E.Shapiro Last revised: May 23, 2007 Math 582B, Spring 2007 California State University Northridge

CHAPTER 5. RUNGE-KUTTA METHODS 105<br />

where ν is a safety fraction, say 50%, giving the level of comfort or closeness we<br />

want to allow the error estimate to approach ɛ. <strong>The</strong>n we choose any h new satisfying<br />

(<br />

) 1<br />

νɛ<br />

h new < h old<br />

|y n − z n | old<br />

p+1<br />

(5.136)<br />

Again, when the error becomes significantly smaller than νɛ the process can be<br />

reversed, and the step size increased. Or the step size can be adjusted at each calculation<br />

to equal the right hand side of 5.136.<br />

<strong>The</strong> problem with this technique is that one needs to perform two calculations,<br />

one at each of two different orders. This could potentially double the computation<br />

time unless we can find an embedded method – that is, one that has a lower-level<br />

computation built into it as part of the higher level computation. If the original and<br />

embedded methods are given by<br />

and<br />

c<br />

c<br />

A<br />

b T (5.137)<br />

A<br />

ˆb T (5.138)<br />

respectively, then we use the shorter notation<br />

c<br />

A<br />

b T<br />

ˆb T (5.139)<br />

to describe them both together. For example, the forward Euler is embedded in the<br />

modified trapezoidal:<br />

0 0 0<br />

1 1 0<br />

(5.140)<br />

1 0<br />

1/2 1/2<br />

One frequently implemented method is the six-stage Runge-Kutta-Fehlberg which<br />

has a 4-th order method embedded within a fifth-order method:<br />

0<br />

1/4 1/4<br />

3/8 3/32 9/32<br />

12/13 1932/2197 −7200/2197 7296/2197<br />

1 439/216 −8 3680/513 −845/4104<br />

1/2 −8/27 2 −3544/2565 1859/4104 −11/40<br />

25/216 0 1408/2565 2197/4104 −1/5 0<br />

16/135 0 6656/12825 28561/56430 −9/50 2/55<br />

(5.141)<br />

c○2007, B.E.<strong>Shapiro</strong><br />

Last revised: May 23, 2007<br />

Math 582B, Spring 2007<br />

California State University Northridge

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

Saved successfully!

Ooh no, something went wrong!