# CREATE OWN LIBRARY

## Euler Method

Back to Programming

### Description

Euler method is used to solve the differential equation. Euler method yields solutions in the form of numerical values of y for discrete values of x at specified intervals. It is based on the idea of linear approximation in which small tangent lines on a short distance are used to get the approximate solution to the initial-value problem.

DERIVATION

In order to solve the first-order differential equation:

The solution starts from the initial value  at  and in the first step it is taken as  and then the value of ${\mathrm{y}}_{1}$ of the solution is computed. Using this value of ${\mathrm{y}}_{1}$the next value ${\mathrm{y}}_{2}$ is computed at

In a similar way, the value of y is carried out at the discrete values of x

Each step of the Euler method is performed using a formula which is derived from Taylor’s series as follows:

Now we take p = 1, which gives

Therefore,

So, in general, we can say that:

These successive values are calculated using recursion relation.

GRAPHICAL REPRESENTATION

### Algorithm

INPUT:

A function f(x)

OUTPUT:

The value after differentiating f(x)

PROCESS:

``````Step 1: [Defining f(x,y)]
return x × y

Step 2: [Euler Method]
Read the values of x0, y0 i.e. the initial values to calculate the differentiation.
Read h(the step length)
Read xn(the ending value to terminate the calculation)
While x0 ≤ xn repeat
Set y1 ← y0 + h × f(x0,y0)
Print x0, y0
Set x0 = x0 + h
Set y0 = y1
[End of ‘while’]
[End of ‘Euler’ method]``````

### Code

ADVANTAGES

1. It is the easiest method to solve the differential equation in numerical.

2. It can be used for any nonlinear IVPs.

DISADVANTAGES

1. It is less accurate.

2. This method is numerically unstable.

3. In this case the approximation is proportional to the step size h. so h is to be taken as very small.

APPLICATION

1. It is helpful in estimating the force-deformation in the non-linear range.

2. It is used in solving ODEs.