Module1: Numerical Solution of Ordinary Differential Equations. Lecture 6. Higher order Runge Kutta Methods

Similar documents
over The idea is to construct an algorithm to solve the IVP ODE (9.1)

over The idea is to construct an algorithm to solve the IVP ODE (8.1)

Homework Set 5 (Sections )

ChE 400: Applied Chemical Engineering Calculations Tutorial 6: Numerical Solution of ODE Using Excel and Matlab

7.1 First-order initial-value problems

LAB #8 Numerical Methods

Module 2: Single Step Methods Lecture 4: The Euler Method. The Lecture Contains: The Euler Method. Euler's Method (Analytical Interpretations)

Jason Yalim. Here we perform a few tasks to ensure a clean working environment for our script.

Euler s Methods (a family of Runge- Ku9a methods)

Homework 14 solutions

(Part - 1) P. Sam Johnson. April 14, Numerical Solution of. Ordinary Differential Equations. (Part - 1) Sam Johnson. NIT Karnataka.

Application 7.6A The Runge-Kutta Method for 2-Dimensional Systems

ODEs occur quite often in physics and astrophysics: Wave Equation in 1-D stellar structure equations hydrostatic equation in atmospheres orbits

A Study on Numerical Exact Solution of Euler, Improved Euler and Runge - Kutta Method

Mathematics for chemical engineers

Finite difference methods

MAT 275 Laboratory 3 Numerical Solutions by Euler and Improved Euler Methods (scalar equations)

Ordinary Differential Equations

ODE IVP. An Ordinary Differential Equation (ODE) is an equation that contains a function having one independent variable:

MAT 275 Laboratory 3 Numerical Solutions by Euler and Improved Euler Methods (scalar equations)

Approximate Solutions to Differential Equations Slope Fields (graphical) and Euler s Method (numeric) by Dave Slomer

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

Exercises for a Numerical Methods Course

Comparison of Some Evolutionary Algorithms for Approximate Solutions of Optimal Control Problems

Numerical Solutions of Differential Equations (1)

Lecture 22: Rules for Solving IVP

Exercises C-Programming

Ordinary differential equations solving methods

Application 2.4 Implementing Euler's Method

Workpackage 5 - Ordinary Differential Equations

Math/CS 467/667 Combined Programming 2 and Homework 2. The Shu Oscher Method

Post Processing, Visualization, and Sample Output

=.1( sin(2πx/24) y) y(0) = 70.

MATH2071: LAB 2: Explicit ODE methods

Direction Fields; Euler s Method

4 Visualization and. Approximation

Math 104: Euler s Method and Applications of ODEs

Math 225 Scientific Computing II Outline of Lectures

POLYMATH Example for the Numerical Solution of ODEs

Suppose we want to find approximate values for the solution of the differential equation

The listing says y(1) = How did the computer know this?

Discontinuous Galerkin Sparse Grid method for Maxwell s equations

Math Homework 3

Part I: Theoretical Background and Integration-Based Methods

Mathematical Methods and Modeling Laboratory class. Numerical Integration of Ordinary Differential Equations

Homework Set #2-3, Math 475B

An Introduction to Flow Visualization (1) Christoph Garth

Computational Economics and Finance

User-Defined Function

Thursday 1/8 1 * syllabus, Introduction * preview reading assgt., chapter 1 (modeling) * HW review chapters 1, 2, & 3

dy = dx y dx Project 1 Consider the following differential equations: I. xy II. III.

From the output we see that the largest eigenvalue of B is about (ii) Use the inverse power method to find the smallest eigenvalue.

Numerical Methods Lecture 7 - Optimization

Euler s Method for Approximating Solution Curves

Math 133A, September 10: Numerical Methods (Euler & Runge-Kutta) Section 1: Numerical Methods

Volumes of Solids of Revolution Lecture #6 a

Vector Field Visualization: Introduction

