Numerical Methods: Euler’s and Advanced Euler’s (Heun’s) Methods

Slides:



Advertisements
Similar presentations
INTEGRALS Areas and Distances INTEGRALS In this section, we will learn that: We get the same special type of limit in trying to find the area under.
Advertisements

Copyright © Cengage Learning. All rights reserved. 5 Integrals.
8 TECHNIQUES OF INTEGRATION. There are two situations in which it is impossible to find the exact value of a definite integral. TECHNIQUES OF INTEGRATION.
NUMERICAL DIFFERENTIATION The derivative of f (x) at x 0 is: An approximation to this is: for small values of h. Forward Difference Formula.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
19.5 Numeric Integration and Differentiation
Integrals 5.
Trapezoidal Approximation Objective: To find area using trapezoids.
INTEGRALS Areas and Distances INTEGRALS In this section, we will learn that: We get the same special type of limit in trying to find the area under.
1 5.e – The Definite Integral as a Limit of a Riemann Sum (Numerical Techniques for Evaluating Definite Integrals)
5.2 Definite Integrals. Subintervals are often denoted by  x because they represent the change in x …but you all know this at least from chemistry class,
1 §12.4 The Definite Integral The student will learn about the area under a curve defining the definite integral.
INTEGRALS 5. INTEGRALS In Chapter 2, we used the tangent and velocity problems to introduce the derivative—the central idea in differential calculus.
Integrals  In Chapter 2, we used the tangent and velocity problems to introduce the derivative—the central idea in differential calculus.  In much the.
Copyright © Cengage Learning. All rights reserved. 4 Integrals.
Section 5.2b. Do Now: Exploration 1 on page 264 It is a fact that With this information, determine the values of the following integrals. Explain your.
1 5.2 – The Definite Integral. 2 Review Evaluate.
In this section, we will investigate how to estimate the value of a definite integral when geometry fails us. We will also construct the formal definition.
Section 5.9 Approximate Integration Practice HW from Stewart Textbook (not to hand in) p. 421 # 3 – 15 odd.
Definite Integrals Riemann Sums and Trapezoidal Rule.
CHAPTER 3 NUMERICAL METHODS
Section 5.1/5.2: Areas and Distances – the Definite Integral Practice HW from Stewart Textbook (not to hand in) p. 352 # 3, 5, 9 p. 364 # 1, 3, 9-15 odd,
Riemann Sums Approximating Area. One of the classical ways of thinking of an area under a curve is to graph the function and then approximate the area.
In Chapters 6 and 8, we will see how to use the integral to solve problems concerning:  Volumes  Lengths of curves  Population predictions  Cardiac.
Ch 8.2: Improvements on the Euler Method Consider the initial value problem y' = f (t, y), y(t 0 ) = y 0, with solution  (t). For many problems, Euler’s.
Riemann Sums Lesson 14.2 Riemann Sums are used to approximate the area between a curve and the x-axis over an interval. Riemann sums divide the areas.
Chapter 6 Integration Section 4 The Definite Integral.
Area/Sigma Notation Objective: To define area for plane regions with curvilinear boundaries. To use Sigma Notation to find areas.
Copyright © Cengage Learning. All rights reserved. 7 Techniques of Integration.
Copyright © Cengage Learning. All rights reserved. 4 Integrals.
Approximating Antiderivatives. Can we integrate all continuous functions? Most of the functions that we have been dealing with are what are called elementary.
Numerical Integration using Trapezoidal Rule
Copyright © Cengage Learning. All rights reserved The Integral Test and Estimates of Sums.
INTEGRALS 5. INTEGRALS In Chapter 3, we used the tangent and velocity problems to introduce the derivative—the central idea in differential calculus.
[5-4] Riemann Sums and the Definition of Definite Integral Yiwei Gong Cathy Shin.
SECTION 4-3-B Area under the Curve. Def: The area under a curve bounded by f(x) and the x-axis and the lines x = a and x = b is given by Where and n is.
INFINITE SEQUENCES AND SERIES In general, it is difficult to find the exact sum of a series.  We were able to accomplish this for geometric series and.
Copyright © Cengage Learning. All rights reserved.
5 INTEGRALS.
CHAPTER 3 NUMERICAL METHODS
Copyright © Cengage Learning. All rights reserved.
NUMERICAL DIFFERENTIATION Forward Difference Formula
Separable Differential Equations
Lecture 19 – Numerical Integration
NUMERICAL INTEGRATION
Section 6. 3 Area and the Definite Integral Section 6
5. 7a Numerical Integration. Trapezoidal sums
Copyright © Cengage Learning. All rights reserved.
Classification of Differential Equations
Definite Integrals Finney Chapter 6.2.
Mixture Problems MAT 275.
Laplace Transforms of Discontinuous Forcing Functions
Higher-Order Linear Homogeneous & Autonomic Differential Equations with Constant Coefficients MAT 275.
Impulse Forcing Functions
The Area Question and the Integral
Laplace Transforms: Special Cases Derivative Rule, Shift Rule, Gamma Function & f(ct) Rule MAT 275.
TECHNIQUES OF INTEGRATION
Ch 8.6: Systems of First Order Equations
Limits of Riemann’s Sum
Sec 5.1: Areas and Distances
A Method For Approximating the Areas of Irregular Regions
Copyright © Cengage Learning. All rights reserved.
5. 7a Numerical Integration. Trapezoidal sums
Ch 5.4: Euler Equations; Regular Singular Points
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Numerical Integration
5.1 Areas and Distances Approximating the area under a curve with rectangles or trapezoids, and then trying to improve our approximation by taking.
Trigonometric Equations
Section 4 The Definite Integral
Presentation transcript:

