So, let's continue with this example.
We just found the T(2) was 11, or approximately 11
because we had to do some make-believe to get this,
but now let's see if we can figure out T(4).
I can figure out how fast the temperature is changing
at time 2, assuming that the temperature is 11.
What's the rate of change? Well I just ask the equation
- that's what the differential equation does - it's a rule that tells me how fast
the temperature is changing, if we know the temperature.
So let's do that.
So we use the equation - we ask the equation:
When the temperature is 11, what's the rate of change? what's the derivative?
So, when time is 2, we plug in 11, so capital T is 11, 20 -11 is 9,
times .2 is 1.8
So now we know that when the temperature is 11,
it is warming up at 1.8 degrees per minute.
So now suppose we want to know T(4), 4 minutes in,
again, we have the same problem
- this rate isn't constant - it's changing all the time,
as soon as a temperature changes we get a new rate,
but as before, we'll ignore the problem
and pretend that it's constant.
So, again the problem is: the rate is not constant
- our solution is to ignore the problem
- not always a good way to go about things
but for Euler's method, it turns out to work okay
- we'll ignore the problem - pretend it is constant
and then we can figure out the temperature at time 4, 4 minutes in,
in these 2 minutes, that we're pretending:
how much temperature increase do we have,
well at 1.8 degrees per minute for 2 minutes, that's 3.6,
3.6 +11, where we started, gives us 14.6
So now, I know the temperature at T equals 4 minutes.
We can keep doing this,
continue along with this process, and we'll get
a series of temperature values for a series of times.
So, we continue this process,
and we can put our results in a table.
So these first 3 entries we've already figured out
- the initial temperature is 5, then at time 2 it was 11,
at 4, it was 14.6, and at 6,
if when one follow this process along, one would get 16.76,
and we could keep on going.
So, let's make a graph - let's make a plot of these numbers
and see what it looks like, and compare it to the exact solution.
So, for this equation, it turns out one can use calculus to figure out
an exact solution for this differential equation,
and that shown as this solid line here.
Towards the end of this sub unit, I'll talk a little bit about
how one would get this solid line.
The Euler solution - that's what we're doing here
- are these squares - so we start at
the initial condition, and then here at 11,
a little bit less than 15, almost 17, and so on.
So we can see that the Euler solution
- the squares connected by the dotted line
is not that close to the exact solution.
It's not that bad, but it's not a perfect match
and we wouldn't expect a perfect match
because we had to do some pretending in order to get this.
So, as is often the case, ignoring the problem
- remember the problem was that:
the derivative - the rate of change wasn't constant.
Ignoring the problem actually wasn't a great solution
because we have these errors here.
For this example, I'd chose a step size of 2, a delta t of 2.
I said: let's figure out the temperature, capital T, every 2 minutes,
but it's this step size that got us into trouble
because I had to pretend that a constantly changing rate
was actually constant over this time of 2 minutes,
and that's clearly not true,
so, a way we could do better with this Euler method is to use a smaller delta t.