Module for Euler's Method for O.D.E.'s

Check out the new Numerical Analysis Projects page.

 

    The first method we shall study for solving differential equations is called Euler's method, it serves to illustrate the concepts involved in the advanced methods. It has limited use because of the larger error that is accumulated with each successive step.  However, it is important to study Euler's method because the remainder term and error analysis is easier to understand.

    Let [Graphics:Images/EulerMod_gr_1.gif] be the interval over which we construct the solution to the well-posed I. V. P. (initial value problem) [Graphics:Images/EulerMod_gr_2.gif] with [Graphics:Images/EulerMod_gr_3.gif].  Actually, we will not find a differentiable function that satisfies the I. V. P.  Instead, a discrete set of points  [Graphics:Images/EulerMod_gr_4.gif]  is generated, and the points are used for an approximation (i.e. [Graphics:Images/EulerMod_gr_5.gif]).  How do we proceed to construct a "set of points" that will "satisfy a differential equation approximately"? First we choose the abscissa's for the points.  For convenience, we subdivide the interval [Graphics:Images/EulerMod_gr_6.gif] into m equally spaced subintervals and select the mesh points

         [Graphics:Images/EulerMod_gr_7.gif]  where  [Graphics:Images/EulerMod_gr_8.gif].  

The value h is called the step size, [Graphics:Images/EulerMod_gr_9.gif].  For notation purposes, we let [Graphics:Images/EulerMod_gr_10.gif], and proceed to solve approximately

        [Graphics:Images/EulerMod_gr_11.gif]  over  [Graphics:Images/EulerMod_gr_12.gif]with   [Graphics:Images/EulerMod_gr_13.gif].  

    We assume that [Graphics:Images/EulerMod_gr_14.gif] are continuous and expand [Graphics:Images/EulerMod_gr_15.gif] in a Taylor series about [Graphics:Images/EulerMod_gr_16.gif].  For each value [Graphics:Images/EulerMod_gr_17.gif] there exists a value [Graphics:Images/EulerMod_gr_18.gif] that lies between [Graphics:Images/EulerMod_gr_19.gif] so that  

        [Graphics:Images/EulerMod_gr_20.gif][Graphics:Images/EulerMod_gr_21.gif].  

Using the substitutions [Graphics:Images/EulerMod_gr_22.gif] and  [Graphics:Images/EulerMod_gr_23.gif],  we get an expression for [Graphics:Images/EulerMod_gr_24.gif]:  

        [Graphics:Images/EulerMod_gr_25.gif][Graphics:Images/EulerMod_gr_26.gif].

If the step size h is chosen small enough, then we may neglect the second-order term (involving [Graphics:Images/EulerMod_gr_27.gif]) and get

        [Graphics:Images/EulerMod_gr_28.gif],

which is Euler's approximation. (Note that [Graphics:Images/EulerMod_gr_29.gif] is an approximation to [Graphics:Images/EulerMod_gr_30.gif].

    The process is repeated and generates a sequence of points that approximates the solution curve [Graphics:Images/EulerMod_gr_31.gif].  

