Explicit Euler Method

Hasi
2 min readAug 4, 2021

Numerical Analysis in Python

This method was originally devised by Euler. Let’s start with a general first order initial value problem.

To approximate the solution to equation (1) near $t=t_0$ . We start with the two bits of information that we do know about the solution. First, we know the value of the solution at $t=t_0$ from the initial condition. Second, we know the value of the derivative at $t=t_0$. We can get this by plugging the initial condition into f(t,y) into the differential equation itself. So, the derivative at this point is.

Now, recall from Calculus-I class that this information are enough for us to write down the equation of the tangent line to the solution at t=t_0. If t_1 is close enough to t_0 then the point y_1 on the tangent line should be fairly close to the actual value of the solution at t_1, or y(t_1). Finding y_1 is easy enough. All we need to do is plug t_1 in the equation for the tangent line.

It generalizes to:

Python Implementation

Line 1–2: Set the differential equation y’(x) = y(x)

Line 4–5: Declares initial values of the problem

Line 6: Declares step size

Line 7: Sets number of Iterations

Line 9: Find slope of tangent line

Line 10–14: Get next point from tangent line

--

--