37 Self-Assessment. 38 Two-stage Runge-Kutta Methods. Chapter 10 Runge Kutta Methods

1 a = [ 5, 1, 6, 2, 4, 3 ] 4 f o r j i n r a n g e ( i + 1, l e n ( a ) 1) : 3 min = i

Computational Economics and Finance

Truncation Errors. Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4.

Review Initial Value Problems Euler s Method Summary

RK4. Version 3.0. (updated 12/1/2006) 2001, 2005, 2006 Tomas Co. Michigan Technological University Houghton, MI 49931

Simulation in Computer Graphics. Particles. Matthias Teschner. Computer Science Department University of Freiburg

CS205b/CME306. Lecture 9

Numerical Analysis Fall. Numerical Differentiation

Clipping Lines. Dr. Scott Schaefer

Vector Field Visualization: Introduction

Computer Simulations

Functions of Two variables.

Num. #1: Recalls on Numerical Methods for Linear Systems and Ordinary differential equations (ODEs) - CORRECTION

MA FINAL EXAM INSTRUCTIONS VERSION 01 DECEMBER 9, Section # and recitation time

SYDE 312 UNIT 4: EXTRA QUADRATURE PROBLEMS

Excel Scientific and Engineering Cookbook

f xx (x, y) = 6 + 6x f xy (x, y) = 0 f yy (x, y) = y In general, the quantity that we re interested in is

SEQUEL Users Manual: Part 2

RK4. Version 2.0 (updated 5/30/2005) 2001, 2005 Tomas Co. Michigan Technological University Houghton, MI 49931

Data Visualization. Fall 2017

First of all, we need to know what it means for a parameterize curve to be differentiable. FACT:

Dynamic Computation of Runge-Kutta s Fourth-Order Algorithm for First and Second Order Ordinary Differential Equation Using Java

Introduction to Simulink

Validated Solution of Initial Value Problem for Ordinary Differential Equations based on Explicit and Implicit Runge-Kutta Schemes

Math 98 - Introduction to MATLAB Programming. Fall Lecture 2

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

2. Solve for x when x < 22. Write your answer in interval notation. 3. Find the distance between the points ( 1, 5) and (4, 3).

Name: Signature: Section and TA:

BME 5742 Bio-Systems Modeling and Control

Parallel implicit ordinary differential equation solver for cuda. Tomasz M. Kardaś

Modelling and Simulation for Engineers

LECTURE 0: Introduction and Background

REVIEW I MATH 254 Calculus IV. Exam I (Friday, April 29) will cover sections

The WENO Method in the Context of Earlier Methods To approximate, in a physically correct way, [3] the solution to a conservation law of the form u t

Introduction to Matlab

Using Modified Euler Method (MEM) for the Solution of some First Order Differential Equations with Initial Value Problems (IVPs).

HSC Mathematics - Extension 1. Workshop E2

HW/SW Codesign. WCET Analysis

Advanced Programming in Engineering Saurabh Srivastava, Thomas Weinhart Martin Robinson, and Stefan Luding MSM, CTW, UTwente, NL

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

Civil Engineering Systems Analysis Lecture XV. Instructor: Prof. Naveen Eluru Department of Civil Engineering and Applied Mechanics

NAG Library Function Document nag_ode_ivp_rk_setup (d02pvc)

Transcription:

Module1: Numerical Solution of Ordinary Differential Equations Lecture 6 Higher order Runge Kutta Methods Keywords: higher order methods, functional evaluations, accuracy