Algorithm (Euler's Method)  The general step for Euler's method is

         [Graphics:Images/EulerMod_gr_32.gif],  and  [Graphics:Images/EulerMod_gr_33.gif]  for  [Graphics:Images/EulerMod_gr_34.gif].  

Error analysis for Euler's Method  

    When we obtained the formula  
[Graphics:Images/EulerMod_gr_35.gif]  for Euler's method, the neglected term for each step has the form [Graphics:Images/EulerMod_gr_36.gif].  If this was the only error at each step, then at the end of the interval [Graphics:Images/EulerMod_gr_37.gif], after [Graphics:Images/EulerMod_gr_38.gif] steps have been made, the accumulated error would be

    
[Graphics:Images/EulerMod_gr_39.gif][Graphics:Images/EulerMod_gr_40.gif][Graphics:Images/EulerMod_gr_41.gif].  

The error is more complicated, but this estimate predominates.

Theorem (Precision of Euler's Method)  Assume that  [Graphics:Images/EulerMod_gr_42.gif]  is the solution to the I.V.P.  [Graphics:Images/EulerMod_gr_43.gif]  with  [Graphics:Images/EulerMod_gr_44.gif].  If  [Graphics:Images/EulerMod_gr_45.gif]  and  [Graphics:Images/EulerMod_gr_46.gif]  is the sequence of approximations generated by Euler's method, then the global error [Graphics:Images/EulerMod_gr_47.gif] and local error [Graphics:Images/EulerMod_gr_48.gif] are expressed in the following relationships,

    
[Graphics:Images/EulerMod_gr_49.gif],  
and
    
[Graphics:Images/EulerMod_gr_50.gif][Graphics:Images/EulerMod_gr_51.gif].


The error at the right end of the interval is called the final global error (F.G.E.)

    
[Graphics:Images/EulerMod_gr_52.gif].  

Remark.  The global truncation error  [Graphics:Images/EulerMod_gr_53.gif]  is used to study the behavior of the error for various step sizes.  It can be used to give us an idea of how much computing effort must be done to obtain an accurate approximation.

 

Numerical methods used in this module.  Use Euler's method and the modified Euler's method. Construct numerical solutions of order  [Graphics:Images/EulerMod_gr_54.gif]  and  [Graphics:Images/EulerMod_gr_55.gif], respectively.  The theory for the modified Euler method is not presented at this time, we are to trust that its development is similar, but the order for the error is better and is known to be [Graphics:Images/EulerMod_gr_56.gif].   

    The subroutines  Euler and MEuler will be used.

Animations (Euler's Method  Euler's Method).  Internet hyperlinks to animations.

 

Program (Euler's Method).  To compute a numerical approximation for the solution of the initial value problem [Graphics:Images/EulerMod_gr_57.gif] with [Graphics:Images/EulerMod_gr_58.gif] over [Graphics:Images/EulerMod_gr_59.gif] at a discrete set of points using the formula [Graphics:Images/EulerMod_gr_60.gif].

Mathematica Subroutine (Euler's Method).

[Graphics:Images/EulerMod_gr_61.gif]

Animations (Modified Euler's Method  Modified Euler's Method).  Internet hyperlinks to animations.

 

Program (Modified Euler's Method).  To compute a numerical approximation for the solution of the initial value problem [Graphics:Images/EulerMod_gr_62.gif] with [Graphics:Images/EulerMod_gr_63.gif] over [Graphics:Images/EulerMod_gr_64.gif] at a discrete set of points using the formula [Graphics:Images/EulerMod_gr_65.gif].

Mathematica Subroutine (Modified Euler's Method).

[Graphics:Images/EulerMod_gr_66.gif]

Example 1.  Solve the I.V.P.  [Graphics:Images/EulerMod_gr_67.gif].  

Solution 1.

Example 2.  Use Mathematica to find the analytic solution and graph for the I.V.P.  [Graphics:Images/EulerMod_gr_81.gif].  

Solution 2.

Example 3.  Plot the error for Euler's method and the modified Euler's method.

Solution 3.

Example 4.  Reduce the step size by  [Graphics:Images/EulerMod_gr_107.gif] and see what happens to the error.
Recalculate points for Euler's method, the Modified Euler's method, and the analytic solution using n = 30.
Then Plot the error for Euler's method and the Modified Euler's method.

Solution 4.

 

Old Lab Project (Euler's Method for O.D.E.'s  Euler's Method for O.D.E.'s).  
Internet hyperlinks to an old lab project.  

 

Research Experience for Undergraduates

Euler's Method for O. D. E.'s  Euler's Method for O. D. E.'s  
Internet hyperlinks to web sites and a bibliography of articles.  
 

Downloads (Euler's Method for O. D. E.'s Euler's Method for O. D. E.'s).  
Download this Mathematica notebook.  

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2003