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(h). The algorithm of the Euler method is very easy and can written as follows:
x_{n}.
(Source Code in C++) |