Euler
Euler
THEORY:
Euler method is one of the simplest method to solve the ordinary differential equations. Consider a
first order differential equation,
ⅆy
= y '=f ( x , y )
ⅆx
The taylor series expansion for y(x) is given as:
y(x0+h) = y(x0) + h y’(x0) + ………..
Let x1=x0+h and neglecting the second and higher order terms in taylor series expansion we get,
y(x1) = y(x0) + h f (x0, y0)
Similarly, at x2 = x1+h ,y(x2) is given as:
y(x2) = y(x1) + h f (x1, y1)
Similarly, all other points can be calculated. In general, it is given as:
y(xn)= y(xn-1) + h f (xn-1, yn-1)
The above method to solve differential equation is known as Euler method. Here, to find values of y n
at any xn we require initial conditions x0 and y0, therefore this method is also known as initial value
method.
Euler method is very simple method to solve but it’s accuracy is not too good. In many cases the
results are unacceptably poor. This happens so because we have taken the terms only upto the first
order derivative in taylor series expansion of y(x). The curvature of the function is not taken into
consideration in this scheme by neglecting the higher order terms of taylor series expansion. Other
schemes such as higher order Runge Kutta method can be used for increased accuracy.
PROGRAM:
#include<iostream>
#define f(x,y) y-x/y+x
int main()
{
float x0, y0, xn, h, yn, slope;
int i, n;
return 0;
}
OUTPUT: