Euler’s method – Mathematical Modelling – Mathematics – TU Delft

Welcome back! In this video you will learn how you can approximate
the solution of a differential equation with Euler’s Method. Let us consider first the differential equation
for the rainbowfish population with limited growth
and harvesting, and an initial value of 30. The direction field and some possible sketches
of the solution are like this. As you can see, each of the sketches starts
at 30 rainbowfish and follows the direction field, but each comes close to the equilibrium
of 720 at a different time. But which one is the correct sketch? So, how long will it take to reach the equilibrium? To be able to answer this question, we are
going to approximate the solution using Euler’s Method. First we take a closer look at the differential
equation. The left hand side of the differential equation
is the derivative of the function P with respect to time. The right hand side is a function of the population
size P and time. Of course, this right hand side function can
be different for other differential equations, and the unknown function can be something
other than a population size. So let us consider this general differential
equation for a function y of t. The right hand side is now a function of time
t and the function y of t. We are interested in the function y at some
time t. So to obtain the function y of t itself, we
can integrate the left hand side. Of course, we should do the same on the right
hand side of the differential equation. So let us integrate the differential equation
over a time period from zero to Delta t. Delta t is some number representing the time
interval over which we integrate. So Delta t could be, for example, 2 days or
4 seconds. Using the fundamental theorem of calculus,
the left hand side simplifies to y at time Delta t, minus y at time zero. We know the value of y at zero, because this
is the initial value. The left hand side has become quite easy,
but the right hand side still contains an integral … what should we do? If you want to integrate the right hand side
function over time t, you must know the function y of t, but this is exactly the thing you
do not know yet … So you must do something else… First focus only on the right hand side function. If you would know y of t, we could make a
graph of the right hand side as a function of time, which could look something like this,
or like this, or like this… The integral from zero to Delta t over time
t would then be this area under the curve. This area we do not know,.. maybe we can approximate this area
in some way using information we do know. At time zero you do know something: the initial
value, y at time zero equals y_0. For this initial value you can calculate the
value of the right hand side function. Because you only know this value of the function
f, you can approximate the value of the integral by Delta t, times f at zero and y(0),.. also shown in the graph. So what do we have now? We have that y at Delta t, minus y at zero
is approximately Delta t, times f at zero and y(0). y at zero is given as the initial value, so
you can rearrange this equation to y at Delta t is approximately y at zero, plus Delta t,
times f at zero and y(0). This equation is the first step of Euler’s
Method. So what’s next? Let us do another step forward in time of
length Delta t. So let us integrate the differential equation
over time from Delta t to 2 times Delta t. The left hand side is easily calculated to
be y at 2 times Delta t, minus y at Delta t. Again the integral on the right can be approximated using the time equal to Delta t and y equal to y at Delta t. This is no problem, because you know an approximation
of this value from the first step of Euler’s Method. Calculating the approximated integral and
rearranging gives the second step of Euler’s Method. You can continue doing steps forward in time
in the same manner. The third step of Euler’s Method would become
this approximation, the fourth step like this, and if you continue, a general step of Euler’s
method would look like this: The value of y after n+1 time steps of size Delta t is
approximately equal to y after n steps of Delta t, plus Delta t times the value of the
right hand side function after n steps of Delta t. If you perform a few steps yourself, you obtain
a list of approximations of the function y at several consecutive times, all Delta t
apart. Now it is time for you to do a few steps yourself
with Euler’s Method!