Numerical Analysis MTH60 PREDICTOR CORRECTOR METHOD Te metods presented so far are called single-step metods, were we ave seen tat te computation of y at t n+ tat is y n+ requires te knowledge of y n only. In predictor-corrector metods wic we will discuss now, is also known as multi-step metods. To compute te value of y at t n+, we must know te solution y at t n, t n-, t n-2, etc. Tus, a predictor formula is used to predict te value of y at t n+ and ten a corrector formula is used to improve te value of y n+. Let us consider an IVP dy f (, t y), y( tn) yn dt = = Using simple Euler s and modified Euler s metod, we can write down a simple predictor-corrector pair (P C) as (0) P: yn+ = yn + f( tn, y ) n ( (0) C: yn+ = yn + f( tn, yn) + f( tn+, yn+ 2 Here, y n+ ( is te first corrected value of yn+. Te corrector formula may be used iteratively as defined below: ( r) ( r yn+ = yn + f( tn, yn) + f( tn+, yn+ ), r =,2, 2 Te iteration is terminated wen two successive iterates agree to te desired accuracy In tis pair, to extrapolate te value of y, we ave approximated te solution curve in n+ te interval (t n, t n+ ) by a straigt line passing troug (t n, y n ) and (t n+, y n+ ). Te accuracy of te predictor formula can be improved by considering a quadratic curve troug te equally spaced points (t n-, y n- ), (t n, y n ), (t n+, y n+ ) Suppose we fit a quadratic curve of te form y = a+ b( t tn + c( t tn)( t tn were a, b, c are constants to be determined As te curve passes troug (t, y ) and (t, y ) and satisfies n- n- n n dy = f ( tn, yn) dt ( tn, yn) We obtain yn = a, yn = a+ b= yn + b Terefore yn yn b = and Copyrigt Virtual University of Pakistan
Numerical Analysis MTH60 dy = f( tn, yn) = { b+ c[( t tn ) + ( t tn)]} ( t n, y n ) dt ( tn, yn) Wic give f ( tn, yn) = b+ c( tn tn = b+ c f( tn, yn) ( yn yn or c = 2 Substituting tese values of a, b and c into te quadratic equation, we get yn+ = yn + 2( yn yn + 2[ f( tn, yn) ( yn yn ] Tat is yn+ = yn + 2 f( tn, yn) Tus, instead of considering te P-C pair, we may consider te P-C pair given by P: yn+ = yn + 2 f( tn, yn) C: yn+ = yn + [ f( tn, yn) + f( tn+, yn+ ] 2 Te essential difference between tem is, te one given above is more accurate However, tis one can not be used to predict y for a given IVP, because its use n+ require te knowledge of past two points. In suc a situation, a R-K metod is generally used to start te predictor metod. Milne s Metod It is also a multi-step metod were we assume tat te solution to te given IVP is known at te past four equally spaced point t 0, t, t 2 and t. To derive Milne s predictor-corrector pair, let us consider a typical IVP dy f (, t y), y( t0) y0 dt = = On integration between te limits t and t, we get 0 t dy t dt = f (, t y ) dt t0 dt t0 t y y f (, t y ) dt 0 = t0 But we know from Newton s forward difference formula ss ( 2 ss ( ( s 2) f(, t y) = f0 + s f0 + f0 + f0 + 2 6 t t0 were s=, t = t0 + s t ss ( 2 ss ( ( s 2) y = y0 + t f0 + s f0 + f0 + f0 0 2 6 ss ( ( s 2)( s ) + f0 + dt 2 Now, by canging te variable of integration (from t to s), te limits of integration also canges (from 0 to ), and tus te above expression becomes Copyrigt Virtual University of Pakistan 2
Numerical Analysis MTH60 ss ( 2 ss ( ( s 2) y = y0 + 0 0 0 0 0 f + s f + f + f 2 6 ss ( ( s 2)( s ) + f0 + ds 2 wic simplifies to 20 2 8 28 y y0 = + f0 + 8 f0 + f0 + f0 + f0 90 Substituting te differences 2 f0 = f f0, f0 = f2 2 f+ f0, It can be furter simplified to 28 y = y0 + (2 f f2 + 2 f) + f0 90 Alternatively, it can also be written as 28 y = y0 + (2y y 2 + 2 y ) + y 0 90 Tis is known as Milne s predictor formula. Similarly, integrating te original over te interval t to t or s = 0 to 2 and repeating te 0 2 above steps, we get y2 = y0 + ( y 0 + y + y 2) y 0 90 wic is known as Milne s corrector formula. In general, Milne s predictor-corrector pair can be written as P: yn+ = yn + (2y n 2 y n + 2 y n) C: yn+ = yn + ( y n + y n + y n+ From tese equations, we observe tat te magnitude of te truncation error in / corrector formula is /90 y 0 wile te truncation error in predictor formula is / 28/ 90 y 0 Tus: TE in, c-formula is less tan te TE in p-formula. In order to apply tis P C metod to solve numerically any initial value problem, we first predict te value of y by means of predictor formula, were derivatives are n+ computed using te given differential equation itself. Using te predicted value y, we calculate te derivative y from te given n+ n+ differential equation and ten we use te corrector formula of te pair to ave te corrected value of y Tis in turn may be used to obtain improved value of y by n+ n+ using corrector again. Tis in turn may be used to obtain improved value of y n+ by using te corrector again. Tis cycle is repeated until we acieve te required accuracy. Example Copyrigt Virtual University of Pakistan
Numerical Analysis MTH60 dy Find y (2.0) if y ( t ) is te solution of ( t y ) dt = 2 + y (0) = 2, y (0.5) = 2.66, y (.0) =.595 and y(.5) =.968 Use Milne s P-C metod. Solution Taking t = 0.0, t = 0.5, t =.0, t =.5 y, y, y and y, are given, we ave to 0 2 0 2 compute y, te solution of te given differential equation corresponding to t =2.0 Te Milne s P C pair is given as P: yn+ = yn + (2y n 2 y n + 2 y n) C: yn+ = yn + ( y n + y n + y n+ From te given differential equation, y = ( t+ y)/2 We ave t+ y 0.5 + 2.66 y = = =.5680 t2 + y2.0 +.595 y 2 = = = 2.2975 t + y.5 +.968 y = = =.20 Now, using predictor formula, we compute y = y0 + (2 y y 2 + 2 y ) (0.5) = 2 + [ 2(.5680) 2.2975 + 2(.20) ] = 6.870 Using tis predicted value, we sall compute te improved value of y from corrector formula y = y2 + ( y 2 + y + y ) Using te available predicted value y and te initial values, we compute t + y 2 + 6.6870 y = = =.55 t + y.5 +.968 y = = =.20 and y 2 = 2.2975 Tus, te first corrected value of y is given by Copyrigt Virtual University of Pakistan
Numerical Analysis MTH60 ( 0.5 y =.595 + [2.2975 + (.2) +.55] = 6.87667 Suppose, we apply te corrector formula again, ten we ave (2) ( y = y2 + ( 2 ( ) y + y + y 0.5 2 + 6.87667 =.595 + 2.2975 (.2) + + 2 = 6.8767 Finally, y (2.0) = y = 6.87. Example dy Tabulate te solution of = t+ y, y(0) = in te interval [0, 0.] wit = 0., dt using Milne s P-C metod. Solution Milne s P-C metod demand te solution at first four points t, t, t and t. As it is not a 0 2 self starting metod, we sall use R-K metod of fourt order to get te required solution and ten switc over to Milne s P C metod. Tus, taking t 0 = 0, t = 0., t 2 = 0.2, t = 0. we get te corresponding y values using R K metod of t order; tat is y =, y =.0, y =.228 and y =.997 0 2 (Reference Lecture 8) Now we compute y = t+ y = 0.+.0 =.20 y 2 = t2 + y2 = 0.2 +.228 =.28 y = t+ y = 0.+.997 =.6997 Using Milne s predictor formula P: y = y0 + (2y y 2 + 2 y ) (0.5) = + [ 2(.20).28 + 2(.6997 ] =.586 Before using corrector formula, we compute y ( ) = t + y predicted value = 0. +.586 =.986 Finally, using Milne s corrector formula, we compute Copyrigt Virtual University of Pakistan 5
Numerical Analysis MTH60 C: y = y2 + ( y + y + y 2) 0. =.228 + (.986 + 6.7988 +.28) =.586 Te required solution is: t 0 0. 0.2 0. 0. y.0.228.997.586 Example Using Milne s Predictor-Corrector Formula find f(0.) from Ordinary Differential Equation / y = x y ; y(0) = ; = 0. wit te elp of following table. X 0 0. 0.2 0. Y 0.9097 0.875 0.786 Solution: Here, x = 0, x = 0., x = 0.2, x = 0., x = 0. 0 2 y ' = x y = 0. 0.9097 = 0.8097 y ' = x y = 0.2 0.875 = 0.675 2 y ' = x y = 0. 0.786 = 0.86 Now, using Predictor Formula y = y0 + 2 y' y2' + 2 y' *0. y = + (-.95 y = 0.7065 ( ) Copyrigt Virtual University of Pakistan 6
Numerical Analysis MTH60 Using te predicted value, we sall now compute te corrected value as; y = y + y + y + y ( ' ' ') Now, y ' = x y = 0. 0.7065= -0.065 Putting te values,int o te Corrector Formula; y = y2 + ( y2' + y' + y' ) 0. y = 0.875+ 0.675+ * 0.86 0.065 y = 0.875-0.09688 ( ( )- ) y = 0.7068556 Ans. Copyrigt Virtual University of Pakistan 7
Numerical Analysis MTH60 Copyrigt Virtual University of Pakistan 8