In the last sub unit I introduced qualitative,
or geometric techniques, for solving differential equations.
We saw that, with the graph of the right hand side of the equation,
we could figure out the phase line
and get a general picture for what solutions look like.
In this sub unit, I'll present another way of solving differential equations
these are sometimes called numerical solutions
but I like to think of them as computational, or algorithmic solutions.
I like these methods a lot - they're very versatile,
they're very commonly used,
and they get at the heart of what differential equations are
from a dynamical systems point of view.
So, I'll present this material in three parts:
first, I'll give an overview of the computational methods,
then in the second part, which is optional,
I'll go in to those methods in some detail
so that you could code them up for yourself, if you wanted,
and then in the third part of this sub unit,
I'll summarize, take a step back,
and compare and contrast a number of different solution methods.
The computational method that I'd like to present
is known as Euler's method.
Let's return to the example that we started with:
Newton's Law of Cooling - this describes
the rate of change of the temperature
capital T is temperature, little t is time,
of an object that is originally at 5 degrees,
that's placed in a 20 degree room.
We'd like to know the temperature at later times
we would really like to have capital T as a function of time,
but in this approach
I'll try to estimate capital T, the temperature,
at 2 minutes, 4 minutes, 6 minutes, and so on.
So, we start - where else can we start - at the beginning.
We know that the temperature is 5,
and we have this differential equation - this rule,
so I can use these two facts to figure out
how fast the temperature is changing,
at the initial time, when T equals 5,
that's what this differential equation does,
it tells me - if I know the temperature,
it tells me how fast the temperature is changing,
so let's do that.
So, I use the equation, defined dT/dt,
the rate change of the temperature, at the initial time.
So, I just ask the equation - by plugging in 5,
so, capital T is 5, 20 minus 5 is 15,
times 0.2, gives me 3 degrees per minute.
So, this is how fast the object is initially warming up
so I can use this rate to figure out the temperature at a later time,
- uh oh - but there's a problem, which is that this rate is not constant,
the rate is always changing,
as soon as a temperature changes, a little bit,
the derivative changes, the rate changes a little bit,
so, we're in a bit of a dilemma.
So, we have a problem: the rate is not constant,
so, we have to cope with this problem somehow,
and the coping mechanism that we use in Euler's method
is just to ignore the problem - we'll just pretend that it is constant
for, let's say, a 2 minute interval.
So, we'll pretend that this rate is constant for 2 minutes,
it's not, but we're just going act as if it is,
and if this rate is constant for these 2 minutes,
then, I can figure out the temperature 2 minutes later.
OK, so I want to know T(2) - the temperature T, at time 2 minutes,
2 minutes after this object is placed in the room.
So, how much does it warm up in those 2 minutes?
Well, it's warming up at 3 degrees per minute,
and we pretend that that's constant
it's not really but we'll just ignore the problem and pretend
3 degrees per minute, for 2 minutes
that's a total increase of 6 minutes
I take those 6 minutes, add them to 5, I get 11,
and in this way I've figured out T(2)
- probably not accurate, or probably not exact
because we had to do a little bit of make-believe,
but it actually isn't that bad.
We can do a similar thing to get T(4), so let's get that a try.