Euler Method

Solving ordinary differential equations appears frequently in engineering problems. Generally, there are no close form analytic solutions for most of ordinary differential equations. To solve these problems, scientists often use numerical techniques. The first order differential equation can be written in the general form as follows:

Using the Taylor series, the function y can be represented in the following form:

The Euler method use only up to the first order terms of the Taylor series to predict the next step:

or

Using first order Taylor series, the error of the above equation is O(h2). But in the next steps the error propagates because of the approximations produced in the previous steps. It can be shown that global truncation error of the Euler method is O(h). The algorithm of the Euler method is very easy and can written as follows:

 

Step 1: Choose initial point (x0,y0) and end point xn.

Step 2: For i=1 to n do steps 3,4.

Step 3: xi = x0 + ih.

Step 4: yi = yi-1 + hf(xi-1,yi-1).

Step 5: End.

 
Ordinary Differential Equations                              
            (Source Code in C++)                                                  

o        Euler Method                                                                                                       

o        Runge-Kutta Method                                                                                      
                                                                             
 
 

Comments