
Ordinary Differential Equations (ODEs): Midpoint and Heun's Methods Overview
Explore topics on numerical methods for ODEs, focusing on the Midpoint and Heun's Predictor-Corrector Methods. Understand solving first-order differential equations using these techniques and grasp concepts like local truncation error and global truncation error.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
CISE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM Read 25.1-25.4, 26-2, 27-1 CISE301_Topic8L3 KFUPM 1
Outline of Topic 8 Lesson 1: Lesson 2: Lesson 3: Lessons 4-5: Runge-Kutta methods Lesson 6: Solving systems of ODEs Lesson 7: Multiple step Methods Lesson 8-9: Boundary value Problems Introduction to ODEs Taylor series methods Midpoint and Heun s method CISE301_Topic8L3 KFUPM 2
Lecture 30 Lesson 3: Midpoint and Heun s Predictor Corrector Methods CISE301_Topic8L3 KFUPM 3
Learning Objectives of Lesson 3 To be able to solve first order differential equations using the Midpoint Method. To be able to solve first order differential equations using the Heun s Predictor Corrector Method. CISE301_Topic8L3 KFUPM 4
Topic 8: Lesson 3 Lesson 3: Midpoint & Heun s Predictor-Corrector Methods Review Euler Method Midpoint Method Heun s Method CISE301_Topic8L3 KFUPM 5
Euler Method Problem ( ) ( y x Euler Method ( y y x y y for i = = ( , ) f x y y ) y x 0 0 = = + ) ( , ) h f x y = + 0 0 1 i i i i 1,2,... 2 Local Truncation Error Global Truncation Error ) O(h O(h ) CISE301_Topic8L3 KFUPM 6
Introduction to Problem f x y = solved be y y is x a first y = order ODE : ( ) ( , ), ( 0) x 0 The methods proposed in this lesson have the general form: h y y i i + = +1 = ( , ) f iy x For the case of Euler: Different forms of will be used for the Midpoint and Heun s Methods. i CISE301_Topic8L3 KFUPM 7
Midpoint Method Problem ( ) y x Midpoint Method ( ) y x h y f x y + = = ( , ) f x y y 0 0 = = ( ) ( , ) y x y y 0 0 1 2 i i i 2 + i = + ( , ) y y h f x y + 1 1 2 1 2 i i + + i i 3 Local Truncation Error Global Truncation Error ) ) O(h 2 O(h CISE301_Topic8L3 KFUPM 8
Motivation The midpoint can be summarized as: Euler method is used to estimate the solution at the midpoint The value of the rate function f(x,y) at the midpoint is calculated and used to estimate yi+1 Local Truncation error of order O(h3) Comparable to 2nd order Taylor series method CISE301_Topic8L3 KFUPM 9
Midpoint Method ( , ) iy x i x x x + 0 1 1 i + i 2 h = + = + ( , , ) i ( , ) y y f x y y y h f x y + 1 1 1 1 i i i i 2 + + + i i i 2 2 2 slope CISE301_Topic8L3 KFUPM 10
Midpoint Method slope = ( , ) f iy x i ( , ) iy x i x x x + 0 1 1 i + i 2 h = + = + ( , , ) i ( , ) y y f x y y y h f x y + 1 1 1 1 i i i i 2 + + + i i i 2 2 2 slope CISE301_Topic8L3 KFUPM 11
Midpoint Method ( , ) x y 1 1 slope = ( , ) f iy x + + i i 2 2 i ( , ) iy x i x x x + 0 1 1 i + i 2 h = + = + ( , , ) i ( , ) y y f x y y y h f x y + 1 1 1 1 i i i i 2 + + + i i i 2 2 2 slope CISE301_Topic8L3 KFUPM 12
Midpoint Method = ( , ) slope f x y 1 1 + + i i ( , ) x y 2 2 1 1 + + i i 2 2 ( , ) iy x i x x x + 0 1 1 i + i 2 h = + = + ( , , ) i ( , ) y y f x y y y h f x y + 1 1 1 1 i i i i 2 + + + i i i 2 2 2 slope CISE301_Topic8L3 KFUPM 13
Midpoint Method = ( , ) slope f x y 1 1 + + i i ( , ) x y 2 2 1 1 + + i i 2 2 ( , ) iy x i x x x + 0 1 1 i + i 2 h = + = + ( , , ) i ( , ) y y f x y y y h f x y + 1 1 1 1 i i i i 2 + + + i i i 2 2 2 slope CISE301_Topic8L3 KFUPM 14
Example 1 Midpoint the Use + = x y Method solve to the ODE + 2 ( ) 1 x y = h ) 0 ( y 1 = Use Determine . 1 . 0 y(0.1) and y(0.2) CISE301_Topic8L3 KFUPM 15
Example 1 = + + = = = = 2 Problem: ( , ) 1 , ( ) (0) 1, 0.1 f x y y x y y x y h 0 0 = Step1 ( 0 ) h : i = + ) 1 = + 0.05(1 0 1) + + = ( , f x y 1.1 y y 1 2 = 0 0 0 2 + 0 + 1 0.1(1 = + + + = ( , ) 1.1 0.0025) 1.2103 y y h f x y 1 0 1 2 1 2 + + 0 0 = Ste p2 ( 1) h : i = + = + + + = ( , f x y ) 1. 2103 .05(1 1.2 1 3 0 0.01) 1.3213 y y 1 2 = 1 1 1 2 + 1 + = + + + = ( , ) 1.21 03 0.1(1 1.32 13 0.0225) 1.4446 8 y y h f x y 2 1 1 2 1 2 + + 1 1 CISE301_Topic8L3 KFUPM 16
Heuns Predictor Corrector CISE301_Topic8L3 KFUPM 17
Heuns Predictor Corrector Method Problem ( ) y x H ' Method ( y x = = + eun s y = ( , ) f x y ) 0 0 = 0 i ( ) Predictor: ( , ) y x y y y h f x y h + + 0 0 1 i i i ( ) + = + 1 k i k i Corrector: ( , f x y ) ( , ) y y f x y + + + 1 1 1 i i i i 2 3 Local Truncation Error Global Truncation Error ) ) O(h Not a power!! It s just an index 2 O(h CISE301_Topic8L3 KFUPM 18
Heuns Predictor Corrector (Prediction) 0 + i ( , ) x y + 1 1 i ( , ) iy x i x x + 1 i i 0 i = + Prediction ( , ) y y h f x y + 1 i i i CISE301_Topic8L3 KFUPM 19
Heuns Predictor Corrector (Prediction) 0 + i ( , ) x y + = 0 + i 1 1 i ( , ) slope f x y + 1 1 i ( , ) iy x i x x + 1 i i = + 0 i Prediction ( , ) y y h f x y + 1 i i i CISE301_Topic8L3 KFUPM 20
Heuns Predictor Corrector (Correction) + 0 + i ( , ) ( , ) f x y f x y = + 1 1 i i i slope 2 0 + i ( , ) x y + 1 1 i 1 i ( , ) x y ( , ) iy x + + 1 1 i i x x + 1 i i ( ) ) 1 + h = + + 1 i 0 i ( , ) ( , y y f x y f x y + + 1 1 i i i i 2 CISE301_Topic8L3 KFUPM 21
Example 2 Use the Heun's Method to solve the ODE ( ) 1 (0) 1 Us one correction onl e 0.1, and Determine y(0.1 ) and y(0.2) = + = = + 2 y x y x y y h CISE301_Topic8L3 KFUPM 22
Example 2 = + + = = = = 2 Problem: ( , ) 1 , ( y x ) (0) y 1, 0.1 f x y y x y h 0 0 Step1 ( = 0): i = + ) 1 0.1(2) = + = 0 1 Predictor: ( , 1.2 y y h f x y h 0 0 0 ( ) ) = + + 1 1 0 1 Corrector: ( , f x y ) ( , f x y ) y y 0 0 0 1 2 ( 1 0.05 = + + 1 0.05(2 = + + = St ep2 ( = (0,1 ) (0.1, 1 .2 ) 2.21) 1. 2105 f f 1): i = + = + = 0 2 Predictor: ( , ) 1 .2105 0.1 (0.1, f 1.2105 ) 1.4326 y y h f x y h + 1 1 1 ( ) = + 1 2 0 2 Corrector: ( , f x y ) ( , f x ) y y y 1 1 1 2 2 = + + = 1.2105 0.05( (0.1, 1.210 5 ) ( 0.2, 1.4326 )) 1.44 5 2 f f CISE301_Topic8L3 KFUPM 23
Summary Euler, Midpoint and Heun s methods are similar in the following sense: slope h y y i i + = +1 Different methods use different estimates of the slope. Both Midpoint and Heun s methods are comparable in accuracy to the 2nd order Taylor series method. CISE301_Topic8L3 KFUPM 24
Comparison Method Local truncation error Global truncation error = + 2 Euler Method ( , ) ( ) ( ) y y h f x y O h O h + 1 i i i i Heun' Method s = + 0 + i 3 2 Predictor : ( , ) ( ) ( ) y y h f x y O h O h 1 i i i ( ) h + = + + 1 k i k i Corrector : ( , ) ( , ) y y f x y f x y + + + 1 1 1 i i i i 2 h = + 3 2 Midpoint ( , ) ( ) ( ) y y f x y O h O h 1 i i i 2 + i 2 = + ( , ) y y h f x y + 1 1 1 i i + + i i 2 2 CISE301_Topic8L3 KFUPM 25
More in this Topic Lessons 4-5: Runge-Kutta Methods Lesson 6: Systems of High order ODE Lesson 7: Multi-step methods Lessons 8-9: Boundary Value Problems CISE301_Topic8L3 KFUPM 26