ODE Runge-Kutta methods

Similar documents
Fourth Order RK-Method

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

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

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

Maths III - Numerical Methods

Ordinary Differential Equations (ODEs)

Consistency and Convergence

Chapter 8. Numerical Solution of Ordinary Differential Equations. Module No. 1. Runge-Kutta Methods

16.1 Runge-Kutta Method

Solving PDEs with PGI CUDA Fortran Part 4: Initial value problems for ordinary differential equations

Euler s Method, cont d

Lecture IV: Time Discretization

Numerical Methods for ODEs. Lectures for PSU Summer Programs Xiantao Li

Checking the Radioactive Decay Euler Algorithm

Applied Math for Engineers

Chap. 20: Initial-Value Problems

Physics 299: Computational Physics II Project II

Differential Equations

Lecture V: The game-engine loop & Time Integration

Ordinary Differential Equations (ODEs)

13 Numerical Solution of ODE s

Integration of Ordinary Differential Equations

Chapter 11 ORDINARY DIFFERENTIAL EQUATIONS

Ordinary Differential Equations II

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

Numerical Solution of Differential Equations

Chapter 4: Numerical Methods for Common Mathematical Problems

Ordinary Differential Equations II

Numerical Methods for the Solution of Differential Equations

1 Systems of First Order IVP

ENGI9496 Lecture Notes State-Space Equation Generation

Logistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations

Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras

Section 7.4 Runge-Kutta Methods

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

NUMERICAL SOLUTION OF ODE IVPs. Overview

Differential Equations

1 Ordinary differential equations

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

Fundamentals Physics

8 Numerical Integration of Ordinary Differential

SYSTEMS OF ODES. mg sin ( (x)) dx 2 =

Multistep Methods for IVPs. t 0 < t < T

Mini project ODE, TANA22

Comparison of Numerical Ordinary Differential Equation Solvers

δ Substituting into the differential equation gives: x i+1 x i δ f(t i,x i ) (3)

Computational Methods CMSC/AMSC/MAPL 460. Ordinary differential equations

COSC 3361 Numerical Analysis I Ordinary Differential Equations (II) - Multistep methods

CS205b/CME306. Lecture 4. x v. + t

Exercises, module A (ODEs, numerical integration etc)

On the reliability and stability of direct explicit Runge-Kutta integrators

Integration of Differential Equations

A Brief Introduction to Numerical Methods for Differential Equations

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

2 2 + x =

Chapter 9 Implicit Methods for Linear and Nonlinear Systems of ODEs

Differential Equations

Numerical Methods for Ordinary Differential Equations

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

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

Mathematics for chemical engineers. Numerical solution of ordinary differential equations

Ordinary Differential Equations

Ordinary Differential Equations

Physically Based Modeling Differential Equation Basics

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations

Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras

MA/CS 615 Spring 2019 Homework #2

AN OVERVIEW. Numerical Methods for ODE Initial Value Problems. 1. One-step methods (Taylor series, Runge-Kutta)

Fifth-Order Improved Runge-Kutta Method With Reduced Number of Function Evaluations

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

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

Numerical Methods - Initial Value Problems for ODEs

Previous Year Questions & Detailed Solutions

Ph 22.1 Return of the ODEs: higher-order methods

Numerical Methods for Initial Value Problems; Harmonic Oscillators

AIMS Exercise Set # 1

10 Numerical Solutions of PDEs

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

SME 3023 Applied Numerical Methods

The Simple Double Pendulum

The Definition and Numerical Method of Final Value Problem and Arbitrary Value Problem Shixiong Wang 1*, Jianhua He 1, Chen Wang 2, Xitong Li 1

Numerical Methods for Initial Value Problems; Harmonic Oscillators

Scientific Computing: An Introductory Survey

Computational Methods CMSC/AMSC/MAPL 460. Ordinary differential equations

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point

SKMM 3023 Applied Numerical Methods

Lecture 4: Numerical solution of ordinary differential equations