Higher order Runge Kutta Methods The local error of RK4 is O(h 5 ) while the global error is O(h 4 ). If the solution of IVP is to be obtained for t in the interval (0,1] with h=0.1 using RK4, then the solution is to be computed at 10 grid points t=0.1, 0.2,,1.0. At each grid point four functional evaluations are required. This way, the solution at t=1 requires 40 functional evaluations and the accuracy will be of order 10-4. If Euler method is to be used then h=0.0001 will yield the desired accuracy of 10-4. Accordingly, the solution is to be computed at 10000 grid points to reach to t=1.this means Euler method requires10,000 functional evaluations (one for each grid point) to compute approximate solution at t=1. Evidently, RK4 is very efficient and saves lots of computational effort. We can further improve the efficiency by employing still higher order Runge-Kutta methods. The higher order methods, say of order 5 and 6 are developed on the same lines. These are more efficient as the higher accuracy is achieved with less computational effort as compared to lower order methods. Runge-Kutta method ( say of order 4) is applied for obtaining approximate solution y 1 at t=t 1 =t+h for IVP with chosen value of h. The value of h is then halved and the solution is again obtained at t 1. Now 7 functional evaluations are needed to compute y1. If the difference between two solutions is not substantial then the approximation is accepted. Otherwise, the iteration (halving h) is repeated again till the desired accuracy is achieved. Each halving h will require 4+7 functional evaluations. This way higher accuracy can be achieved with more computational effort. In another approach, higher performance with less computational effort is achieved when the Runge-Kutta methods of different orders are used to move from one grid point to the next point. One such method known as Runge-Kutta Fehlberg method is based on the formulae (1.19) given below. In this, two estimates are obtained for y k+1 using RK method of global error O(h 4 ) and O(h 5 ) with six functional evaluations.

K f( t, y ) 1 k k h h K2 f( tk, yk K1) 4 4 3h 3h 9h K3 f( tk, yk K1 K2) 8 32 32 12h 1932h 7200h 7296h K4 f( tk, yk K1 K2 K3) 13 2197 2197 2197 439h 3680h 845h K5 f( tk h, yk K1 8hK2 K3 K4) 216 513 4104 h 8h 3544h 1859h 11h K6 f( tk, yk K1 2hK2 K3 K4 K5) 2 27 2565 4104 40 h 25 1408 2197 1 yˆ k 1 yk [ K1 K3 K4 K5] 8 216 2565 4104 5 h 16 6656 28561 9 2 y k 1 yk [ K1 K3 K4 K5 K6] 8 135 12825 56430 50 55 1 128 2197 1 2 Error y ˆ k 1 yk 1 [ K1 K3 K 4 K5 K6] h 360 4275 75240 50 55 (1.19) Since the lower order method is of order four, the step size adjustment factor s can be computed as s 0. 84 T i 1 14 / ˆ Here, ε is the accuracy requirement and T is the truncation errort y y i 1 i 1 i 1. If the desired accuracy is not achieved the solution is iterated taking new value of h. Depending upon error requirement the step size h can be increased or decreased. The solution y k+1 of desired accuracy is obtained at t k+1 =t k +sh. The method is known as RKF45. To implement the method, the user specifies the allowable smallest step size h min, largest step size h max and the maximum allowable local truncation error ε. The following algorithm is used to solve IVP using RKF45 formulae with self adjusting variable step sizes:

Algorithm RKF45 [Step 1] set k=0, t=a=t 0, y=y k, h=h max, flag=1 [Step 2] while (flag==1) repeat steps 3-7 [Step 3] compute y, yˆ andr yˆ y k 1 k 1 k 1 k 1 [Step 4] compute s [Step 5] if s >h max then h=h max else if (s<h min ) exit else h=s [Step 6] if ( R ) flag=0 [Step 7] go to step 2 [Step 8] t=t+h, y=yk+1, k++; flag=1 [Step 9] if( t<=b) goto step 2 [Step 10] stop Example 1.8: Solve IVP using y 2ty 2, y( 0) Solution: the matlab code for solving the system is given as function dydt= rkf4(t,y) dydt=y.^2.2*t; [t,y]=ode45(@rkf4,[0 1], 1); %[0 1]-time span, 1-initial condition t y 0.1 1.005 0.2 1.02 0.3 1.047 0.4 1.088 0.5 1.145 0.6 1.225 0.7 1.337 0.8 1.497 0.9 1.741 1.0 2.146 Table 1.6 Solution of example 1.8

