Numercal Methods (CENG 00) CHAPTER-VI Numercal Soluton of Ordnar Dfferental Equatons 6 Introducton Dfferental equatons are equatons composed of an unknown functon and ts dervatves The followng are examples of dfferental equatons: dv dt c = g v (6a) m d x dx c kx = 0 (6b) dt dt m Dfferental equatons can be classfed as ordnar dfferental equatons (ODE) or partal dfferental equatons (PDE) ODEs are equatons n whch the functon nvolves one ndependent varable PDE's nvolve functons two or more varables Both Eq(6a) and Eq(6b) are ordnar dfferental equatons Dfferental equatons are also classfed as to ther order For Eq(6a) s a frst-order equaton because the hghest dervatve s a frst dervatve A second order equaton ncludes a second dervatve as n Eq (6b) above Smlarl an n th order equaton ncludes an nth dervatve Ths chapter s devoted to solvng ordnar dfferental equatons of the form d dx ( x ) = f (6) One-step Runge-Kutta (RK) methods can be generall expressed as = φh (63) Accordng to ths equaton the slope estmate of φ s used to extrapolate from an old value to new value over a dstance h Ths formula can be appled step b step to compute values of The smplest approach s to use the dfferental equaton to estmate the slope n the form of frst dervatve at x Academc ear 008/9 Instructor: Zerhun A
Numercal Methods (CENG 00) 6 Euler's Method The frst dervatve provdes a drect estmate of the slope at x That s ( ) φ = f x (64) f ( x ) s the dfferental equaton evaluated at x and Ths estmate can be substtuted nto Eq (63): = f ( x )h (65) Ths formula s referred to as Euler's method Error Analss for Euler's Method As n an other numercal procedure the numercal soluton of ODEs nvolves two tpes of errors () Truncaton error and () Round-off errors The truncaton errors are composed of two parts The frst s a local truncaton error that results from the applcaton of the method over a sngle step The second s a propagated truncaton error that results from the approxmaton produced durng the prevous steps The sum of the two s the total or global truncaton error Insght nto the magntude and propertes of the truncaton error can be ganed b dervng Euler's method drectl from the Talor seres expanson Remember that the dfferental equaton to be solved wll be of the general form ( x ) = f (66) = d dx and x and are the ndependent and the dependent varables respectvel If the soluton has contnuous dervatves t can be represented b a Talor seres expanson about a startng value ( x ) ( n) =! n! n h h h Rn (67) h = x x and n R = the remander term defned b Academc ear 008/9 Instructor: Zerhun A
Numercal Methods (CENG 00) R n = ( n ) ( ξ ) ( n )! h n (68) ξ les some n the nterval from x to x developed b substttng Eq(66) nto Eq(67) and (68) to eld An alternatve form can be n ( h ) ( n ( x ) f ) ( x ) n ( h ) f = f ( x ) h h O (69)! n! O specfes that the local truncaton error s proportonal to the step sze rased to the ( n )th power Thus we can see that Euler's method corresponds to the Talor seres up to and ncludng the term f ( x )h The true local truncaton error E t n the Euler method s thus gven as ( x ) n ( h ) f E = t h O (60)! For suffcentl small h the errors n the terms n Eq(60) usuall decrease as the order ncreases and the result s often represented as E a ( x ) f = h (6)! or ( ) E a = O h (6) E a = the approxmate local truncaton error Academc ear 008/9 Instructor: Zerhun A 3
Numercal Methods (CENG 00) Example Usng Euler s method solve the followng ntal value problem 63 Runge-Kutta Methods Runge-Kutta (RK) methods acheve the accurac of a Talor seres approach wthout havng requrng the calculaton of hgher dervatves Man varatons exst but all can be cast n the generalzed form: = ( x h)h (63) φ ( x h) φ s called an ncrement functon whch can be nterpreted as a representatve slope over the nterval The ncrement functon can be wrtten n the general form as φ = a k a k a k n n (64) Academc ear 008/9 Instructor: Zerhun A 4
Numercal Methods (CENG 00) the a 's are constants and the k 's are ( ) k = f x (65a) ( x p h q k h) k = f (65b) ( x p h q k h) k3 = f (65c) k ( x p h q k h q k h) = f n n n n n (65d) n Notce that the k's are recurrence relatonshps Varous tpes of Runge-Kutta methods can be devsed b emplong dfferent numbers of terms n the ncrement functon as specfed b n Note that the frst-order RK method wth n = s n fact Euler's method Once n s chosen values for the a's p's and q's are evaluated b settng eqn 64 equal to terms n a Talor seres expanson Fourth-order Runge-Kutta Methods The most popular and relatvel accurate RK methods are the fourth order There are an nfnte number of versons The followng known as the classcal fourth-order RK method s the most commonl used form ( k k k k ) = 3 6 (66) k = f ( x ) k k 3 = f x h kh = f x h k h ( x h k h) k4 = f 3 4 Academc ear 008/9 Instructor: Zerhun A 5
Numercal Methods (CENG 00) NB The n th order RK methods have local errors of o(h n ) and global error of o(h n ) Example Usng 4 th order Runge-Kutta methods solve the followng ntal value problem Academc ear 008/9 Instructor: Zerhun A 6