Lecture 17: Ordinary Differential Equation II. First Order (continued)

Module 6: Implicit Runge-Kutta Methods Lecture 17: Derivation of Implicit Runge-Kutta Methods(Contd.) The Lecture Contains:

Astronomy 8824: Numerical Methods Notes 2 Ordinary Differential Equations

Lecture 42 Determining Internal Node Values

Strong Stability Preserving Properties of Runge Kutta Time Discretization Methods for Linear Constant Coefficient Operators

THE UNIVERSITY OF NEW SOUTH WALES SCHOOL OF PHYSICS PHYS2020 COMPUTATIONAL PHYSICS FINAL EXAM SESSION I Answer all questions

MULTIPOINT BOUNDARY VALUE PROBLEMS FOR ORDINARY DIFFERENTIAL EQUATIONS. Katalin Károlyi Department of Applied Analysis, Eötvös Loránd University

Solving ODEs Euler Method & RK2/4

CS520: numerical ODEs (Ch.2)

Solving scalar IVP s : Runge-Kutta Methods

EXAMPLE OF ONE-STEP METHOD

. For each initial condition y(0) = y 0, there exists a. unique solution. In fact, given any point (x, y), there is a unique curve through this point,

Multistage Methods I: Runge-Kutta Methods

Transcription:

ODE Runge-Kutta methods The theory (very short excerpts from lectures) First-order initial value problem We want to approximate the solution Y(x) of a system of first-order ordinary differential equations where Y(x) = Y (x) = F(x, Y(x)) with an initial condition Y(x (0) ) = Y (0), (1) y 1 (x) y 2 (x) y n (x), Y (x) = y 1(x) y 2(x) y n(x), F(x, Y) = f 1 (x, y 1, y 2,, y n ) f 2 (x, y 1, y 2,, y n ) f n (x, y 1, y 2,, y n ) Explicit Runge-Kutta methods - numerical methods for finding an approximation of the solution, using explicit formulas (there is no need to solve any equations) Euler method The simplest and least accurate method (first-order accuracy) is Euler method, which extrapolates the derivative at the starting point of each interval to find the next function value: for i = 0, 1, 2, 1 compute the derivative K of the vector function Y as K = F(x (i), Y (i) ) 2 compute Y (i+1) = Y (i) + h K Collatz (or midpoint) method An example of a second-order Runge-Kutta method (with second-order accuracy) is Collatz method, also called midpoint method First, initial derivative at the starting point of each interval is used to find a trial point halfway across the interval Second, this midpoint derivative is computed and used to make step across the full length of the interval The trial midpoint is discarded once its derivative has been calculated and used 1 c Certik

for i = 0, 1, 2, 1 compute the trial midpoint [x p, Y p ] using Euler method with 1 2 h: K 1 = F(x (i), Y (i) ) x p = x (i) + 1 2 h Y p = Y (i) + 1 2 h K 1 2 compute the derivative K 2 at the trial midpoint [x p, Y p ] as K 2 = F(x p, Y p ) 3 compute Y (i+1) using derivative at the trial midpoint: Y (i+1) = Y (i) + h K 2 The classical fourth-order Runge-Kutta method (RK4) This is the most often used, fourth-order, Runge-Kutta formula It uses three trial points to make a guess of the direction, which is then used to make step across the full length of the interval These trial points are discarded once their derivatives have been calculated and used for i = 0, 1, 2, 1 compute the first trial midpoint [x p, Y p ] using Euler method with step size 1 2 h: K 1 = F(x (i), Y (i) ) x p = x (i) + 1 2 h Y p = Y (i) + 1 2 h K 1 2 compute the second trial midpoint [x p, Y q ], using the derivative at the first trial midpoint [x p, Y p ] and a step size 1 2 h: K 2 = F(x p, Y p ) Y q = Y (i) + 1 2 h K 2 3 compute trial endpoint [x (i+1), Y e ], using the derivative at the second trial midpoint [x p, Y q ] and a step size h: K 3 = F(x p, Y q ) Y e = Y (i) + h K 3 4 compute Y (i+1) using weighted average of derivatives at the initial point and at all three trial points: K 4 = F(x (i+1), Y e ) Y (i+1) = Y (i) + 1 6 h (K 1 + 2K 2 + 2K 3 + K 4 ) 2 c Certik