Example 1.9: find the solution of IVP using higher order order Runge-Kutta method RKF45 given in (1.19) in the interval (0,2) taking h max=0.25, hmin=0.01 and accuracy as 0.000001 dy 2 y t 1; y( 0) 0. 5 dt Solution: The detailed solution of the problem is worked out in the excel sheet rkf45.xls h t y k1 k2 k3 k4 k5 Kk6 y5 0.25 0 0.5 1.5 1.589844 1.638153 1.833988 1.863381 1.681916 0.92048705 0.188324 0 0.5 1.5 1.568405 1.604568 1.753716 1.775389 1.638313 0.80850123 0.25 0.188324 0.808501 1.773035 1.856403 1.901019 2.079976 2.10662 1.94126 1.2937217 0.192067 0.188324 0.808501 1.773035 1.83778 1.87192 2.011491 2.031676 1.903627 1.17405097 0.20392 0.380391 1.174051 2.029354 2.091427 2.124074 2.255372 2.274263 2.154073 1.61316482 0.206565 0.584311 1.613165 2.271745 2.326045 2.354349 2.465632 2.481366 2.380102 2.10457288 0.214212 0.790876 2.104573 2.479088 2.524275 2.54744 2.634325 2.646171 2.568076 2.6543036 0.225464 1.005088 2.654304 2.644102 2.676656 2.692615 2.74499 2.751256 2.706084 3.26380128 0.24762 1.230552 3.263801 2.749544 2.763568 2.768682 2.767586 2.764947 2.771299 3.94887292 0.25 1.478171 3.948873 2.763882 2.747947 2.735929 2.656062 2.640557 2.722156 4.62774423 0.25 1.728171 4.627744 2.641168 2.586313 2.552099 2.370792 2.338767 2.517156 5.25474897 0.206501 1.728171 4.627744 2.641168 2.596419 2.569447 2.430547 2.406828 2.541928 5.15141426 0.215663 1.934673 5.151414 2.408456 2.326784 2.278814 2.042876 2.003464 2.231007 5.63074392 Table 1.7 Details of Solution of example 1.9 tk+1 y5 exact tk+1 y5 exact 0.25 0.92048705 0.920487292 1.230552 3.26380128 3.263801766 0.188324 0.80850123 0.808501278 1.478171 3.94887292 3.948873499 0.438324 1.2937217 1.293721978 1.728171 4.62774423 4.62774482 0.380391 1.17405097 1.174051068 1.978171 5.25474897 5.254749428 0.584311 1.61316482 1.613164996 1.934673 5.15141426 5.151414894 0.790876 2.10457288 2.104573148 2.150336 5.63074392 5.630744518 1.005088 2.6543036 2.654303965 Table 1.8 Comparison with exact Solution of example 1.9

Exercise 1 1.1 Apply Eulers method to solve the initial value problems in the interval (0,1]: y 2y 3t, y( 0) 2 y 2ty, y( 0) x y, y( 0) y Take h=0.1 and compare with exact solutions. Reduce h=0.05 and again solve the two IVPs. 1.2 Apply modified Euler method to IVPs in Ex. 1.1 with h=0.1. Compare the effort and accuracy achieved in two methods. 1.3 Can Eulers method be applied to solve the following IVP in the interval (0,2) y () t 4 y 2, y( 0) 0 1.4 Show that Eulers method and modified Eulers method fail to approximate the solution yt () 3/ 2 8t of the IVP / y () t 6y 13, y( 0) 0 1.5 Solve the following IVP using Runge Kutta method of order two and four: y () t t 2 y 2, y() 1 0 at t 2using h=0.5 y () t y sin x, y( 0) 2 at t 1using h=0.1