Variable Step Size Differential Equation Solvers

Similar documents
PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Fourth Order RK-Method

Initial-Value Problems for ODEs. Introduction to Linear Multistep Methods

Runge-Kutta methods. With orders of Taylor methods yet without derivatives of f (t, y(t))

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Lecture Notes on Numerical Differential Equations: IVP

Physics 584 Computational Methods

Math 128A Spring 2003 Week 11 Solutions Burden & Faires 5.6: 1b, 3b, 7, 9, 12 Burden & Faires 5.7: 1b, 3b, 5 Burden & Faires 5.

Numerical Methods - Initial Value Problems for ODEs

FORTRAN 77 Lesson 7. Reese Haywood Ayan Paul

Euler s Method, cont d

Consistency and Convergence

Math 128A Spring 2003 Week 12 Solutions

Numerical Differential Equations: IVP

Initial value problems for ordinary differential equations

Ordinary Differential Equations

You may not use your books, notes; calculators are highly recommended.

Simple ODE Solvers - Derivation

Numerical method for approximating the solution of an IVP. Euler Algorithm (the simplest approximation method)

Do not turn over until you are told to do so by the Invigilator.

Section 7.4 Runge-Kutta Methods

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0

Math 216 Final Exam 14 December, 2012

Differential Equations

10 Numerical Solutions of PDEs

Ordinary Differential Equations (ODEs)

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0

Chapter 11 ORDINARY DIFFERENTIAL EQUATIONS

Ordinary differential equations - Initial value problems

+ h4. + h5. 6! f (5) i. (C.3) Since., it yields

Numerical solution of ODEs

INTRODUCTION TO COMPUTER METHODS FOR O.D.E.

Chap. 20: Initial-Value Problems

ODE Runge-Kutta methods

Ordinary Differential Equations

Do not turn over until you are told to do so by the Invigilator.

Numerical methods for solving ODEs

An Analysis of Numerical Methods on Traffic Flow Models

Solving scalar IVP s : Runge-Kutta Methods

Numerical Methods - Boundary Value Problems for ODEs

Ordinary Differential Equations (ODEs)

Differential Equations

Numerical Integration of Ordinary Differential Equations for Initial Value Problems

1 Systems of First Order IVP

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 9

MATH 350: Introduction to Computational Mathematics

Numerical Methods for Initial Value Problems; Harmonic Oscillators

Higher Order Taylor Methods

Math Numerical Analysis Homework #4 Due End of term. y = 2y t 3y2 t 3, 1 t 2, y(1) = 1. n=(b-a)/h+1; % the number of steps we need to take

MTH 452/552 Homework 3

9.6 Predictor-Corrector Methods

Mathematics for chemical engineers. Numerical solution of ordinary differential equations

Applied Math for Engineers

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

NUMERICAL SOLUTION OF ODE IVPs. Overview

Checking the Radioactive Decay Euler Algorithm

Numerical Methods for Initial Value Problems; Harmonic Oscillators

Scientific Computing: An Introductory Survey

Finite Differences for Differential Equations 28 PART II. Finite Difference Methods for Differential Equations

Math 660 Lecture 4: FDM for evolutionary equations: ODE solvers

Initial value problems for ordinary differential equations

Calculus for the Life Sciences

What we ll do: Lecture 21. Ordinary Differential Equations (ODEs) Differential Equations. Ordinary Differential Equations

Maths III - Numerical Methods

Solving Models With Off-The-Shelf Software. Example Of Potential Pitfalls Associated With The Use And Abuse Of Default Parameter Settings

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of

Review Higher Order methods Multistep methods Summary HIGHER ORDER METHODS. P.V. Johnson. School of Mathematics. Semester

Introductory Numerical Analysis

Bindel, Fall 2011 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 18. HW 7 is posted, and will be due in class on 4/25.

CHAPTER 80 NUMERICAL METHODS FOR FIRST-ORDER DIFFERENTIAL EQUATIONS

Euler s Method, Taylor Series Method, Runge Kutta Methods, Multi-Step Methods and Stability.


4.4 Computing π, ln 2 and e

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

Ordinary Differential Equations II: Runge-Kutta and Advanced Methods

Ordinary Differential Equations II

The family of Runge Kutta methods with two intermediate evaluations is defined by

ACCELERATION OF RUNGE-KUTTA INTEGRATION SCHEMES

Lecture IV: Time Discretization

CS520: numerical ODEs (Ch.2)

Graded Project #1. Part 1. Explicit Runge Kutta methods. Goals Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo

Multistage Methods I: Runge-Kutta Methods

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

EXAMPLE OF ONE-STEP METHOD

Chapter 6 - Ordinary Differential Equations

NEW DERIVATIVE FREE ITERATIVE METHOD FOR SOLVING NON-LINEAR EQUATIONS

Solving Zhou Chaotic System Using Fourth-Order Runge-Kutta Method

Numerical Solution of Differential Equations

CS 257: Numerical Methods

Chapter 3 Numerical Methods

Taylor series based nite dierence approximations of higher-degree derivatives

FIRST-ORDER ORDINARY DIFFERENTIAL EQUATIONS III: Numerical and More Analytic Methods David Levermore Department of Mathematics University of Maryland

Lecture 7 - Separable Equations

A Brief Introduction to Numerical Methods for Differential Equations

Ordinary Differential Equations

Dynamic Systems. Simulation of. with MATLAB and Simulink. Harold Klee. Randal Allen SECOND EDITION. CRC Press. Taylor & Francis Group

Solving Ordinary Differential equations

9.2 Euler s Method. (1) t k = a + kh for k = 0, 1,..., M where h = b a. The value h is called the step size. We now proceed to solve approximately

On high order methods for solution of nonlinear

Numerical Methods for Differential Equations

Transcription:

Math55: Differential Equations 1/30 Variable Step Size Differential Equation Solvers Jason Brewer and George Little

Introduction The purpose of developing numerical methods is to approximate the solution to the well posed initial value problem 2/30 dy dt = f(t, y), a t b, y(a) = α

Single Step Solvers Taylor s Method 3/30 The first step to developing a numerical solver is to represent the solution to the Differential Equation as a Taylor power series y(t) = y(a) + y (a)(t a) + y (a) (t a) 2 + 2! where y(t) represents the exact solution.

The Difference Equation After manipulating the power series, we replace the exact solutions with approximated solutions, giving us the equation w i+1 = w i + h[f(t i, w i ) + h 2! f (t i, w i ) + + hn 1 f (n 1) (t i, w i )] n! where w represents the approximated solution and h represents the step size. 4/30

The Difference Equation After manipulating the power series, we replace the exact solutions with approximated solutions, giving us the equation w i+1 = w i + h[f(t i, w i ) + h 2! f (t i, w i ) + + hn 1 f (n 1) (t i, w i )] n! where w represents the approximated solution and h represents the step size This equation can now be put into the form w i+1 = w i + h T (n) (y i, w i ) This equation is called the Taylor Method of order n 5/30

Applying The Taylor method of order 1,2, and 4 to the initial value problem dy = y + t + 1, 0 t 1, y(0) = 1 dt gives us the the following table (figure 1) in result 6/30

Analysis of Euler s Method t Exact value Euler s Method Error 0.0 1.000000 1.000000 0 0.1 1.004837 1.000000 4.837 10 3 0.2 1.018730 1.010000 8.731 10 3 0.3 1.040818 1.029000 1.182 10 2 0.4 1.070320 1.056100 1.422 10 2 0.5 1.106530 1.090490 1.604 10 2 0.6 1.148811 1.131441 1.737 10 2 0.7 1.196585 1.178297 1.829 10 2 0.8 1.249328 1.230467 1.887 10 2 0.9 1.306569 1.287420 1.915 10 2 1.0 1.367879 1.348678 1.920 10 2 7/30

Analysis of Taylor s Method Second Order t Exact value Taylor s Method Error Order Two 0.0 1.000000 1.000000 0 0.1 1.004837 1.005000 1.626 10 4 0.2 1.018730 1.019025 2.942 10 4 0.3 1.040818 1.041218 3.998 10 4 0.4 1.070320 1.070802 4.820 10 4 0.5 1.106530 1.107076 5.453 10 4 0.6 1.148811 1.149404 5.924 10 4 0.7 1.196585 1.197211 6.257 10 4 0.8 1.249328 1.249976 6.470 10 4 0.9 1.306569 1.307227 6.583 10 4 1.0 1.367879 1.368541 6.616 10 4 8/30

Analysis of Taylor s Method Fourth Order t Exact value Taylor s Method Error Order Four 0.0 1.000000 1.000000 0 0.1 1.004837 1.004837 8.200 10 8 0.2 1.018730 1.018730 1.483 10 7 0.3 1.040818 1.040818 2.013 10 7 0.4 1.070320 1.070320 2.429 10 7 0.5 1.106530 1.106530 2.747 10 7 0.6 1.148811 1.148811 2.983 10 7 0.7 1.196585 1.196585 3.149 10 7 0.8 1.249328 1.249329 3.256 10 7 0.9 1.306569 1.306569 3.125 10 7 1.0 1.367879 1.367879 3.332 10 7 9/30

Error Control As can be seen from the table in figure 1, as the order of the method increases, the error produced by Taylor s method decreases. The price for the decrease in error, however, is an increase of the number of calculations. For Taylor s method, this increase means the calculation of higher order derivatives 10/30

Rung-Kutta Methods Because the higher order Taylor s Methods require the calculation of higher order derivatives, they are rarely ever used in practice. The problem of eliminating the upper order derivatives while keeping the higher order accuracy and error control is solved by converting the Taylor Methods into Rung-Kutta methods. 11/30

The Second order Taylor Method can be rewritten into a second order Rung-Kutta Method w i+1 = w i + h[f(t i + h 2, w i + h 2 f(t i, w i ))] 12/30 This particular RK2 Method is called the Midpoint Method and can be rewritten into the form commonly seen in text books. w 0 = α k 1 = f(t i, w i ) k 2 = f(t i + h 2, w i + h 2 k 1) w i+1 = w i + hk 2

The Fourth order Taylor method can be rewritten into a fourth order Rung-Kutta Method w 0 = α k 1 = hf(t i, w i ) 13/30 k 2 = hf(t i + h 2, w i + 1 2 k 1) k 3 = hf(t i + h 2, w i + 1 2 k 2) k 4 = hf(t i, w i + k 3 ) w i+1 = w i + 1 6 (k 1 + 2k 2 + 2k 3 + k 4 ) At this point it is important to note that there are many different Rung-Kutta Methods of n order. A method with a different set of coefficients is a new method.

Error Control and Variable Step Size The main concern with numerical solvers is the error made when they approximate a solution. The second concern is the number of computations that must be performed. Both of these can be addressed by creating solvers that use a variable step size in order to keep the error within a specified tolerance. By using the largest step size allowable while keeping the error within a tolerance, the error made is reduced. 14/30

Determining the Error Made per Step The way to keep the error under control is to determine the error made at each step. A common way to do this is to use two solvers of orders n and n + 1. If you will remember Taylor s Theorem 15/30 y(t) = y(a) + y (a)(t a) + y (a) 2! + y(n+1) (a) (n + 1)! (t a)n+1 + (t a) 2 + + y(n) (a) (t a) n n!

Determining the Error Made per Step The way to keep the error under control is to determine the error made at each step. A common way to do this is to use two solvers of orders n and n + 1. If you will remember Taylor s Theorem 16/30 y(t) = y(a) + y (a)(t a) + y (a) 2! (t a) 2 + + y(n) (a) (t a) n n! + y(n+1) (a) (n + 1)! (t a)n+1 + Any approximations made of order n will have an error no larger than the value of the n + 1 term. This leads us to take the difference of our two solvers to find the value the the error term.

Since the downside of using two distinct methods is a dramatic increase in computations, another method is typically used. An example of this method is the Rung-Kutta-Fehlberg Algorithm. The Rung-Kutta- Fehlberg Algorithm shown here combines Rung-Kutta methods of order four and order five into one algorithm. Doing this reduces the number of computations made while returning the same result. 17/30

Rung-Kutta-Fehlberg Algorithm 1. Set t = a, w = α, h = hmax, FLAG= 1 OUTPUT(t,w) 2. While (F LAG = 1) do Steps 3-11 3. Set 18/30 K 1 = hf(t, w) K 2 = hf(t + 1 4 h, w + 1 4 K 1 K 3 = hf(t + 3 8 h, w + 3 32 K 1 + 9 32 K 2 K 4 = hf(t + 12 1932 h, w + 13 2197 K 1 7200 2197 K 2 + 7296 2197 K 3 K 5 = hf(t + h, w + 439 216 K 1 8K 2 + 3680 513 K 3 845 4104 K 4 K 6 = hf(t + 1 2 h, w 8 27 K 1 + 2K 2 3544 2565 K 3 + 1859 4104 K 4 11 40 K 5

1 4. Set R = 360 K 1 128 4275 K 3 2197 75240 K 4 + 1 50 K 5 + 2 55 K 6 h 5. Set δ = 0.84( T OL 1 R ) 4 6. If (R T OL) then do Steps 7 and 8 7. Set t = t + h, w = w + 25 216 K 1 + 1408 2565 K 3 + 2197 4104 K 4 1 5 K 5 8. OUTPUT(t,w,h) 9. If (δ 0.1) then set h = 0.1h else If (δ 4) then set h = 4h else set h = δh 10. If (h > hmax) then set h = hmax 11. If (t b) then set F LAG = 0 else If (t + h > b) then set h = b t 19/30

else If (h < hmin) then set F LAG = 0 OUTPUT( Minimum h exceeded ) 20/30

Summary From the humble beginnings of Euler s method, numerical solvers started relatively simple and have evolved into the more complex higher order Taylor methods and into the efficient Rung-Kutta methods. And the search for more efficient and accurate methods have lead to the more complicated variable step solvers. 21/30

References 1. Arnold, Dave Technical Help and Advice 2. Brown, Greg Program Inspiration 3. Burden, Richard L., J. Douglas Faires Numerical Analysis: Fourth Edition, PWS-KENT Publishing Company, Boston: 1993 4. Dormand, John R., Numerical Methods for Differential Equations: A Computational ApproachCRC Press, Boca raton: 1996 5. Romero, Chris C++ Technical Help and Advice 22/30