Derivation of Euler's method of Solving ODEs
|
In this segment we'll talk about
the Euler’s method of solving ordinary differential equations. We'll
concentrate on the theory aspect of it. So, Euler’s method works for
solving first order ordinary differential equations of the form as follows. So,
what that means is that it has to be a first order ordinary differential
equation. It has to be written in the form that the slope is of the dependent
variable with respect to the independent variable is given as a function of x
comma y and then of course you have to have some initial condition so as to
be able to solve for y at other points. Now this can be a little bit
challenging to a student who has seen this for the first time because they're
generally familiar with the regular format So, let's take an example you
might be given a differential equation like this from your ordinary
differential equations course, and you might say that hey how do I write it
in this particular format right here all you have to do is to just rewrite it
you'll say three dy by dx is equal to this quantity.
Right, and then you will say dy by dx is equal to
this quantity and this becomes your function of x comma y. Along with the
condition that you need which is y sub 0 to be 3 in this case and that's
about it. So rewriting your differential equation as generally given into
this format is pretty straightforward and the reason why you do that is
because what Euler’s method is based on or many of the other methods are
based on is that if you know the approximate value of y at a particular point
and an approximate value of the derivative of the dependent variable respect
to the independent variable first slope first derivative at that particular
point then you can approximately find the value of y at some other point. Let's do this graphically first.
The whole point about solving differential equation, which is of this form
let's suppose, is that you want to find y as a
function of x. That's the ultimate goal of solving an ordinary differential
equation. The only thing which will be different from your ODE class would be
that will you find the value of y at discrete points as opposed to as a
continuous function. So, what we're going to do is we are going to say hey
let's suppose I know that this is let's suppose x0. If this is x0, I know the
value of y which will be y0 here because that is given to me as an initial
condition. Then let's suppose the y as a function of x is exactly known may
look like that. But keep in mind that when I’m saying hey it's exactly known I
don't know it because that's why I’m trying to solve the ordinary differential
in the first place. but this is just for illustration purposes. But I know
the value of the slope at this particular point. I know the value of the
slope at that particular point because I have written my differential
equation in this format that the slope is given by the function f and so if I
draw the slope and then I take the point x1 that gives me the approximate
value of y then at that particular point. So that'll become x1 comma y1 as my
coordinate there and y1 will be the approximate value of y at x1. Then I can
take this, draw the slope here now keep in mind the slope will be approximate
because now I know the value of y only approximately so when I’m going to
substitute in here, I’ll have the exact value of x, but I don't have the
exact value of y. But I will get some approximate value of the slope there
and then I can go ahead and say okay hey this is x2 so that is the y2 value
will be the y-coordinate of that and what y2 will represent is the
approximate value of y at x. So that's what the Euler’s method is all about
and what we're going to do is we're going to develop a general formula for it
in the next slide. Let's go and talk about how we
can find the general form for the Euler’s method and given that the format of
the ordinary differential equation is given as this with the initial
condition given at x0. So, if we look at it from a graphical point of view,
let's suppose we are at some point x sub i. So, we’ve
already gone through several steps now as shown in the previous slide and
let's suppose we’re at the x sub i point. So, we
know that at this particular point we will know some value of y corresponding
to x of i. Now if I draw the slope at this
particular point what will happen is that if I then choose the next point x
of I plus 1, this one gives me the approximate value of y at that particular
point. So, the question is that hey, maybe because I know the slope of the
function at this particular point, because that's how the differential
equation has been portrayed to me, how will I find y sub i
plus 1? So, if you look at this distance right here, that will be y sub i plus 1 minus y sub i because
this one is y sub i plus 1 and this one is y sub i and if you look at this difference right here that is x
sub i plus 1 minus x sub i.
So that basically becomes, hey this is the rise, and this is the run. So, we
have rise over run will be equal to the slope of y
with respect to x at that point x sub i. Now what
is the rise? We just calculated as y sub i plus 1
minus y sub i. The run is x sub i
plus 1 minus x sub i and the slope of y with respect
to x sub i is nothing but the function f at that
particular point which will have the value of x sub i
and this approximate value of y sub i. So, since we
have that, that means that the only unknown now here is y sub i plus 1 because x sub i and x sub
i plus 1 is something which we chose. They are
independent variables y sub i is known from the
previous step so let's go and calculate what y five plus one would be. y sub i plus one minus y sub i will
be equal to this quantity right here. And if I want to just write the
expression for y sub i plus 1 it will turn out to
be this. So many times, what they do is they call this the step size, so they
call it h and they call it the step size and they rewrite the Euler’s method
formula as y sub i plus 1 equals y sub i plus this quantity right here times h. And that's what Euler’s method
is all about that, hey, if you know the value of the dependent variable y at
a particular point and you know its slope. Slope is the function f at that
particular point some approximate value and you know the step which you are
taking then you can find the value of y at that particular point And that is the end of this
segment. |