ode_euler, a Python code which applies the Euler method to estimate the solution of an ordinary differential equation (ODE) y'=f(x,y), over the interval [a,b], with initial condition y(a)=ya, using n steps.

The user enters a formula for f(x), the values of a and b, the initial condition ya, and the value of n.

The program divides [a,b] into n equal intervals, and takes n steps. It returns arrays xp and yp containing n+1 pairs of values that can be plotted.


The computer code and data files made available on this web page are distributed under the MIT license


ode_euler is available in a MATLAB version and a Python version.

Related Data and Programs:

Source Code:

Last revised on 30 January 2020.