 # Dr. Jie Zou PHY 33201 Chapter 9 Ordinary Differential Equations: Initial-Value Problems Lecture (II) 1 1 Besides the main textbook, also see Ref.: “Applied.

## Presentation on theme: "Dr. Jie Zou PHY 33201 Chapter 9 Ordinary Differential Equations: Initial-Value Problems Lecture (II) 1 1 Besides the main textbook, also see Ref.: “Applied."— Presentation transcript:

Dr. Jie Zou PHY 33201 Chapter 9 Ordinary Differential Equations: Initial-Value Problems Lecture (II) 1 1 Besides the main textbook, also see Ref.: “Applied Numerical Methods with MATLAB for Engineers and Scientists”, Steven Chapra, 2nd ed., Ch. 20, McGraw Hill, 2008.

Dr. Jie Zou PHY 33202 Outline Error Analysis for and Stability of Euler’s Method Improvements of Euler’s method (I) Heun’s Method (II) The Midpoint Method (next lecture)

Dr. Jie Zou PHY 33203 Error analysis for Euler’s method Two types of errors involved in the numerical solution of an ODE: (1) Truncation errors: Errors due to the nature of the numerical techniques used to approximate values of y. Two parts: (I) Local truncation error: Error due to an application of the numerical method over a single step. (II) Propagated truncation error: Error due to the approximations produced during the previous steps. Global truncation error (total error): The sum of (I) and (II). (2) Roundoff errors: Errors due to the limitation of the computer to keep an infinite number of significant digits.

4 Analysis of the magnitude and properties of the truncation error Derive Euler’s method from the Taylor series expansion: Taylor series expansion of y(t) about a point t i : h = t i+1 – t i : step size; R n = y (n+1) (  )h n+1 /(n+1)!: the reminder term;  lies somewhere between t i and t i+1. Evaluating y(t) at point t i+1, we have: Using the general form of an ODE, dy/dt = f(t, y), we have: O(h n+1 ) : For the nth-order approximation, the local truncation error  h n+1.

Dr. Jie Zou PHY 33205 True and approximate local truncation error Comparing the following two equations: (1) Taylor series expansion (2) Euler’s method True local truncation error Approximate local truncation error When h is sufficiently small, the higher- order terms are usually negligible.

Dr. Jie Zou PHY 33206 Global truncation error It can be shown that the global truncation error is O(h), i.e.,  step size h. Note: The global error can be reduced by decreasing the step size h. If the solution of the ODE is linear, there is no error involved in Euler’s method – Euler’s method is a first-order method.

Dr. Jie Zou PHY 33207 Stability of Euler’s method “Unstable”: A numerical solution is said to be unstable if errors grow exponentially for a problem for which there is a bounded solution. The stability of a particular numerical method depends on three factors: (1) Differential equation (2) Numerical method (3) Step size An example: Let’s look at a simple ODE dy/dt = -ay, y(0) = y 0 Calculus: y = y 0 e -at Euler’s method: y i+1 = y i + (dy i /dt)h = y i (1 – ah) If h > 2/a, then |1 – ah| > 1 and |y i |   as i   - Euler’s method is conditionally stable.

Dr. Jie Zou PHY 33208 Improvement of Euler’s method: (I) Heun’s method Heun’s method: a predictor-corrector approach (1) Predicator: Use the slope at the beginning of an interval to predict that at the end of the interval. (2) Corrector: Use the averaged slope to obtain an improved estimate of y at the end of the interval. Predictor: y i+1 0 = y i m + f(t i,y i )h Corrector: y i+1 j = y i m + {[(f(t i,y i m ) + f(t i+1, y i+1 j- 1 )]/2}h, for j = 1, 2, … The corrector equation is iterative; j indicates the jth iteration. Stopping criterion: |  a | = |(y i+1 j – y i+1 j-1 )/y i+1 j | x 100% (a) Predictor (b) Corrector

Dr. Jie Zou PHY 33209 Example: Heun’s method Example 20.2 (Ref.): Use Heun’s method with iteration to integrate y’ = 4e 0.8t – 0.5y from t = 0 to 4 with a step size of 1. The initial condition at t = 0 is y = 2. Employ a stopping criterion of 0.00001% to terminate the corrector iterations. (1) By hand. (2) Write an M-file. A copy of the code will be handed out later.

Dr. Jie Zou PHY 332010 Results ty true y Euler |  t | (%) y Heun |  t | (%) y Heun |  t | (%) 02.00000 -----2.00000-----2.00000---- 16.194635.0000019.286.701088.186.360872.68 214.8439211.4021623.1916.319789.9415.302243.09 333.6771725.5132124.2437.19992510.4634.743283.17 475.3389656.8493124.5483.3377710.6277.735103.18 Without Iteration With Iteration Table 20.2 (Ref. by Chapra)

Download ppt "Dr. Jie Zou PHY 33201 Chapter 9 Ordinary Differential Equations: Initial-Value Problems Lecture (II) 1 1 Besides the main textbook, also see Ref.: “Applied."

Similar presentations