Euler method

This online calculator implements Euler's method, which is a first order numerical method to solve first degree differential equations with a given initial value.

You can use this calculator to solve first degree differential equations with a given initial value, using Euler's method.

To use this method, you should have a differential equation in the form
y \prime = f(x,y)
You enter the right side of the equation f(x,y) in the y' field below.

You also need the initial value as
y(x_0)=y_0
and the point x for which you want to approximate the y value.

The last parameter of the method – a step size – is literally a step along the tangent line to compute the next approximation of a function curve.

If you know the exact solution of a differential equation in the form y=f(x), you can enter it as well. In this case, the calculator also plots the solution along with the approximation on the graph, and computes the absolute error for each step of the approximation.

A method explanation can be found below the calculator.

PLANETCALC, Euler method

Euler method

Digits after the decimal point: 2
Differential equation
 
Approximate value of y
 
Approximation
The file is very large. Browser slowdown may occur during loading and creation.

Euler method

So, let's suppose we have the following
y \prime = f(x,y) \\ y(x_0)=y_0

If we calculate
f(x_0,y_0)

we will find the derivative y' at the initial point.

For sufficiently small \Delta x, we can approximate the next value of y as
y(x_0+\Delta x)=y(x_1)=y_0+\Delta y=y_0+y \prime |_{x=x_0} \Delta x=y_0+f(x_0,y_0)\Delta x

Or, shorter
y_1=y_0 + f_0 \Delta x

And in the general case
y_{i+1}=y_i + f_i \Delta x

We continue to calculate the next y values using this relation until we reach target x point.

This is the essence of Euler's method. \Delta x is the step size. The error on each step (local truncation error) is roughly proportional to the square of the step size, so the Euler method is more accurate if the step size is smaller. However, global truncation error is the cumulative effect of the local truncation errors and is proportional to the step size, and that's why the Euler method is said to be a first order method.

More complicated methods can achieve a higher order (and more accuracy). One possibility is to use more function evaluations. This is illustrated by the Midpoint method

URL copied to clipboard
PLANETCALC, Euler method

Comments