EULER’S METHOD

INTERACTIVE E-BOOK

Ordinary Differential Equations

MAJOR

GENERAL

 On non Internet Explorer browsers, the equations may not show up.

As an alternative or if you prefer,

you can see the pdf version of the ebook instead

Title

An interactive e-book for illustrating Euler’s Method of solving ordinary differential equations

Creator

Autar K Kaw

Subject and Keywords

Euler’s Method, Ordinary Differential Equations, Mathcad, Maple, Mathematica, Matlab, Simulations.

Description

This is an interactive E-book for illustrating Euler’s Method for solving ordinary differential equations.  It includes links to examples, simulations in Mathcad, Maple, Mathematica, and Matlab for the algorithm, convergence, and a PowerPoint presentation.

Publisher

Holistic Numerical Methods Institute,

College of Engineering,

University of South Florida, Tampa, FL 33620-5350.

Contributors

Autar Kaw

Format

Text/HTML

Last Revised

May 4, 2006

Identifier

http://numericalmethods.eng.usf.edu/ebooks/euler_08dif_ebook.pdf

Language

English

Rights

http://numericalmethods.eng.usf.edu/rights.htm

 

Table of Contents

Background

           What are ordinary differential equations?          

           A Primer on Ordinary Differential Equations

           Euler’s Method for Ordinary Differential Equations

           PowerPoint presentation

Examples

            Example 1:  First order differential equation rewritten in dy/dx=f(x,y) form

            Example 2:  First order differential equation rewritten in dy/dx=f(x,y) form

            Example 3:  Heat transfer problem solved using Euler’s method

Simulation of Euler’s Method ([MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB])

Convergence Simulation of Euler’s Method ([MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB])

Back to TOC

Background

This is an example of how an instructor of a Numerical Methods course can develop an E-book on a single topic by using resources that are only available at the Holistic Numerical Methods Institute (HNMI) Website.

Although one of the primary advantages of a web-based resource is that one can use documents outside of its own domain, we are particularly using this example as a way to illustrate the holistic nature of the resources available at HNMI.   You are welcome to modify and edit this e-book to suit your purpose.

Using the textbook document written in MS Word 2000 as a foundation, it was made interactive within MS Word 2000 by putting bookmarks and hyperlinks to background information, PowerPoint presentations, Mathcad simulations, historical anecdotes, multiple choice tests, problem sets, etc.   Then the MS Word 2000 file was saved as a webpage and that is what you are about to read here.

Back to TOC

 

Euler’s Method for Ordinary Differential Equations

 

Euler’s method is a numerical technique to solve ordinary differential equations of the form

                                                                                                (1)

So only first order ordinary differential equations can be solved by using Euler’s method.  In other sections, we will discuss how Euler’s method is used to solve higher order ordinary differential equations or coupled (simultaneous) differential equations.

            How does one write a first order differential equation in the above form?

 

Back to TOC

Example 1

           

is rewritten as

           

In this case

           

 

Another example is given as follows:

 

Back to TOC

Example 2

           

is rewritten as

           

In this case

           

 

 

At , we are given the value of   Let us call  as .  Now since we know the slope of with respect to , that is, , then at , the slope is .  Both and  are known as they from the initial condition.

 

Figure 1.  Graphical interpretation of the first step of Euler’s method

 

So the slope at x=x0 as shown in Figure 1 is

            Slope

                    

                    

From here

           

Calling as a step size, we get

            .                                                                                     (2)

One can now use the value of  (an approximate value of at) to calculate , and that would be the predicted value at ,

           

           

Based on the above equations, if we now know the value of  at , then

                                                                                                 (3)

This formula is known as the Euler’s method and is illustrated graphically in Figure 2.  In some books, it is also called the Euler-Cauchy method.

Figure 2. General graphical interpretation of Euler’s method

Simulation of Euler’s Method ([MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB])

Convergence Simulation of Euler’s Method ([MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB])

Back to TOC

Example 3

A ball at 1200K is allowed to cool down in air at an ambient temperature of 300K.  Assuming heat is lost only due to radiation, the differential equation for the temperature of the ball is given by

             

Find the temperature at seconds using Euler’s method.  Assume a step size of   seconds.

Solution

           

           

Per equation 3, the Euler’s  method reduces to 

           

For , ,

           

                

                

                

                

 is the approximate temperature at

           

           

For , ,

           

                

                

                

                

 is the approximate temperature at

                

           

Figure 3 compares the exact solution with the numerical solution from Euler’s method for the step size of h=240.

Figure 3.  Comparing exact and Euler’s method

 

 

 

 

 

 

 

 

 

 

 

 

h=240

 

The problem was solved again using a smaller step size.  The results are given below in Table 1.

 

Table 1.  Temperature at 480 seconds as a function of step size, h

Step size,

480

240

120

60

30

 

-987.81

110.32

546.77

614.97

632.77

 

1635.4

537.26

100.80

32.607

14.806

 

252.54

82.964

15.566

5.0352

2.2864

 

Figure 4 shows how the temperature varies as a function of time for different step sizes

Figure 4.  Comparison of Euler’s method with exact solution for different step sizes

 

while the values of the calculated temperature at t=480s as a function of step size are plotted in Figure 5.

                  

Figure 5.  Effect of step size in Euler’s method.

 

 

The exact solution of the ordinary differential equation is given by the solution of a non-linear equation as

         (4)

The solution to this nonlinear equation is

           

It can be seen that Euler’s method has large errors.  This can be illustrated using Taylor series.

       (5)

               (6)

As you can see the first two terms of the Taylor series

           

are the Euler’s method.

The true error in the approximation is given by

                                                                        (7)

The true error hence is approximately proportional to the square of the step size,  that is, as the step size is halved, the true error gets approximately quartered.  However from Table 1, we see that as the step size gets halved, the true error only gets approximately halved.  This is because the true error being proportioned to the square of the step size is the local truncation error, that is, error from one point to the next.  The global truncation error is however proportional only to the step size as the error keeps propagating from one point to another.

Back to TOC