Numerical Analysis by Dr. Anita Pal Assistant Professor Department of Matematics National Institute of Tecnology Durgapur Durgapur-7109 email: anita.buie@gmail.com 1
. Capter 8 Numerical Solution of Ordinary Differential Equations Module No. Predictor-Corrector Metods
...................................................................................... A metod is called single step, if only one value of te dependent variable, say y i, is required to compute te next value, i.e. y i+1. Taylor s series, Picard, Euler s, Runge- Kutta are te examples of te single-step metod. On te oter and, a metod is called multistep if it needs more tan one values of te dependent variable to compute te next value. In k-step metod, te values of y i k 1, y i k,..., y i 1 and y i are needed to compute y i+1. To solve an ordinary differential equation, a special type of metod is used known as predictor-corrector metod. Tis metod as two formulae. Te first formula determines an approximate value of y and it is known as predictor formula. Te second formula, known as corrector formula, improves te value of y obtained by predictor formula. Te commonly used predictor-corrector metods are Adams-Basfort-Moulton, Milne-Simpson, etc. Tese two metods are discussed in tis module..1 Adams-Basfort-Moulton metods Let us consider a differential equation dy dx = f(x, y) wit initial conditions x = x 0, y(x 0 ) = y 0. (.1) Tis problem is to be solved by Adams-Basfort-Moulton metod. It is a fourtstep predictor-corrector metod. So, to compute te value of y i+1, four values y i, y i, y i 1 and y i are required. Tese values are called starting values. To find tese values, generally, any single step metod suc as Euler, Runge-Kutta, etc., are used. Now, we integrate te differential equation (.1) between x i and x i+1 and obtain te following equation xi+1 y i+1 = y i + f(x, y) dx. (.) x i Te second term of te above equation can not be determined as y is an unknown dependent variable. To find tis integration, te function f(x, y) is approximated by Newton s backward interpolation formula, i.e. by te following expression f = f i + v f i + v(v + 1) f i +! v(v + 1)(v + ) f i! 1
................................................. Predictor-Corrector Metods were v = x x i and f i = f(x i, y i ). After simplification, it becomes Terefore, y i+1 = y i + f = f i + v f i + v + v 1 0 f i + v f i + v + v = y i + f i + 1 f i + 5 1 f i + 8 f i f i + v + v + v f i. f i + v + v ] + v f i dv = y i + 4 ( 9f i + 7f i 59f i 1 + 55f i ). (.) Tis formula is known as Adams-Basfort predictor formula and it is denoted by y p i+1. Tus, y p i+1 = y i + 4 9f(x i, y i ) + 7f(x i, y i ) 59f(x i 1, y i 1 ) + 55f(x i, y i )].(.4) Te same tecnique is used to find corrector formula. To find te corrector formula, te function f(x, y) is approximated by te following Newton s backward interpolation polynomial. f(x, y)=f i+1 +v f i+1 + v(v+1)! f i+1 + v(v+1)(v+)! f i+1, were v = x x i+1. Using tis approximation, te equation (.) becomes 0 y i+1 = y i + f i+1 + v f i+1 + v + v f i+1 + v + v ] + v f i+1 dv 1 since, x = x n + v, dx = dv] = y i + f i+1 1 f i+1 11 f i+1 14 ] f i+1 = y i + 4 f i 5f i 1 + 19f i + 9f i+1 ]. (.5) Tis is known as Adams-Moulton corrector formula. Te corrector value is denoted by y c i+1. Tus yi+1 c = y i + 4 f(x i, y i ) 5f(x i 1, y i 1 ) + 19f(x i, y i ) + 9f(x i+1, y p i+1 )]. (.)
...................................................................................... Te predicted value y p i+1 is computed from te equation (.4). Te formula (.) can be used repeatedly to get te value of y i+1 to te desired accuracy. Note tat te predictor formula is an explicit formula, wereas corrector formula is an implicit formula. Note.1 Te modified Euler s metod is a single step predictor-corrector metod. Example.1 Find te value of y(0.0) and y(0.5) from te differential equation y = xy + y sin x 1 wit y(0) = 1 taking step size = 0.05 using Adams-Basfort- Moulton predictor-corrector metod. Solution. Te Runge-Kutta metod is used to find te starting values at x = 0.05, 0.10, 0.15. Here f(x, y) = y y, = 0.05. Te values are sown below: i x i y i k 1 k k k 4 y i+1 0 0.00 1.000000-0.050000-0.0475-0.04750-0.0459 0.95419 1 0.05 0.95419-0.0459-0.0400-0.0401-0.040914 0.90977 0.10 0.90977-0.040914-0.0890-0.08890-0.097 0.8704 Tus te starting values are y 0 = y(0) = 1, y 1 = y(0.05) = 0.95419, y = y(0.10) = 0.90977, y = y(0.15) = 0.8704. Now, y p (0.0) = y p 4 = y + 4 9f(x 0, y 0 ) + 7f(x 1, y 1 ) 59f(x, y ) + 55f(x, y )] = 0.8704 + 0.05 4 9 1 + 7 ( 0.904778) 59 ( 0.8187) +55 ( 0.7949)] = 0.85. y c (0.0) = y c 4 = y + 4 f(x 1, y 1 ) 5f(x, y ) + 19f(x, y ) + 9f(x 4, y p 4 )] = 0.8704 + 0.05 4 ( 0.904778) 5 ( 0.8187) + 19 ( 0.7949)] +9 ( 0.978)] = 0.85. Tus, y 4 = y(0.0) = 0.85. Note tat te predicted and corrected values are equal up to five decimal places.
................................................. Predictor-Corrector Metods y p (0.5) = y p 5 = y 4 + 4 9f(x 1, y 1 ) + 7f(x, y ) 59f(x, y )+55f(x 4, y 4 )] = 0.85 + 0.05 4 9 ( 0.904778) + 7 ( 0.8187) 59 ( 0.7949) +55 ( 0.978)] = 0.80541. y c (0.5) = y c 5 = y 4 + 4 f(x, y ) 5f(x, y )+19f(x 4, y 4 )+9f(x 5, y p 5 )] = 0.85 + 0.05 4 ( 0.8187) 5 ( 0.7949)+19 ( 0.978) +9 ( 0.5991)] = 0.809. y c (0.5) = y c 5 = y 4 + 4 f(x, y ) 5f(x, y )+19f(x 4, y 4 )+9f(x 5, y c 5 )] = 0.85 + 0.05 4 ( 0.8187) 5 ( 0.7949)+19 ( 0.978) +9 ( 0.0041)] = 0.807. Hence, y(0.5) = 0.807 correct upto four decimal places. Error in Adams-Basfort-Moulton metod Te local truncation error for predictor formula is 1 and for te corrector formula it is is 0 1 0 v(v + 1)(v + )(v + ) 4 f i dv 51 4! 70 yv (ξ 1 ) 5 v(v + 1)(v + )(v + ) 4 f i+1 dv 19 4! 70 yv (ξ ) 5. Wen is small ten te local truncation error for Adams-Basfort-Moulton metod 19 70 (yc i+1 y p i+1 ). (.7) Anoter useful predictor-corrector metod is due to Milne-Simpson, describe below.. Milne-Simpson metod Tis metod is also known as Milne s metod. Te Minle s metod is used to solve te following problem: 4 dy dx = f(x, y) wit initial condition y(x 0) = y 0. (.8)
...................................................................................... Now, we integrate te above differential equation between x i and x i+1 and find y i+1 = y i + xi+1 x i f(x, y) dx. (.9) To find te value of te above integral, te function f(x, y) is approximated by Newton s forward difference interpolation polynomial as f(x, y) = f i + u f i + u(u 1) f i +! u(u 1)(u ) f i, (.10)! were u = x x i. Using tis approximation, te equation (.9) reduces to 4 y i+1 = y i + f i + u f i + u u f i + u u ] + u f i du 0 = y i + 4f i + 8 f i + 0 f i + 8 ] f i = y i + 4 f i f i 1 + f i ]. Tus te predictor formula due to Milne is y p i+1 = y i + 4 f(x i, y i ) f(x i 1, y i 1 ) + f(x i, y i )]. (.11) Te corrector formula is derived in te same way. Again, we integrate te given differential equation between x i 1 and x i+1 and te function f(x, y) is approximated by te Newton s forward interpolation polynomial Ten, f(x, y) = f i 1 + u f i 1 + xi+1 y i+1 = y i 1 + x i 1 f i 1 + u f i 1 + = y i 1 + f i 1 + u f i 1 + u u 0 = y i 1 + f i 1 + f i 1 + 1 ] f i 1 u(u 1) f i 1. (.1) ] u(u 1) f i 1 dx ] f i 1 du = y i 1 + f(x i 1, y i 1 ) + 4f(x i, y i ) + f(x i+1, y i+1 )]. 5
................................................. Predictor-Corrector Metods Tis formula is known as corrector formula and it is denoted by y c i+1. Terefore, yi+1 c = y i 1 + f(x i 1, y i 1 ) + 4f(x i, y i ) + f(x i+1, y p i+1 )]. (.1) Te predicted value y p i+1 is computed from te equation (.11) and tis value is corrected by te formula (.1). If te value of y p i+1 yc i+1 is not sufficiently small, ten use te corrector formula again to update te value of yi+1 c. In tis case, yp i+1 is to be replaced by yi+1 c in te corrector formula. Example. Find te value of y(0.0) for te initial value problem dy = xy + y wit y(0) = 1 dx using Milne s predictor-corrector metod, taking = 0.05. Solution. Let f(x, y) = xy + y, x 0 = 0, y 0 = 1, = 0.05. y. Fourt-order Runge-Kutta metod is used to compute te starting values y 1, y and i x i y i k 1 k k k 4 y i+1 0 0.00 1.000000 0.100000 0.101 0.10 0.1140 1.1055 1 0.05 1.1055 0.114 0.1089 0.110 0.18900 1.755 0.10 1.755 0.18890 0.177 0.17717 0.1474 1.510 Terefore, y 1 = y(0.05) = 1.1055, y = y(0.10) = 1.755, y = y(0.15) = 1.510. Te predictor value y p 4 = y 0 + 4 f(x 1, y 1 ) f(x, y ) + f(x, y )] = 1 + 4 0.05 f(0.05, 1.1055) f(0.10, 1.755) + f(0.15, 1.510)] = 1 + 4 0.05.844.57780 +.9500] = 1.5194.
...................................................................................... Te corrector value is y4 c = y + f(x, y ) + 4f(x, y ) + f(x 4, y p 4 )] = 1.755 + 0.05.57780 + 4.9500 +.487] = 1.519. Again, te corrector value y c 4 is calculated by using te formula y4 c = y + f(x, y ) + 4f(x, y ) + f(x 4, y4)] c = 1.755 + 0.05.57780 + 4.9500 +.481] = 1.519. Since tese two values are same, te required solution is y 4 = y(0.0) = 1.519 correct up to five decimal places. Error in Milne-Simpson metod Te local truncation error for predictor and corrector formulae are respectively. 8 90 yv (c i+1 ) 5 = O( 5 ) and 1 90 yv (d i+1 ) 5 = O( 5 ) Note. Te predictor-corrector metods are widely used to solve te differential equation of te form (.8). Tese metods give more accurate result tan te metods discussed earlier. In tese metods, te value of y can be corrected by using corrector formula repeatedly. But, tese metods need starting values y 1, y, y to obtain y 4. Tese values may be obtained from any single-step metod, suc as Taylor s series, Euler s, Runge-Kutta or any similar metod. So, tese metods need lot of function calculations. 7