19 julio, 2024

Euler’s method: what it is, what it is for, solved exercises

What is Euler’s method?

He Euler’s method It is the most basic and simplest of the procedures used to find approximate numerical solutions to a first-order ordinary differential equation, provided its initial condition is known.

An ordinary differential equation (ODE) is the equation that relates an unknown function of a single independent variable to its derivatives.

If the largest derivative that appears in the equation is of degree one, then it is an ordinary differential equation of the first degree. The most general way to write a first degree equation is:

with the initial condition:

x = x0

y = y0

What is Euler’s method?

The idea of ​​Euler’s method is to find a numerical solution to the differential equation in the interval between X0 and Xf .

First, the interval is discretized in n+1 points:

x0, x1, x2, x3…, xn

Which are obtained like this:

Where h is the width or step of the subintervals:

The greater the number n, the more precise the result will be, but the greater number of points will be needed to cover the interval where we are looking for the solution and the computation time grows.

With the initial condition, then it is also possible to know the derivative at the beginning:

y’ (xo) = f (xo, i)

This derivative represents the slope of the tangent line to the curve of the function y(x) precisely at the point:

Ao = (xo, me)

Then an approximate prediction is made of the value of the function y(x) at the following point:

y(x1) ≈ y1

y1 = i +(x1– xo) f (xo, i) = i + hf (xo, i)

The next approximate point of the solution has then been obtained, which would correspond to:

A1 = (x1, y1)

The procedure is repeated to obtain the successive points

A2, A3…, xn

solved exercises

Exercise 1

Yo) Let the differential equation be:

With the initial condition x=a= 0; already= 1

Using Euler’s method, find an approximate solution of and at coordinate X = b = 0.5, subdividing the interval [a , b] in n = 5 parts.


The numerical results are summarized as follows:

From where it is concluded that the solution Y for the value 0.5 is 1.4851.

Note: to carry out the calculations, we have used SmathStudioFree, free to use program.

Exercise 2

II) Continuing with the differential equation of exercise I), find the exact solution and compare it with the result obtained by Euler’s method. Find the error or difference between the exact and the approximate result.


With the initial condition x=a= 0; already= 1
The exact solution is not very difficult to find. It is known that the derivative of the function sin(x) is the function cos(x). Therefore, the solution y(x) will be:

y(x) = sin x + C

For the initial condition y(0) = 1 to be fulfilled, the constant C must be equal to 1. Next, the exact result is compared with the approximate one:

It is concluded that in the calculated interval, the approximation has three significant figures of precision.

Exercise 3

II) Consider the differential equation and its initial conditions given below:

y'(x) =- y2

With the initial condition x0 = 0; y0 = 1

Use Euler’s method to find approximate values ​​of the solution y(x) in the interval x = [0 , 1.5 ]. use step h=0.1.


Euler’s method is very suitable for use with a spreadsheet. In this case we will use the spreadsheet of geogebra, a free and free to use program.

In the spreadsheet of the figure three columns are shown (A,B,C) the first is the variable x the second column represents the variable andand the third column the derivative and’.

Row 2 contains the initial values ​​of x, AND, AND’.

The value step 0.1 has been placed in the absolute position cell ($D$4).

The initial value of y0 is in cell B2, and y1 is in cell B3. To calculate y1 the formula is used:

y1 = i +(x1– xo) f (xo, i) = i + hf (xo, i)

This spreadsheet formula would be Number B3: =B2 + $D$4 * C3.

Similarly, y2 would be in cell B4 and its formula is shown in the following figure:

The figure also shows the graph of the exact solution, and the points A, B, …, P of the approximate solution using Euler’s method.

Newton’s dynamics and Euler’s method

Classical dynamics was developed by Isaac Newton (1643-1727). The original motivation of Leonard Euler (1707-1783) to develop his method was precisely to solve the equation of Newton’s second law in various physical situations.

Newton’s second law is usually expressed as a quadratic differential equation:

Where x represents the position of an object at the instant you. This object has a mass m and is subjected to a force F. The function F is related to force and mass as follows:

Although Euler’s method was initially intended to solve first degree differential equations, it is easily extensible to the second degree case, since it is equivalent to a system of two first degree equations.

To apply Euler’s method, the initial values ​​of time are required. youspeed v and position x.

The following table explains how, starting from initial values ​​t1, v1, x1, an approximation of the velocity v2 and the position x2 can be obtained at the instant t2=t1+Δt, where Δt represents a small increment and corresponds to the step in the method of euler.

Exercise 4

IV.) One of the fundamental problems in mechanics is that of a block of mass M attached to a spring (or spring) of elastic constant K.

Newton’s second law for this problem would be like this:

In this example, to simplify, we will take M=1 and K=1. Find approximate solutions to the position x and the speed v by Euler’s method on the time interval [0 , π/2] subdividing the interval into 12 parts.

Take 0 as the initial instant, initial velocity 0, and initial position 1.


The numerical results are shown in the following table:

Graphs of position and velocity between times 0 and 1.44 are also shown.

Proposed exercises for home

Exercise 1

Use a spreadsheet to determine an approximate solution using Euler’s method for the differential equation:

y’ = – Exp( -y) with initial conditions x=0, y=-1 on the interval x =[0 , 1]

Start with a step of 0.1. Graph the result.

Exercise 2

Using a spreadsheet, find numerical solutions to the following quadratic equation, where y is a function of the independent variable t.

y» = – 1/y² with the initial condition t=0 ; y(0)= 0.5 ; y'(0)=0

Find the solution in the interval [0,5 ; 1,0] using a step of 0.05.

Plot the result: y vs t ; and’ vs you


Euler’s method. Retrieved from es.wikipedia.org.
Euler solver. Retrieved from en.smath.com.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *