You are on page 1of 56
10 NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS 4, Introduction 2. Picard’s method 3, Taylors series method 4. Euler's method_— 5, Modified Euler's method ——~ 6. Runge’s method 7. Runge-Kutta method v—~ 8. Predictor-corrector methods. 9, Mine's method 10. Adams-Bashtorth method. 4. Simultaneous first order differential 12, Second order differential equations. equations 13. Error analysis 14. Convergence of a method 15. Stability analysis 16. Boundary-value problems ~~ 17. Finite-ditference method y-—~ 18. Shooting method ~~ 49. Objective type of questions 10.1. (1) INTRODUCTION A number of problems in science and technology can be formulated into differential equations. The analytical methods of solving differential equations are applicable only to a limited class of equations. Quite often differential equations appearint in physical problems donot belong to any of these familiar types ‘and one is obliged to resort to numerical methods. ‘These methods are of even greater importance when we realise that computing machines are tow readily available which reduce numerical work considerably. (2) Solution of a differential equation. The solution of an ordinary differential equation means finding an explicit expression for y in terms ofa finite number of elementary functions of: Seah w eolution of a differential equation is known as the closed or finite form of elution Th the phaenoa af nach mcckuston, we have sevoursodts tmumeriasl methods of Solution, Let us consider the first order differential equation dyldx = les, y), given Yo) = Yor a) Lostudy the various numerical methods of solving such equations. In most of these methods, We replace the differential equation by a difference equation and then solve it. These meth- tis el solutions either as power series in x fom which the values ofy ean be found by inet substitution, or a set of values of x and y- The methods of Picard ‘and Taylor series 289 ist "NUMERICAL METHODS IN ENGINEERING AND SCIENCE | belong to the former class of solutions. In these methods, y in (1) is approtimated by a trun. cated series, each term of which is a function of x. The information about the curve at ong point is utilized and the solution is not iterated. As such, these are referred to as single-ste methods. The methods of Euler, Runge-Kutta, Milne, Adams-Bashforth ete. belong to the latter class of solutions. In these methods, the next point on the curve is evaluated in short steps ahead, by performing iterations till sufficient accuracy is achieved. As such, these meth. ods are called step-by-step methods. Euler and Runga-Kutta methods are used for computing y over a limited range of x. values whereas Milne and Adams methods may be applied for finding y over a wider range of xvalues, Therefore Milne and Adams methods require starting values which are found by Picard’s Taylor series or Runge-Kutta methods. (3) Initial and boundary conditions. An ordinary differential equation of the ath order is of the form Fix, y, dyldx, d?y/dx’ ....., d"y/ dx") = 0 wl) Its general solution contains n arbitrary constants and is of the form G1, 5 C45 Cay osesnney Cy) = 0 (8) To obtain its particular solution, n conditions must be given so that the constants c,, Cay wie Cy can be determined. If these conditions are prescribed at one point only (say : x then the differential equation together of the nth order. If the conditions are termed as boundary value problem. In this chapter, then explain finite dit problems. , ‘os with the conditions constitute an initial value problem prescribed at two or more points, then the problem is we shall first describe methods for solving initial value problems and ifference method and shooting method for solving boundary value 10.2, PICARD'S METHOD Consider the first order equation S = fx, y) cn Jf is required to find that particular solution of (1) which assumes the val yhen X= Xp, Integrating (1) between limits, we get Peres — i fia Z fre de or yayys fires de 2) Mer at an integral equation equivalent to (1), for it contains the unknown y under the As a first i " F ae @ first approximation ¥; to the solution, we put Y =o in fix, y) and integrate (2), %1= 90+ f" fleey9 dx For a second approximation ys, we put-y = y, in fx, y) and integrate (2), giving = H+ | fares. ' gin SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS wo = log (x +9), y (Q =2 dx aix=12and 1.4 with h =0.2. L (Bhopal, B.E., 2009) Sol. The various calculations are arranged as follows : £ log (x+y) =y" ‘Mean slope Old y + 0.2 (mean slope) = new ¥ 0.0 log (0 + 2) (02 log (0.2 + 2.0602) 402 | tog (0.2 + 2.0655) 1 o.g10 40.3541) 2 (0.301 + 0.9852) 2 + 0,2(0.301) = 2.0602 }2 + 0.2 (0.8276) = 2.0655 2 + 0.2 (0.3281) = 2.0656 02 0.3552 04 log (0.4 + 2.1366) 04 log (0.4 + 2.1415) 4 (0.9552 + 0.4042) 1 (0.9652 + 0.4050) .0656 + 0.2 (0.3552) = 2.1366 2.0656 + 0.2 (0.3797) = 2.1415 2.0656 + 0.2 (0.3801) = 2.1416 of 0.4051 06 | tog (0.6 + 2.2226) 3 (0.4051 + 0.4506) ; (0.4051 + 0.4514) 2.1416+ 0.2 (0.4051) = 2.2226 2.1416 + 0.2 (0.4279) = 2.2272 2.1416 + 0.2 (0.4282) = 2.2272 08 | tog (0.6 + 2.2272) es 0.4514 08 | tog (0.8 + 2.8175) og be log (0.8 + 2.3217) 3 (0.4514 + 0.4938) 2.2272 + 0.2 (0.4514) = 2.3175 2.2272 + 0.2 (0.4726) = 2.3217 2.9972 + 0.2 (0.4727) = 28217 aie Ee ots Bees — NUME! 0.4943 - log (1 + 2.4206) 3 (0.4943 + 0.5341) } (0.4943 + 0.5846) 3 (0.5346 + 0.5728) 2 (0.5346 + 0.5719) | | } (0.5723 + 0.6074) | 3 (0.5723 + 0.6078) RICAL METHODS IN ENGINEERING AND Scien | Fann + 0.2 (0.4943) = 2.4206 2.9217 + 0.2 (0.5142) = 2.4245 2.3217 + 0.2 (0.5144) = 2.4245 2.4245 + 0.2 (0.5346) = 2.5314 2.4245 + 0.2 (0.5532) = 2.5351 2.4245 + 0.2 (0.5534) = 2.5351 2.5351 + 0.2 (0.5723) = 2.6496 2.5351 + 0.2 (0.5898) = 2.6531 2.5361 + 0.2 (0.5900) = 2.6531 Example 10.13. Using Euler's me ies “oO. 8 10 10 Jog (1 + 2.4245) 1.0 0.5346 12 log (1.2 + 2.5314) 12 | log (1.2 + 2.5351) 2 | 0.5723 14 | log (14 + 2.6496) 14 log (1.4 + 2.6531) Hence y(1.2) dyldx =x + | Jy; with initial conditions y = 1 at x = 0, for the range 0 $x $0.6 in steps of 0.2. 2.5351 and y(1.4) = 2.6531 approximately. odified method, obtain a solution of the equation (V.T.U., B. Tech., 2007) Sol. The various calculations are arranged as follows : x Suliolege Mean slope Old y + 0.2 (mean slope) = new y = Te a 1+02()=12 02 L2) i 02+ | faz | 31 + 1.2954) 1+ 0.2 (1.1477) = 12 + 954 =1LMI7 = 1.2295 02 | 02+ 3 | yia2295) 3 (1+ 1.9088) 1+ 0.2 (1.1544) = 1.3088 = 11544 = 1.2309 02 | 02+ | (3305 | 31 + 1.3094) 1+ 0.2 (1.1547) = 1.3094 = 1.1547 = 1.2309 02 1.3094 i 1.2309 + 0.2 (1.3094) . = 14927 04+ | (492m | | 31.3004 + 1.6218) 1.2309 + 0.2 (1.46 Hy : .2 (1.4654) 1.6218 = 1.4654 1.5240 04 4+ Ly 4+ | J0524)1 | 3.3004 + 14 1.2309 + 0.2 ee 2309 + 0.2 (1. ae ae se 4718) 04 0.4 + | (1525 ; a | (15253) |_| 3 3094+ 1.6350) 1.2309 + 0.2 (1.47 : .2 (1.4721) 1.5253 a SOLUTION OF ORDINARY DIFFERENTIAL EQUationg pap gee on ee _ -—-—--7-- es Ce 1.6350 Ss a sonain bac i a] 1.5253 + 0.2 (1.635) = 1.8523 1 1 oo 1.8523) | (1.635 + 1 is 06 + | Y(L8E 2 +1961) 1.5253 + 0.2 (1.798) | 219610 = 1798 see 0.6 + | (718849) | 1(1.635 + 1.97 ; as | 06+ | C8845) pt. .9729) 1.5253 + 0.2 (1.804) = 1.9729 = 1.8040 = 1.8861 : i ae | 06+ | yase6n | 3 (1.635 + 1.9734) 1.5258 + 0.2 (1.8042) = 1.9734 = 1.8042 = 1.8861 Hence y(0.6) = 1.8861 approximately. ou ily L Apply Buler’s method to solve y’ =x + y, y(0) = 0, choosing the step length = 0.2. (Carry out 6 steps). (Kottayam, B.E., 2005) Using Euler's method, find approximate value of y when x = 0.6 of dy/dx = 1 - 2xy, given that y = 0 when x = 0 (take h = 0.2). 3. Using simple Euler's method solve for y at x = 0.1 from dyldx = x +y + xy, (0) = 1, taking step size h = 0.025, 4. Solve y= 1 -y, yO) =0 by modified Euler's method and obtain y at x = 0.1, 0.2, 0.3. (Anna, B. Tech., 2005) 5. Given that dy/dx = x +? and y = 1 at x = 0. Find an approximate value of y at x = 0.5 by modified Euler's method. (Bhopal, B.E., 2002) 6. Giveny’ = x + sin y, y(0) = 1. Compute (0.2) and y(0.4) with h = 0.2 using Buler’s modified method. (.N.T.U., B. Tech., 2007) 7. Given s 2—* ith boundary conditions y= 1 when x=0, find approximately y for yee *=0.1, by Euler’s modified method (5 steps). (V.T.U., B. Tech., 2007) 8. Given that dy/dx = 2+ Gg) and y = Lwhen.x = 1, Find approximate value of y at x = 2 in steps of 0.2, using Euler’s modified method. (Anna, B.E., 2004) los, RUNGE’S METHOD’ d _ Consider the differential equation, = Ax, y), V9) =Y0 dD) Clearly the slope of the curve through Ply Yo) i8 Alxy, Yo) (Fig. 10.2). Integrating both sides of (1) from (Xp, Yo) #0 a + fy Yq +), we have ire a= fe" fix, pdx aa Called after the German mathematician Carl Runge (1856—1927) Fig. 10.2 ‘To evaluate the integral on the right, we take N as the mid-point of LM and find the values of fix, y) (i.e. dy/dx) at the points xy, x5 + h/2, xy + h. For this purpose, we first deter. mine the values of y at these points. Let the ordinate through N cut the curve PQ in S and the tangent PT in S,. The value of yg is given by the point S,. ee NS = LP +HS, =y,+PH.tan0 h = dq + h dyldtlp = yy + 5 fos 90) (8) Also p= MT = LP + RT =yy + PR. tan 0 = yy + hflt yo). Now the value of yg at x5 + h is given by the point 7” where the line through P draw with slope at Ttx +h, y,) meets MQ. ) = tan 0 = fly + hy yp) = fly + hy ¥y + fly Yo] Yq = MR + RT =yy + PR. tan O' = yp + fly + hy y+ hflty, ¥o)l (4) ‘Thus the value of flx, y) at P= Axy, yo); the value of fix, y)at S = flxy + h/2, ys) and the value of ft,y) at @Q = flxy +h, yg) where ys and yg are given by (3) and (4) Hence from (2), we obtain Slope at eu ‘ ie Fe fla, 9) dx = Elf +4fs + fal by Simpson's rule (p. 191) h = G Mondo) + Aflay + W/2, ¥5) + (xy + hy yQ)l (5) which gives a sufficiently accurate value of k and also of y = yp +k The repeated application of (5) gives the values of y for equi-spaced points. Pe eee ros working rule to solve (1) by Runge’s method : . calculate successively : by = hy ¥o)s hy = hf (x thy +a) 2 hflay +h, - Yo + hy) and hy = hfs + hy yp + BY Finally compute, k = 6 (hy + 4k, + ky). (Note that k is the weighted mean of k,, ky and k,). 1 Example 10.14. Apply Runge’s method to find an aq, i = eases eee proximate value of y when x = 0.2, Sol. Here we have x, = 0, y= 1, h = 0.2, flxp, 90) kh, = hflxy, Yo) = 0.2(1) = "0.200 re EH 1) y= M(x +3h, 70 +34, |= 02 fO.1, 1.1) = 0.240 Ki = hflxy + hy yo + hy) = 0.2 NO.2, 1.2) = 0.280 and hg = hflty + h, Yo +k) = 0.2 AO.1, 1.28) = 0.296 see 1 ; k= gt + dh + Ry) = 0-200 + 0.960 + 0.296) = 0.2426 Hence the required approximate value of y is 1.2426. 10.7. RUNGE-KUTTA METHOD* ‘The Taylor’s series method of solvirig differential equations numerically is restricted by the labour involved in finding the higher order derivatives. However there is a class of methods known as Runge-Kutta methods which do not require the calculations of higher order derivatives and give greater accuracy. The Runge-Kutta formulae possess the advan- tage of requiring only the function values at some selected points. Thesé methods agree with. Taylor's series solution upto the term in h” where r differs from method to imethod and is called the order of that method. (i) First order R-K method. W 1 =o + fq» Yo) = Yo* hyo! Expanding by Taylor's series ‘e have seen that Euler’s method (§ 10.4) gives by =fsy) 2 (a yy = Oey += Io + He! + “y % Fas 2 It follows that the Euler’s method agrees with the Taylor's series solution upto the inh. Hence, Euler’s method is the Runge-Kutta method of the first order. (ti) Second order R-K method. The modified Euler’s method gives ‘ AD) “yay Elle, yo) 0+ 30 “00h means “erme containing second and higher powers of f’ and is read as order of h. aoa ua { hand side of (1), we obtain . right Substituting y, =Yo + Mt Yoon the ep + fle theo t Hho)! where fo = Ato, Yo) (2) ) Yo 2 ’¢ ies, we get Expanding LHS. by Taylor's seri es ; ‘capac =setboe + gid aT (8) ny h hf,) by Taylor's series for a function of two variables, (2) Rives Expanding fit +h,¥o + Mo . of (2) ont} N=Yo* Ali {ranmea(Z), +H ay} 7 af #) oun) one Ynomer (BF ie 2 GRY) _ OF af [: de. oe 2 =o + bly + > fa’ + OCF°) a R = + hyg + 7" + O(h3) wuld) Comparing (3) and (4), it follows that the modified Euler’s method agrees with the Taylor's series solution upto the term in h2. | Hence the modified Euler's method is the Runge-Kutta method of the second order, «. The second order Runge-Kutta formula is 1 M1299 ylks +h) | where y= hftte.yy) and y= hil +h, yp + Ry). _ ii) Third order R-K method. Similarly, agrees with the Taylor's series solution upto As such, Runge’s method is the Ruy The third order Runge-Kutta form it can be seen that Runge’s method (§10.8) the term in h3, nge-Kutta method of the third order: ula is 1 ViFYo+ iki + Aka + hy) iors By = Hig 99, hy = {2 +The 34) 2 By = hfe + hy yy +k), (iv) Fourth order R-K method, This me ferred to as Runge-Kutta method onl; id ~ = where k’ = hflty +h, yo + ky). ethod is most commonly used and is often ly. 4 | ele ing rule for finding the increm i working ent k of y correspondi i os sponding to an increment h of x by cd dy “de =F ys Yq) = I 0s follows : Caleulate successively ky = hflty, yo), ky = hf (x Pye a; ) 2 2 1 1 neo Fha30 + th and ky = hflxy +h, yp + Ry) al Finally compute k= (Ry + 2k, + 2k, + hy) hich gives the required approximate value as y; =p +k. (Note that k is the weighted mean of k, ky, k, and k,). Obs. One of the advantages of these methods is that the operation is identical whether the siferential equation is linear or non-linear. . Example 10.15. Apply Runge-Kutta fourth order method to find an approximate value ofy when x = 0.2 given that dyldx =x+xand y= 1 whenx= 0. (V.T.U., B. Tech., 2009) Sol. Here xy = 0, yg = 1, h = 0.2, Ato, Yo) = 1 hey = fly. Yo) = 0.2 x1 wrdie’? = 0.2000 — ee ha nese gh + fir) = 0.2 x 0.1, 1.) = 0.2400 ky = hf (+ + zh Yo * in) = 0.2 x 0.1, 1.12) = 0.2440 0.2 x AO.2, 1.244) = 0.2888 and flory + fs Yo Bs) = i % k= gt + Dky + 2k, + hy 6 (0.2000 + 0.4800 + 0.4880 + 0.2888) = z x (1.4568) = 0.2428. Hence the required approximate value of y is 1.2428. ta method of fourth order, sélve * A with (J.N.T.U., B. Tech., 2009) @ Example 10.16.-Using Runge-Kut ¥O=1latx= 0.2, 0.4. yoat Fob Wa have flx, 9) = Ey 4? To find y(0.2) : Herex,=0,y)=1,h=02 . 2 Potgy Yo) = 0-2 KO D = 0.2000 = 0.19672 4 z ee ie (x +Fhy +4) 0.2, AOA, LD ~ 1,,) =0.9/(0.1, 1.09836) = 0.1967 hy= Mf sy hyo +h] = O2F( a a .2, 1.1967, — 4 = fly + hy Yo + hy) = 0-210.2, be hy + 2by 2h +h) = 1 10.2 + 0.19672) + 2(0.1967) + 0.1891] = 0.19593 = (0 Hence y(0.2) = yy + k= 1.196 : To find y(0.4) : Here x, = 0.2, y, = 1.196, h = 0.2. 2 heh flx,,y,) = 0.1891 k {x +h at 34) 0.2 0.3, 1.2906) = 0.1795 hehe(ne gin +3a) = 0.2 0.3, 1.2858) = 0.1793 key =h fle, +h, y, + hy) = 0.2 R04, 1.3753) = 0.1688 k 4 (hy + 2k, + 2k, + hy) 6 = Fi0.1801 + 2(0.1795) + 2(0.1793) + 0.1688) = 0.1792 Hence (0.4) =¥,+k= 1.196 + 0.1792 = 1.3752. YAM Example 10.17. Apply Runge-Kutta method to find approximate value of y for x =02, in steps of 0.1, if dyldx = x + y2, given\that y = 1 where x <6. (V.T.U,, B.E., 2009) Sol. Given fix, y) = x +52. Here we take h = 0.1 and carry out the calculations in two steps, Step Lx) =0,¥)=1,h =0.1 : hy = hflxy ¥9) = 0.10, 1) = 0.1000 1 1 hy =f x0 +5 hy +h) = 0.10.05, 1.1) = 0.1152 b= it (sorta oa 8 290+ 5h) = 0.1 £0.05, 1.1159) = 0.1168 = hflxy +h, Yo ths) = 0.1 f0.1, 1.1168) = 0.1347 <1 ~ oth + 2h, + 2h, +2) = ar 1000 + 0.2804 + 0.2836 + 0.1347) = 0.1165 giving OD =y¥) +h = 1.1165, Py sii See Ei No al SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS WUMERICAL EQUATIONS Step Hl. x =% + A= 0.1, y= 1.1165, h =0.1 hy = fly y,) = 0.1 AO.1, 1.1165) . = 0.1347 ye cineca : 2= Ml + 5% y+ Sh | = 0.1 0.15, 1.1838) = 0.155) = 1 1 ye it(se} yyy giz) = 0.1 90.16, 1.199 = 0.1576 hy Berek Jo + hy) = 0.1 0.2, 1.1576) = 0.1823 he a + Qk, +2, ath) = 0.1571 Hae ROA Gfe ke! w Example 10:18. Using Runge-Kutta method of fourth order, solve for y at x = 1.2, 1.4 frm 2 2xy + €* given x)= 1, yp = 0. rane Sol. We have fx, y) = 2 +e ; x te To find (1.2): Here y= 1,¥9 =0,h = 0.2 0+ 1 Gy Yo) = 0.2 FE = 0.1462. hr) _ gg [2+ 0.000 + 007894 2 hy a cee = =) eat a+op? Fs oners = 0.1402 h ia): 21 +.0. (0 +.0.07)+e4 sh 2 got | = 0.2)" ee hs i (a5 May (+00? ++0De™ . = 0.1399 «9 [2102)(0.1398) +e ~ . = 02) —— 7 a ° hg = hf Gag by Jo + hs) = 0 ? (12)? +(12)e" “| 1348 and (hy + ky + 2ky + k,) = 3 10.1462 + 0.2804 + 0.2798 + 0.1348] 6 6 E 0.1402. Hence (1.2) = 99 + b= 0 + 0.1402 = 0.1402, To find y (1.4) : - Here 1402, h = 0.2. ky See 0.2f (1.2, 0) = 0.1348 hf (x, + h/2, y, + ky/2) = 0.2 f (1.8, 0.2076) = 0.1303 (x, + Ai, yy hy2) = 0.2 F (2.8, 0.2053) = 0.1301 anes eee 0.2703) = 0.1260 = _ (hy + 2hy + 2hg + hy) = iW lio 1348 + 0.2606 + 0.2602 + 0.1260) 1.1303 1 +k = 0.1402 + 0.1303 = 0.2705 NUMERICAL METHODS IN ENGINEERING AND SCIENCE | Ea b ———— pap hamagABom es J Pry ta ne) 1. Use Runge’s method to approximate,y when x = ven that y = Use Runge’ proximate,y when x = 1.1, given that y dyldx = 8x + y*. .2.when x = 1 and sf Runge-Kutta method of order 4, find y(0.2) given that dy/dx = 3x + SY, y(0) = 1, 2 ies (TU, B.Tech, 2004) taking A = 0.1. dy ee ae 3. Using Runge-Kutta method of order 4, compute (0.2) and y(0.4) from 10 7” = x2 4 y2 (0) = 1, taking A = 0.1 (Rohtak, B.Tech., 2003) ) = 1, taking h = 0.1. ; : . a 4. Using fourth order Runge Kutta method, find the approximate pelea at fe re, es 14 of the initial value problem y’ = xy, y(1) = 2. (Bombay, B. Tech., 2004) 5. Given dyldx = x* + y,y(0) = 2. Compute y(0.2), 9(0.4) and y(0.6) by Runge-Kutta method of fourth order. (Anna, B.E., 2004) ind y(0.. (0.2) using Runge-Kutta 4th order formula, given that y’ = x2 — y and fe Cas ee WLN.T.U., B. Tech., 2006) a 2 1 % Using 4th order Runge-Kutta method, solve the following equation, taking cach step of h=0.1, given y(0) = 3. dy/ds (4xly — xy). Calculate y for x = 0.1 and 0.2. (Anna, B.E., 2007) proximate value of y for x = 0.8, given that y = 0.41 (S.V.T.U., B. Tech., 2007 S) 8. Find by Runge-Kutta method an ap; when x = 0.4 and dyldx = V(x + y), ors Using Runge-Kutta method of order 4, find (0.2) for the equation en Oe Take h = 0.2. 10. Using 4th order Runge-Kutta method, integrate y’ = size of 0.5 and initial condition of y = 1 at x = 0. (V.T.U., B.E., 2003) ~ 2x5 + 12x? 20n + 8.5, using a step Ne Using fourth order Runge-Kutta method, find y at x = * yO) =0 and h = 0.1, 0.1 given that dy/dx = 3e* + 2y, (V.T.U., B. Tech., 2006) 10.8. PREDICTOR-CORRECTOR METHODS Jf. and s; be two. consecutive mesh pointa method (§ 10.4), we have PES Bere A 1 + h. In the Euler's 3: = I.a + hifley +B i= Th, y, The modified Euler’s method (§ 10.5), gives A) Hersh WSL tS The value of , is frst estimated by sj side of (2), giving a better approximation of. ety find a still beter approximation ofy, The step is fn tm ta ee a fr mee va predictor while (2) serves as a corrector of ys ro™ THe euation (1) is therefore called th? [essa 20+ Fe x0] In the methods so far described to solve a differential equation over an interval, only value ofy at the beginning of the interval was required. In the predictor-corrector meth- jor methods have the advantage of giving an estimate of error from successive approxima- tions tO ‘ We now describe two such methods, namely : Milne’s method and Adams-Bashforth method. 409, MILNE’S METHOD { Given dyldx = flx, y) and y = yp x = xp ; to find an approximate value of y forx=x,)+nh ty Milne’s method, we proceed as follows : 5 ‘The value yy = 9(x,) being given, we compute . 9 = IOKg +h), Yo = YOy + Zh), ¥g = Hey + Sh), by Picard’s or Taylor's series method. Next we calculate, fy = Reqs ols fy = Aig + Bs ys fy = fq + 2h Yo) fy = fxg + 3h, 5) ‘Then to find y, = yt + 4h), we substitute Newton's forward interpolation formula je four Bei values are needed for finding the value of y at x,. Though slightly complex, th fla, 9) = fo + nbfy + =~ Ds. ae ue EB Sy in the relation th nants, ferde. te, aot nernt [o (forme MO ahs (n-1) aret hf (fo na SO Sh + J} Neglecting fourth and higher order differences and expressing Af, S"f, and 4°, in terms of the function values,we get tis ° 20 8 ayo +8Mfy + geht shh ey Pare Ohhh) which is called a predictor. Having found y,, we obtain a first approximation to f= fxg + 4h, y,)- Then a better value of y, is found by Simpson's rule (p. 211) as oP eat Beart Which is called a corrector. computed and again the corrector is applied to fing is step untik y, remains unchanged. Once y, and f, are obtained to desired degree of accuracy, 9, = 1% + 5h) is found from the predictor as Then an improved value of stilt better value of y,. We repeat 4h Part FO +200. and f, = fx, + 5h, »5) is calculated. Then a better approximation to the value of y, is obtaineg froni the corrector as h IP =I94 3 Gt Het hy- a = * We repeat this step till y, becomes stationary and we, then proceed to calculate Yeas _ before. : This is Milne's predietor-cortector method. To insure greater accuracy, we must first improve the accuracy of the starting values and then sub-divide the intervals. Example 10.19. Apply Milne’s method, to find a solution of the differential equation ~y? in the range 0 +RC—+v= C ae +RC 7 +v=0, subject to the conditions t = 0, v = Up, duidt = Taking A = 0.02 sec, use Runge-Kutta method to calculate v and du/dt when t = 0.02, for the data vy = 10 volts, C = 0.1 farad, L = 0.5 henry and R = 10 ohms. 10.13. ERROR ANALYSIS saon.TtS Btmeriea! solutions of differential equations certainly differ from their exact lutions. The difference betwen the computed value , and the true value y(x) at any stage i nas error. The total e : Hest os het otal error at any stage is comprised of truncation error and ‘The most important aspect of numeri fe most eal m the solutions with the least errors. It is us quite closely. We can make only rough estim: at times, has to be somewhat intuitive. In any method, the truncati Is ation errot ii The round-off error cannot be controlled easth and pi takin ernlle a i precision arithmetic facility. Infact, this error hag ye seg, commuter used has the doutle redsinwar ‘4s proved to be more elusive than the rua Z ethods is to minimize the errors and obtain va ly not possible to follow error development ates. That is why, our treatment of error analysis he truncation error in Euler’s method is 2 hy,” i.e. of O(h2) while that of modi T's metl i. i ‘Yn’ ie. of O(h?) whi ie ms Euler's method is 5h°y,” ie. of 0118), Similarly in the fourth order Runge-Kutta method, the truncation error is of O10") y serial SOLUTION OF ORDINARY DIFFERENTIAL courosSS~S*~*i ee j See ee BOAUIONG esac teed inthe Milne’s method, the truncation error 1 pow predictor formula = 3 y,ch? a and due €0 corrector formula = ——~y,"h', ig. the truncation error in Milne’s method is also of O(h"). similarly the error in Adams-Bashforth method is of the fifth order. Also the predictor error Tp and the corrector error T, are so related that 197, = - 251 T, ‘The relative error of an approximate solution is the ratio of the total error to the exact value. It is of greater importance than the error itself for if the true value becomes larger, then a larger error may be acceptable. If the true value diminishes, then the error must also fiminish otherwise the computed results may be absurd. Example 10.32. Applying Euler’s method to the differential equation dyldx = fix, y), (x) = Yy estimate the total error ? When fix, y) =—y, (0) = 1, compute this error neglecting the round-off error. Sol. We know that the Euler’s solution of the given differential equation is Ynaa =n + ARG,» J) Where x, = Xq + Nh. ie Ynur Int Pn cy Denoting the exact solution of the given equation at x = x, by y(x,) and expanding s(t,,,) by Taylor's series, we obtain Wg yldegyy) = Hey) + hy’) + Bye” Ewan SE, S%n41 (2) ie 1 The trubeation error T= ver) Hae gee ee? Thus the truncation error is of O(h?) as h > 0. To include the effect of round-off error R,,, we introduce a new approximation y,, which is defined by the same procedure allowing for the round-off error. Tne = Int Af nr In)— Rav (8) «. The total error is defined by Ey = IE na) — Inv (2-@) =ylex,) + hy@,) + ue "End —Wn + Ff nr In) — Rn od = Lyx, — Jnl + AA) =f I+ Thor t Baer 4) Armuming continuity of fay and oxing Mesn-Velus thegrem, we have Fle,, X,)1 — Aetyy Yn) = WE) — ql f,%n Sn)s Where , lies between y(x,) and y,,- (4) takes the form Eyer = lylt,) — nl Wt AEG» Sul + Tar + Root : By y= By 14 Me Ball + Pes * Ba 6) Ks NUMERICAL METHODS IN ENGINEERING AND Science] This is the recurrence formula for finding the total en eae pen ie right hand side is the inherited error i.e. the propaga’ the error evious step y, to tion of Ynst (b) We have dy/dx =~ y, (0) = 1 : ain ‘Taking h = 0.01 and applying (1) successively, we obt (0.01) = 1+ 0.01(- 1) = 0.99 '(0,02) = 0.99 + 0.01 (- 0.99) = 0.9801 -y(0.03) = 0.9703, y(0.04) = 0.9606 The truncation error 2y"(E) = 0.00005yE) <5 x 10> y(x,) Le dyldx is ~ ve} T, $5 x 10% y(0) = 5 x 10% T, <5 x 10% y(0.01) = 5 x 1 T, <5 x 10° (0.02) = 5 x 10° (0.9801) < 5 x 10° T, <5 x10 (0.03) = 5 x 10-5 (0.9703) < 5 x 10° ete. ie. 5 (0.99) < 5 x 10° Also 1 + hfy(x,,y,) = 1+ 0.01(- 1) = 0.99. Neglecting the round-off error and using the above results, (5) gives E, = 0, E, = Ey(0.99) + T, <5 x 10° = 0.00005 E, = E\(0.99) + T, < 5 x 10° +5 x 10 = 0.0001 E, = E,{0.99) + T, < 104 + 5 x 10% = 0.00015 E, = E¥0.99) + T, < 1.5 x 10+ + 5 x 10 = 0.0002 ete. Obs. The exact solution is y = e*. Actual error in (0.03) = e-°" — 0,9703 = 0.00014 and actual error in y(0.04) =e — 0.9606 = 0.00019, Clearly the total error E,, agrees with the actual error in (0.04). 10.14, CONVERGENCE OF A METHOD Any numerical method for solving a differential equation is said to be convergent if the eueenes solution Yq, approaches the exact solution y(%,) as h tends to zero provided the rounding rite rising from the initial conditions approach zero. This means that as a method is continually refined by taking smaller and small si solutions must converge tothe exact solution, Pe the Sequence of approxima Scene agate is convergent provided fix, y) possesses enough continuous de comector methods are oon en thous are also convergent under similar conditions. Predicto™ vergent if fix, y) satisfies Lipschitz condition i.e, | fe Ax, 7) | skly-5], to the exact solution. ” a ai 1. Hence |1 + 4|< 1 defines a stable zone. When 2. is real, then the method is stable if |1+Ah| <1 ie. ~2

You might also like