COSC 336 Numerical Analysis I Ordinary Differential Equations (II) - Multistep methods Fall 2005
Repetition from the last lecture (I) Initial value problems: dy = f ( t, y) dt y ( a) = y 0 a t b Goal: find a function y(t) whose derivatives fulfill the given differential equations If y(t) can not be calculated analytically, try to determine at discrete points y k Higher order ODE s can be transformed into a system of ODEs of degree one. 2
Repetition from the last lecture (II) Taylor series method: 2 3 h h y ( t + h) = y( t) + hy ( t) + y ( t) + y ( t) + 2! 3! Determine the derivatives of y by repeatedly differentiating the differential equation ( t)... Order of the method: last power of h in the Taylor series used Order of the error: first power of h in the Taylor series which is not used Disadvantage: lot of preparatory work required 4 h 4! y (4) 3
Repetition from the last lecture (III) Runge-Kutta methods Averaging tangents/slopes for determining y k+ starting from y k e.g 4 th order explicit Runge-Kutta s = hf ( t, yk ) s = 3 hf ( t + h, y ) 2 + k s2 2 y + = yk + ( s + 2s2 + 2s3 6 k + s4 s = 2 hf t + h, yk s 2 + 2 s = hf t + h, yk + ) ( There is more than one Runge-Kutta method of degree n ) 4 ( s3 ) 4
Implicit vs. Explicit Runge-Kutta methods Explicit method: calculating y k + can be expressed as y = Φ( t, y k + k ) Implicit method: calculating y k + involves y k + as well y k + = Φ k + ( t, yk, y ) Usually, an iterative scheme required for solving implicit equation 5
Multi-step methods Taylor series methods and Runge-Kutta methods both take only values y k into account for calculating y k+ not e.g. y k- Both methods are because of that called single-step methods Multi-step methods use data from several previous nodes y k y k- y k-2 to calculate y k+ 6
Multi-step methods (II) Approach: integrate the differential equation t n + n and thus t f y( t ) ( y, t) dt = y( tn+ ) y( t n n+ = y( t n ) + t n + t n The integral can be calculated using any quadrature formula ) f ( y, t) dt equal to replacing f(y,t) by a polynomial p(y,t) which approximates f in certain points 7
Adams-Bashforth formula (I) Uses k points backwards (y(t), y(t-),,y(t-k-)) to construct the polynomial Explicit scheme e.g for Adams-Bashforth of order 5 the resulting formula is of the type y y + af + bf + cf + df ef n+ = n n n n 2 n 3 + n 4 For determining the coefficients, take as a starting point the quadrature formula 0 f ( y, t) dt h[ afn + bfn + cfn 2 + dfn 3 + efn 4] 8
Adams-Bashforth formula (II) Use the method of undetermined coefficients and the trial functions f ( t) =, t, t( t + ), t( t + )( t + 2), t( t + )( t + 2)( t + 3) to obtain the coefficients Leading to: h yn+ = yn + [90 fn 2774 fn + 266 fn 2 274 fn 3 + 25fn 720 4 ] 9
Adams-Bashforth formulas (III) General form for Adams-Bashforth formulas of degree p: y n+ = yn + hc p p i= 0 b i f k i Order c p b 0 b b 2 b 3 b 4 2 ½ 3-3 /2 23-6 5 4 /24 55-59 37-9 5 /720 90-2774 2626-274 25 0
Adams-Bashforth formulas (IV) Problem at startup: k value of y required for Adams-Bashforth of degree k just one initial value available Use a single-step method of the same degree to construct intial points Example: for 5 th order Adams-Bashforth five values of y required Execute 5 iterations with a 5 th order Runge-Kutta method Switch then to the Adams-Bashforth formula
Adams-Bashforth formulas (V) Advantage over Runge-Kutta of the same degree: Adams-Bashforth can be implemented such, that after initialization only one function evaluation is required for each step The intermediate values calculated at a Runge-Kutta step can not be reused in the next step, since only a single point backwards is used for calculations 2
Adams-Moulton Formulas Identical approach as Adams-Bashforth, y(t n+ ) however also used to construct the interpolating polynomial Implicit formula General form of the Adams-Moulton formulas of degree p Order y n+ = yn + c p b 0 hc p p bi i= 0 b f k + i b 2 b 3 b 4 2 ½ 3 /2 5 8-4 /24 9 9-5 5 /720 3 25 646-264 06-9
Predictor-Corrector Methods (I) Adams-Moulton is often used in combination with Adams-Bashforth method as so-called predictor/corrector method Calculate an estimate of y(t n+ ) using Adams Bashforth Use this value as tentative input value for y(t n+ ) on the left side of the Adams-Moulton implicit formula Transforming the implicit formula into an explicit one Adams-Moulton delivers a corrected value for y(t n+ ) 4
Predictor-Corrector-Methods (II) General algorithm for a fifth order Predictor/Corrector Method Input f,a,b,h,y0 N=(b-a)/h; y() = y0 For i=:5 y(i+)= Fifth_order_Runge_Kutta(y(i), h,t) t = t + h; end for i=5:n y*(i) = Fifth_order_Adams_Bashforth(y(i-),y(i-2),y(i-3), y(i-4), y(i-5), t); y(i) = Fifth_order_Adams_Moulton (y*(i), y(i-), y(i-2), y(i-3), y(i-4), t); t = t + h; end 5
Predictor-Corrector Methods (III) Requires two function evaluations for each step f(y*(i),t) which is used as input to the Adams-Moulton method f(y(i),t): the corrected value required for the next step. 6