Numerical Methods: Euler’s and Advanced Euler’s (Heun’s) Methods MAT 275

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu There exist many numerical methods that allow us to construct an approximate solution to an ordinary differential equation. In this section, we will study two: Euler’s Method, and Advanced Euler’s (Heun’s) Method. Euler’s Method: Given: A differential equation of the form 𝑑𝑦 𝑑𝑥 =𝑓(𝑥,𝑦), with initial condition 𝑦 0 =𝑦( 𝑥 0 ). Assume the solution exists over an interval 𝑥 0 ,𝑏 and subdivide this interval into equal subdivisions of length h (the “step size”). Thus, a typical subinterval will have the form 𝑥 𝑘 , 𝑥 𝑘+1 , or equivalently, 𝑥 𝑘 , 𝑥 𝑘 +ℎ . Integrate both sides with respect to x from 𝑥 𝑘 to 𝑥 𝑘 +ℎ: 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑑𝑦 𝑑𝑥 𝑑𝑥 = 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑓 𝑥,𝑦 𝑑𝑥 . (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu (Continued from last slide) 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑑𝑦 𝑑𝑥 𝑑𝑥 = 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑓 𝑥,𝑦 𝑑𝑥 𝑦 𝑥 𝑘 +ℎ −𝑦 𝑥 𝑘 = 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑓 𝑥,𝑦 𝑑𝑥 𝑦 𝑥 𝑘 +ℎ =𝑦 𝑥 𝑘 + 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑓 𝑥,𝑦 𝑑𝑥 Notation: We will call 𝑦 𝑘 the approximate value to 𝑦( 𝑥 𝑘 ), which represents an actual solution point of the differential equation. (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu We can approximate 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑓 𝑥,𝑦 𝑑𝑥 using rectangles (similar to Riemann Sums). So we replace 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑓 𝑥,𝑦 𝑑𝑥 with ℎ⋅𝑓( 𝑥 𝑘 , 𝑦 𝑘 ). Thus, we have the following formula for approximating solutions to a differential equation: 𝑦 𝑘+1 = 𝑦 𝑘 +ℎ⋅𝑓( 𝑥 𝑘 , 𝑦 𝑘 ). This is Euler’s Method. (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu Example: Find the approximate solutions of 𝑑𝑦 𝑑𝑥 =𝑥+𝑦 with 𝑦 0 =1. Use a step size of ℎ=0.1. Note: The initial condition is also written as 𝑥 0 =0 and 𝑦 0 =1. Also, 𝑓(𝑥,𝑦) represents the right side of the differential equation, so 𝑓 𝑥,𝑦 =𝑥+𝑦. It does not represent the solution to the differential equation. That is 𝑦=𝑦(𝑥), which is what we’re trying to approximate. Solution: The formula is 𝑦 𝑘+1 = 𝑦 𝑘 +ℎ⋅𝑓( 𝑥 𝑘 , 𝑦 𝑘 ). Thus, 𝑦 1 = 𝑦 0 +(0.1)⋅𝑓( 𝑥 0 , 𝑦 0 ) 𝑦 1 =1+(0.1)(0+1) 𝑦 1 =1+0.1 𝑦 1 =1.1. So now we have a new approximation point, 𝑥 1 , 𝑦 1 =(0.1,1.1). (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu So we repeat the process: 𝑦 2 = 𝑦 1 +0.1⋅𝑓( 𝑥 1 , 𝑦 1 ) 𝑦 2 =1.1+0.1(0.1+1.1) 𝑦 2 =1.1+0.1(1.2) 𝑦 2 =1.22 Now we have another approximation point, 𝑥 2 , 𝑦 2 =(0.2,1.22). 𝑦 3 = 𝑦 2 +0.1⋅𝑓 𝑥 2 , 𝑦 2 𝑦 3 =1.22+0.1(0.2+1.22) 𝑦 3 =1.362. Now we have 𝑥 3 , 𝑦 3 =(0.3, 1.362). (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu From last slide, we have 𝑥 3 , 𝑦 3 =(0.3,1.362)… 𝑦 4 = 𝑦 3 +0.1⋅𝑓( 𝑥 3 , 𝑦 3 ) 𝑦 4 =1.362+0.1(0.3+1.362) 𝑦 4 =1.5282. This gives us 𝑥 4 , 𝑦 4 =(0.4,1.5282). One more time: 𝑦 5 = 𝑦 4 +0.1⋅𝑓 𝑥 4 , 𝑦 4 𝑦 5 =1.5282+0.1(0.4+1.5282) 𝑦 5 =1.72102. This gives us 𝑥 5 , 𝑦 5 =(0.5,1.72102). (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu The five approximation points on the solution curve of 𝑑𝑦 𝑑𝑥 =𝑥+𝑦, 𝑦 0 =1 are: The actual solution of 𝑑𝑦 𝑑𝑥 =𝑥+𝑦, 𝑦 0 =1 is found by using an integration factor. It is 𝑦 𝑥 =−𝑥−1+2 𝑒 𝑥 . This is used to generate actual solutions of 𝑑𝑦 𝑑𝑥 =𝑥+𝑦, 𝑦 0 =1. (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu Here is the actual solution curve, 𝑦 𝑥 =−𝑥−1+2 𝑒 𝑥 : (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

Improved Euler’s Method (also called Heun’s Method) Instead of using rectangles to approximate 𝑥 𝑘 𝑥 𝑘 +ℎ 𝑓 𝑥,𝑦 𝑑𝑥 , we use trapezoids. A trapezoid with base h and heights 𝑓( 𝑥 𝑘 , 𝑦 𝑘 ) and 𝑓( 𝑥 𝑘+1 , 𝑦 𝑘+1 ) has area ℎ 2 𝑓 𝑥 𝑘 , 𝑦 𝑘 +𝑓 𝑥 𝑘+1 , 𝑦 𝑘+1 . Thus, the formula now becomes 𝑦 𝑘+1 = 𝑦 𝑘 + ℎ 2 𝑓 𝑥 𝑘 , 𝑦 𝑘 +𝑓 𝑥 𝑘+1 , 𝑦 𝑘+1 . (but there’s a problem…) (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu From the last slide, we have 𝑦 𝑘+1 = 𝑦 𝑘 + ℎ 2 𝑓 𝑥 𝑘 , 𝑦 𝑘 +𝑓 𝑥 𝑘+1 , 𝑦 𝑘+1 . The problem is … how do we approximate 𝑦 𝑘+1 on the left side when it’s also part of the formula on the right side? The answer is to replace it with the formula we used for Euler’s Method: 𝑦 𝑘+1 = 𝑦 𝑘 + ℎ 2 𝑓 𝑥 𝑘 , 𝑦 𝑘 +𝑓 𝑥 𝑘 +ℎ, 𝑦 𝑘 +ℎ⋅𝑓 𝑥 𝑘 , 𝑦 𝑘 . This is called the Improved Euler’s Formula. (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu Example: use the Improved Euler’s Method on 𝑑𝑦 𝑑𝑥 =𝑥+𝑦, 𝑦 0 =1, with a step side of ℎ=0.1, to find 𝑦 1 and 𝑦 2 . Solution: We have 𝑦 𝑘+1 = 𝑦 𝑘 + ℎ 2 𝑓 𝑥 𝑘 , 𝑦 𝑘 +𝑓 𝑥 𝑘 +ℎ, 𝑦 𝑘 +ℎ⋅𝑓 𝑥 𝑘 , 𝑦 𝑘 . Thus, 𝑦 1 = 𝑦 0 + 0.1 2 𝑓 𝑥 0 , 𝑦 0 +𝑓 𝑥 0 +0.1, 𝑦 0 +0.1⋅𝑓 𝑥 0 , 𝑦 0 𝑦 1 =1+0.05 0+1 + 0+0.1 + 1+0.1 0+1 𝑦 1 =1+0.05 1+0.1+1.1 =1.11 Recall that the other method gave 𝑦 1 =1.1 and the actual solution is 𝑦 0.1 =1.1103. Thus, we see that this method is already providing more precise approximations. (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

(c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu One more time… we have 𝑦 𝑘+1 = 𝑦 𝑘 + ℎ 2 𝑓 𝑥 𝑘 , 𝑦 𝑘 +𝑓 𝑥 𝑘 +ℎ, 𝑦 𝑘 +ℎ⋅𝑓 𝑥 𝑘 , 𝑦 𝑘 𝑦 2 = 𝑦 1 +0.05 𝑥 1 + 𝑦 1 + 𝑥 1 +0.1 + 𝑦 1 +0.1 𝑥 1 + 𝑦 1 Don’t forget that 𝑥 1 , 𝑦 1 =(0.1, 1.11) using the 𝑦 1 from the last slide. Thus, we obtain 𝑦 2 =1.11+0.05 0.1+1.11 + 0.1+0.1 + 1.11+0.1 0.1+1.11 This works out to 𝑦 2 =1.24205. Recall that Euler’s Method gave an approximation of 𝑦 2 =1.22, and that the actual solution was 𝑦 0.2 =1.2428. Again, we see better precision. (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu

Advantages & Disadvantages These methods allow you ways to find solution curves when the differential equation may not be solvable using analytical means. For example, it is impossible to find a “closed form” solution to 𝑦 ′ +2𝑥𝑦=1. If we know an initial condition, we can numerically find approximate solutions to the differential equation. The larger the step size, the approximations usually diverge faster from the actual solution. The smaller step sizes give better approximations, but require more calculations to cover a certain interval. Euler’s method is fast but not as precise, while the Improved Euler’s Method offers better precision, but takes more time. Suggestion: do not round any calculations at any steps. This adds in “error”, which is not desired since this is already an approximation technique. Write out all decimal places. Write out each formula, step by step, since it’s easy to get lost on each step. (c) ASU Math - Scott Surgent. Report errors to surgent@asu.edu