12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

differential equation applications 203∫ tn+1⇒ y n+1 = y n + f(t, y) dt. (9.32)t nTo derive the second-order Runge–Kutta algorithm rk2 (Figure 9.4 right, rk2.javaon the CD), we expand f(t, y) in a Taylor series about the midpoint of the integrationinterval and retain two terms:f(t, y) ≃ f(t n+1/2 ,y n+1/2 )+(t − t n+1/2 ) dfdt (t n+1/2)+O(h 2 ). (9.33)Because (t − t n+1/2 ) to any odd power is equally positive and negative over theinterval t n ≤ t ≤ t n+1 , the integral of (t − t n+1/2 ) in (9.32) vanishes and we obtainour algorithm:∫ tn+1t nf(t, y) dt ≃ f(t n+1/2 ,y n+1/2 )h + O(h 3 ), (9.34)⇒ y n+1 ≃ y n + hf(t n+1/2 ,y n+1/2 )+O(h 3 ) (rk2). (9.35)We see that while rk2 contains the same number of terms as Euler’s rule, itobtains a higher level of precision by taking advantage of the cancellation of theO(h) terms [likewise, rk4 has the integral of the t − t n+1/2 and (t − t n+1/2 ) 3 termsvanish]. Yet the price for improved precision is having to evaluate the derivativefunction and y at the middle of the time interval, t = t n + h/2. And there’s the rub,for we do not know the value of y n+1/2 and cannot use this algorithm to determineit. The way out of this quandary is to use Euler’s algorithm for y n+1/2 :y n+1/2 ≃ y n + 1 2 h dydt = y n + 1 2 hf(t n,y n ). (9.36)Putting the pieces all together gives the complete rk2 algorithm:y n+1 ≃ y n + k 2 , (rk2) (9.37)k 2 = hf(t n + h 2 , y n + k )1, k 1 = h f(t n , y n ), (9.38)2where we use boldface to indicate the vector nature of y and f. We see that theknown derivative function f is evaluated at the ends and the midpoint of the interval,but that only the (known) initial value of the dependent variable y is required.This makes the algorithm self-starting.−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 203

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

Saved successfully!

Ooh no, something went wrong!