Example 1 - from the previous tutorial, with RK4 added Consider Cauchy problem y = y x 2, y(1) = 2 Compute an approximate value of y(14) using RK4 with step sizes h = 02 and h = 04 and compare its performance with previous results summarized in the first four columns of Table 1: exact solution, Euler method with step size h = 01 and Collatz method with step size h = 02 k = 0 step 1: The solution Computation for h = 02 : x (0) = 1, y (0) = 2 k 1 = y(0) (x (0) ) 2 = 2 1 2 = 2, x p = x (0) + 1 2h = 1 + 01 = 11, y p = y (0) + 1 2 h k 1 = 2 + 01 2 = 22 step 2: step 3: step 4: k 2 = y p x 2 = 22 p 11 2 = 18182 y q = y (0) + 1 2 h k 2 = 2 + 01 18182 = 21818 k 3 = y q x 2 = 21818 p 11 2 = 18032 x (1) = x (0) + h = 1 + 02 = 12, y e = y (0) + h k 3 = 2 + 02 18032 = 23606 k 4 = y e (x (1) ) = 23606 2 12 2 = 16393 y (1) = y (0) + 1 6 h (k 1 + 2k 2 + 2k 3 + k 4 ) = = 2 + 1 30 (2 + 2 18182 + 2 18032 + 16393) = 23627 y(12) is approximately equal to y (1) = 23627 This is the second value at the fifth column 3 c Certik

k = 1 step 1: k 1 = y(1) (x (1) ) = 23627 2 12 2 = 16408 x p = x (1) + 1 2h = 12 + 01 = 13 y p = y (1) + 1 2 h k 1 = 23627 + 01 16408 = 25268 step 2: step 3: step 4: k 2 = y p x 2 = 25268 p 13 2 = 14952 y q = y (1) + 1 2 h k 2 = 23627 + 01 14952 = 25122 k 3 = y q x 2 = 25122 p 13 2 = 14865 x (2) = x (1) + h = 12 + 02 = 14 y e = y (1) + h k 3 = 23627 + 02 14865 = 26600 k 4 = y e (x (2) ) = 26600 2 14 2 = 13572 y (2) = y (1) + 1 6 h (k 1 + 2k 2 + 2k 3 + k 4 ) = = 23627 + 1 30 (16408 + 2 14952 + 2 14865 + 13572) = 26614 y(14) is approximately equal to y (2) = 26614 The last two values at fifth column are computed by the same process for k = 2 and k = 3 Using similar process with h = 04 we obtain values presented at the last column of Table 1 Our results show that Collatz method gives more precise solution than Euler method, even in the case when double step size is used (which represents comparable work, because within every step the derivative is computed twice) RK4 method gives the best results, even in the case when quadruple step size is used (which represents comparable work, because within every step the derivative is computed four times) 4 c Certik

exact h = 01 Euler h = 02 Collatz h = 02 RK4 h = 04 RK4 x (i) y(x (i) ) y (i) y (i) y (i) y (i) 1 20000 20000 20000 20000 20000 11 21903 22000 12 23627 23818 23636 23627 12 25191 25472 14 26614 26979 26628 26614 26617 15 27912 28356 16 29100 29616 29115 29100 17 30190 30773 18 31192 31838 31209 31193 31196 Table 1: Example 1 The first column represents values of x, where the approximate solution is computed At the second column there is exact solution, the third column presents approximate solution obtained by Euler method with step size h = 01, at the fourth column there is Collatz method with the step size h = 02 and the last two columns present approximate solution obtained by RK4 method with step sizes h = 02 and h = 04, respectively 5 c Certik