A PROJECT REPORT On Numercal solutons of ordnar dfferental equaton usng runge kutta method Submtted b: RENUKA BOKOLIA Research Scholar
Numercal Soluton of Ordnar Dfferental Equatons (ODE) I. Defnton An equaton that conssts of dervatves s called a dfferental equaton. Dfferental equatons have applcatons n all areas of scence and engneerng. Mathematcal formulaton of most of the phscal and engneerng problems lead to dfferental equatons. So, t s mportant for engneers and scentsts to know how to set up dfferental equatons and solve them. Dfferental equatons are of two tpes ) ordnar dfferental equaton (ODE) ) partal dfferental equatons (PDE). An ordnar dfferental equaton s that n whch all the dervatves are wth respect to a sngle ndependent varable. Eamples of ordnar dfferental equaton nclude d d d d d d d 5 sn (0), ( 0) d ) 0, ( 0), (0), ),, ( 0) Note: In ths part, we wll see how to solve ODE of the form d f (, ), ( 0) 0 II. Euler s Method We wll use Euler s method to solve an ODE under the form: d f (, ), ( 0) 0 At 0, we are gven the value of. Let us call 0 0 f,, then at 0 of wth respect to, that s, ( ) are known from the ntal condton ( 0 ) 0. as 0. Now snce we know the slope f. Both 0 and 0 0, 0, the slope s
0, 0 Φ True value, Predcted value Step sze, h Fgure.Graphcal nterpretaton of the frst step of Euler s method. So the slope at 0 as shown n the fgure above Thus Slope 0 0 f 0, 0 ( ) ( ) 0 f 0, 0 0 If we consder 0 as a step sze h, we get ( ) h 0 f 0, 0. We are able now to use the value of s the predcted value at, ( ) h f, h Based on the above equatons, f we now know the value of (an appromate value of at ) to calculate f, ( ) h at, then, whch Ths formula s known as the Euler s method and s llustrated graphcall n Fgure. In some books, t s also called the Euler-Cauch method.
True Value, Predcted value Φ h Step sze Fgure. General graphcal nterpretaton of Euler s method. It can be seen that Euler s method has large errors. Ths can be llustrated usng Talor seres. (, ) (, )... d d! f (, ) f '(, )! d! f ''(, )! ( ) ( ) ( )... As ou can see the frst two terms of the Talor seres f (, )h are the Euler s method. The true error n the appromaton s gven b E t ( ) f ʹ ʹ (, ) f ʹ h h!!,... The true error hence s appromatel proportonal to the square of the step sze, that s, as the step sze s halved, the true error gets appromatel quartered. However from Table, we see that as the step sze gets halved, the true error onl gets appromatel halved. Ths s because the true error beng proportoned to the square of the step sze s the local truncaton error, that s, error from one pont to the net. The global truncaton error s however proportonal onl to the step sze as the error keeps propagatng from one pont to another. II. Runge-Kutta nd order
Euler s method was derved from Talor seres as: f (, )h Ths can be consdered to be Runge-Kutta st order method. The true error n the appromaton s gven b E t ( ) f ʹ ʹ (, ) f ʹ h h!!,... Now let us consder a nd order method formula. Ths new formula would nclude one more term of the Talor seres as follows:! (, ) h f ʹ ( ) h f, Let us now appl ths to a smple eample: d e, f, e Now snce s a functon of, f ʹ (, ) ( 0) 5 (, ) f (, ) f d e e e ( ) e [( ) ]( e ) 5e 9 The nd order formula would be! (, ) h f ʹ ( ) h f, ( ) ( 5 e h e ) h 9 You could easl notce the dffcult of havng to fnd f (, ) Kutta dd was wrte the nd order method as! ʹ n the above method. What Runge and where ( a k a k )h k f, ( ) ( p h q k h) k f, ʹ. Ths form allows us to take advantage of the nd order method wthout havng to calculate f (, ) But, how do we fnd the unknowns a, a, p and q? Equatng the above equatons: f, h f ʹ, h and ( ak ak )h! gves three equatons.
a p a a a q Snce we have equatons and unknowns, we can assume the value of one of the unknowns. The other three wll then be determned from the three equatons. Generall the value of a s chosen to evaluate the other three constants. The three values generall used for a are, and, and are known as Heun s Method, Mdpont method and Ralston s method, respectvel. II.. Heun s method Here we choose a p q a, gvng resultng n where k f, ( ) ( h k h) k f, k k h Ths method s graphcall eplaned n Fgure 6. Slope f ( h, k h) Slope f,, predcted Average Slope, [ f ( h, k h) f ( )]
Fgure 6.Runge-Kutta nd order method(heun s method). II.. Mdpont method Here we choose a, gvng resultng n where a 0 p q k f, k f h, kh k h II.. Ralston s method Here we choose resultng n where a p q a, gvng k f, k f h, kh ( k k ) h NOTE: How do these three methods compare wth results obtaned f we found f (, ) ʹ drectl? We know that snce we are ncludng frst three terms n the seres, f the soluton s a polnomal of order two or less (that s, quadratc, lnear or constant), an of the three methods are eact. But for an other case the results wll be dfferent. Consder the followng eample
d e, If we drectl fnd the f ʹ (, ) ( 0) 5, the frst three terms of Talor seres gves where f f! (, ) h f ʹ ( ) h f, (, ) e ʹ (, ) 5e 9 For a step sze of h 0., usng Heun s method, we fnd ( 0.6). 090 The eact soluton gves ( ) e e ( 0.6) ( 0.6 0.6 e e ) 0.969 Then the absolute relatve true error s t 0.969.090 00 0.969.57% For the same problem, the results from the Euler and the three Runge-Kuttamethod are gven below Comparson of Euler s and Runge-Kutta nd order methods (0.6) Eact Euler Drect nd Heun Mdpont Ralston Value 0.969 0.955.090.0.097.099 t % 8.5.57..09.6 III. Runge-Kutta th order Runge-Kutta th order method s based on the followng
( a k a k a k a k )h where knowng the value of h at, we can fnd the value of at, and The above equaton s equated to the frst fve terms of Talor seres! d d,, ( ) ( ) ( ) ( ) d!, d!, d and h ', '', ''' f, h f h f h f h!!! Knowng that f (, ), Based on equatng the above equatons, one of the popular solutons used s ( k k k k )h 6 k f, Ths s the slope at. k f h, kh Ths s an estmate of the slope at the mdpont of the nterval [, ] usng the Euler method to predct the appromaton there. k f h, kh Ths s an Improved Euler appromaton for the slope at the mdpont. k f ( h k h) to., Ths s the Euler method slope at, usng the Improved Euler slopek at the mdpont to step Errors There are two man sources of the total error n numercal appromatons:. The global truncaton error arses from the cumulatve effect of two causes: At each step we use an appromate formula to determne n (leadng to a local truncaton error). The nput data at each step are onl appromatel correct snce n general (tn) n.. Round-off error, also cumulatve, arses from usng onl a fnte number of dgts.
It can be shown that the global truncaton error for the Euler method s proportonal to h, for the Improved Euler method s proportonal to h, and for the RungeKutta method s proportonal to h.