ColoState MATH451 Notes on Errors and Stability of ODE Solvers Jiangguo (James) Liu ∗ February 26, 2016 1 (Local and Global) Errors and Convergence For this topic, it seems Iserles [2] is better than Atkinson [1] or Kincaid & Cheney [3]. Recall the ODE IVP and notations. Lipschitz condition on the right-hand side of the ODE: |f (t, x1 ) − f (t, x2 )| ≤ L|x1 − x2 |. (1) Local (truncation) error: Plug the exact/true solution into the numerical scheme, apply Taylor expansion, examine the error expressed as a power of h. Global error: The error between the exact/true solution and the numerical solution en = x(tn ) − yn , n = 0, 1, 2, . . . (2) Note that the numerical solution yn is available only at the discrete time moments. Note: For ease of discussion, we ignore round-off errors in this section, Convergence: See [2]. Suppose an ODE solver runs from n = 0 to n = N , so that t0 +N h ≤ T , where T is (a fixed) final time. An ODE solver is said to be convergent, provided that (for the ODE IVP with f satisfying the Lipschitz condition) there holds lim max |x(tn ) − yn | = 0. (3) h→0 0≤n≤N In other words, the numerical solution approaches the exact solution as the grid becomes increasingly fine [2]. 1.1 Euler Methods Theorem. The explicit Euler method (i) has local truncation error O(h2 ) (order 1); (ii) has global error O(h) (order 1); (iii) is convergent under the condition that f is continuously differentiable. ∗ Department of Mathematics, (liu@math.colostate.edu) Colorado State University, 1 Fort Collins, CO 80523-1874, USA Proof. See details below. For part (i). This is how we examine local (truncation) errors: Plug the exact solution into the numerical scheme and apply Taylor expansion: x(tn+1 ) − (x(tn ) + hf (tn , x(tn ))) = x(tn ) + hx′ (tn ) + O(h2 ) − (x(tn ) + hx′ (tn )) = O(h2 ). This means that if the exact solution is just a polynomial of degree one, then the truncation error will be zero. In other words, the numerical scheme (ODE solver) recovers exactly any solution in the linear polynomial form. For part (ii) and (iii). Denote en = x(tn ) − yn . Apply Taylor expansion to the exact solution at tn , we obtain x(tn+1 ) = x(tn ) + hx′ (tn ) + O(h2 ) = x(tn ) + hf (tn , x(tn )) + O(h2 ). Subtraction (the explicit Euler scheme) from it leads to en+1 = en + h (f (tn , x(tn )) − f (tn , yn )) + O(h2 ). Under the Lipschitz condition, one obtains |en+1 | ≤ (1 + hL)|en | + Ch2 , Applying math induction, one obtains ) C ( |en | ≤ h (1 + Lh)n − 1 , L n = 0, 1, 2, . . . (4) n = 0, 1, 2, . . . (5) Applying an elementary inequality 1 + Lh < eLh , we deduce that (1 + Lh)n < enLh and hence (1 + Lh)n < eL(T −t0 ) . Substitution of this into the above equation, one obtains |en | ≤ C L(T −t0 ) (e − 1)h, L (6) which implies the desired global error and convergence, since C(eLT − 1)/L is a constant independent of h. Remark. The bound in the above proof might be very large, see [2] p.7 for an example. Remark. For the explicit Euler method, the local (truncation) error is O(h2 ), the scheme advances N = O(h−1 ) steps, so it is expected and has been proved (in the above theorem) that its global error is O(h). For more general cases (other methods), this is not guaranteed and careful examination is needed. 1.2 Trapezoid Method (TZ) Note that the trapezoid scheme can be rewritten as 1 yn+1 − yn − h (f (tn , yn ) + f (tn+1 , yn+1 )) = 0. 2 Theorem. The trapezoid scheme (i) has 2nd order local truncation error; 2 (7) (ii) has 2nd order global error; (iii) and hence converges. Proof. See details below. For simplicity, we assume t0 = 0. For part (i). Plugging the exact solution into the trapezoidal scheme, one obtains (via two rounds of Taylor expansion and some cancellation) x(tn+1 ) − x(tn ) − 12 h (f (tn , x(tn )) + f (tn+1 , x(tn+1 ))) ( ) = x(tn ) + hx′ (tn ) + 12 h2 x′′ (tn ) + O(h3 ) − x(tn ) − 21 hx′ (tn ) + 12 hx′ (tn+1 ) ( ( )) = x(tn ) + hx′ (tn ) + 12 h2 x′′ (tn ) + O(h3 ) − x(tn ) + 21 hx′ (tn ) + 12 h x′ (tn ) + hx′′ (tn ) + O(h2 ) = O(h3 ). For part (ii) and (iii). Recall the truncation error expression 1 x(tn+1 ) = x(tn ) + h (f (tn , x(tn )) + f (tn+1 , xn+1 ))) + O(h3 ). 2 Subtraction the TZ scheme from it yields 1 en+1 = en + h (f (tn , x(tn )) − f (tn , yn ) + f (tn+1 , x(tn+1 )) − f (tn+1 , yn+1 )) + O(h3 ). 2 Assuming f is smooth enough and applying the Lipschitz condition, we obtain 1 |en+1 | ≤ |en | + Lh(|en | + |en+1 |) + O(h3 ). 2 This can be simplified as ( ) ( ) 1 1 1 − Lh |en+1 | ≤ 1 + Lh |en | + Ch3 , 2 2 (8) Without loss of generality, we assume Lh < 2 to obtain ( ) ( ) 1 + 12 Lh C |en+1 | ≤ |en | + h3 1 − 12 Lh 1 − 21 Lh By math induction, we have C |en | ≤ h2 L ( ) ( 1 + 1 Lh )n 2 −1 . 1 − 12 Lh (9) Similar to ... we have ( Lh ) 1 + 21 Lh Lh = 1 + < exp 1 − 21 Lh 1 − 12 Lh 1 − 12 Lh and hence ( 1 + 12 Lh 1 − 12 Lh )n < exp ( nLh ) ( LT ) ≤ exp ≤ exp(2LT ), 1 − 12 Lh 1 − 12 Lh where the assumption Lh < 1 is used in the last step. Therefore, we finally have ( ) C 2LT |en | ≤ e h2 , L which implies the global error and convergence of TZ. 3 (10) 2 Stability The stability of an ODE solver (for IVP) means that small perturbations in the initial data (x0 ) and/or the right-hand side function f (·, ·) results in small perturbations in the numerical solution. The smallness is measured in certain norms. Consider IVP { ′ x = f (t, x), (11) x(t0 ) = x0 . and a perturbed IVP { x′ = f (t, x) + δ(x), x(t0 ) = x0 + η, (12) where δ(x) is defined on a certain interval [x0 − α, x0 + α]. The numerical solution of the perturbed problem is denoted as zn (δ, η) or just zn for simplicity. Assume that there exits ε > 0 such that ∥δ(x)∥∞ ≤ ε, |η| ≤ ε. (13) Theorem. For the explicit Euler method, under certain conditions [1], there holds max |yn − zn | ≤ K (∥δ(x)∥∞ + |η|) , 0≤n≤N (14) where K is a positive constant independent of h. This shows that EE is stable with respect to perturbations in the right-hand side and initial data. Proof. See [1] p.349. Let en = zn − yn . Obviously e0 = η. The perturbed numerical solution follows the scheme zn+1 = zn + h (f (tn , zn ) + δ(xn )) , (15) whereas the non-perturbed numerical solution satisfies yn+1 = yn + hf (tn , yn ). (16) Subtraction yields en+1 = en + h (f (tn , zn ) − f (tn , yn )) + hδ(xn ). Applying the Lipschitz condition leads to |en+1 | ≤ |en | + hL|en | + h∥δ(x)∥∞ . (17) Similar to the proof for the global error, one can apply math induction to obtain max |en | ≤ ... 0≤n≤N Finally, one obtains max |zn − yn | ≤ K(∥δ∥∞ + |η|). 0≤n≤N (18) References [1] K.E. Atkinson, An introduction to Numerical Analysis, John Wiley & Sons, 2nd ed., 1989. [2] A. Iserles, A First Course in the Numerical Analysis of Differential Equations, Cambridge University Press, 1996. [3] D. Kincaid and Cheney, Numerical Analysis: Mathematics of Scientific Computing, Brooks/Cole, 3rd ed., 2002. 4