Numerical Methods

Solution of ODEs by Euler's Method

  Let us consider the general first order diffrential equation of the form:

`dy/dx=f(x,y)`.

with initial condition:  `y(x_0)=y_0`.

The solution of this type of equation can be obtained as a set of tabulated values for x and y using Euler's method. We intend to solve the above equation for `y` at points `x_r=x_0+rh, r=1,2,3,....`. To do so let us intgrate between the limits `x_0` and `x_1`.

$$ \begin{align} &\int_{y_0}^{y_1} dy = \int_{x_0}^{x_1}f(x,y) dx\\ \Rightarrow &y_1 = y_0+\int_{x_0}^{x_1}f(x,y) dx\\ \end{align} $$

Assuming that \( f(x,y)=f(x_0,y_0) \) in the range \(x_0 \le x \le x_1\), we get

$$ \begin{align} y_1 &=y_0+f(x_0,y_0)\int_{x_0}^{x_1}dx\\ \Rightarrow y_1 &=y_0+(x_1-x_0)f(x_0,y_0)\\[2mm] \Rightarrow y_1 &=y_0+hf(x_0,y_0)\\ \end{align} $$

Similarly, if `x_1<=x<=x_2`, we get,

$$ y_2=y_1+hf(x_1,y_1)$$

We can arrive at \(y_n\) using the general formula:

$$y_{n+1}=y_n+hf(x_n,y_n), n=0,1,2... $$