0:00:01.167,0:00:04.046
So, let's continue with this example.
0:00:04.046,0:00:07.415
We just found the T(2) was 11, or approximately 11
0:00:07.415,0:00:10.961
because we had to do some make-believe to get this,
0:00:10.961,0:00:14.078
but now let's see if we can figure out T(4).
0:00:14.078,0:00:16.964
I can figure out how fast the temperature is changing
0:00:16.964,0:00:22.126
at time 2, assuming that the temperature is 11.
0:00:22.126,0:00:24.960
What's the rate of change? Well I just ask the equation
0:00:24.960,0:00:28.463
- that's what the differential equation does - it's a rule that tells me how fast
0:00:28.463,0:00:31.895
the temperature is changing, if we know the temperature.
0:00:31.895,0:00:34.407
So let's do that.
0:00:36.146,0:00:39.148
So we use the equation - we ask the equation:
0:00:39.148,0:00:43.047
When the temperature is 11, what's the rate of change? what's the derivative?
0:00:43.047,0:00:50.896
So, when time is 2, we plug in 11, so capital T is 11, 20 -11 is 9,
0:00:50.896,0:00:53.632
times .2 is 1.8
0:00:53.632,0:00:57.615
So now we know that when the temperature is 11,
0:00:57.615,0:01:01.964
it is warming up at 1.8 degrees per minute.
0:01:01.964,0:01:05.173
So now suppose we want to know T(4), 4 minutes in,
0:01:05.173,0:01:07.924
again, we have the same problem
0:01:07.924,0:01:10.629
- this rate isn't constant - it's changing all the time,
0:01:10.629,0:01:13.736
as soon as a temperature changes we get a new rate,
0:01:13.736,0:01:16.742
but as before, we'll ignore the problem
0:01:16.742,0:01:19.879
and pretend that it's constant.
0:01:25.050,0:01:27.943
So, again the problem is: the rate is not constant
0:01:27.943,0:01:29.337
- our solution is to ignore the problem
0:01:29.337,0:01:32.206
- not always a good way to go about things
0:01:32.206,0:01:34.655
but for Euler's method, it turns out to work okay
0:01:34.655,0:01:36.662
- we'll ignore the problem - pretend it is constant
0:01:36.662,0:01:41.204
and then we can figure out the temperature at time 4, 4 minutes in,
0:01:41.204,0:01:43.736
in these 2 minutes, that we're pretending:
0:01:43.736,0:01:46.252
how much temperature increase do we have,
0:01:46.252,0:01:51.331
well at 1.8 degrees per minute for 2 minutes, that's 3.6,
0:01:51.331,0:01:58.128
3.6 +11, where we started, gives us 14.6
0:01:58.128,0:02:03.046
So now, I know the temperature at T equals 4 minutes.
0:02:03.046,0:02:04.544
We can keep doing this,
0:02:04.544,0:02:06.961
continue along with this process, and we'll get
0:02:06.961,0:02:12.454
a series of temperature values for a series of times.
0:02:15.653,0:02:17.935
So, we continue this process,
0:02:17.935,0:02:21.211
and we can put our results in a table.
0:02:21.211,0:02:24.210
So these first 3 entries we've already figured out
0:02:24.210,0:02:27.785
- the initial temperature is 5, then at time 2 it was 11,
0:02:27.785,0:02:31.377
at 4, it was 14.6, and at 6,
0:02:31.377,0:02:36.171
if when one follow this process along, one would get 16.76,
0:02:36.171,0:02:39.331
and we could keep on going.
0:02:39.331,0:02:42.426
So, let's make a graph - let's make a plot of these numbers
0:02:42.426,0:02:47.043
and see what it looks like, and compare it to the exact solution.
0:02:47.043,0:02:50.557
So, for this equation, it turns out one can use calculus to figure out
0:02:50.557,0:02:55.017
an exact solution for this differential equation,
0:02:55.017,0:02:57.823
and that shown as this solid line here.
0:02:57.823,0:03:00.047
Towards the end of this sub unit, I'll talk a little bit about
0:03:00.047,0:03:02.570
how one would get this solid line.
0:03:02.570,0:03:05.416
The Euler solution - that's what we're doing here
0:03:05.416,0:03:08.623
- are these squares - so we start at
0:03:08.623,0:03:12.490
the initial condition, and then here at 11,
0:03:12.490,0:03:16.739
a little bit less than 15, almost 17, and so on.
0:03:16.739,0:03:19.180
So we can see that the Euler solution
0:03:19.180,0:03:22.018
- the squares connected by the dotted line
0:03:22.018,0:03:25.395
is not that close to the exact solution.
0:03:25.395,0:03:28.378
It's not that bad, but it's not a perfect match
0:03:28.378,0:03:31.136
and we wouldn't expect a perfect match
0:03:31.136,0:03:35.798
because we had to do some pretending in order to get this.
0:03:35.798,0:03:38.458
So, as is often the case, ignoring the problem
0:03:38.458,0:03:40.258
- remember the problem was that:
0:03:40.258,0:03:42.299
the derivative - the rate of change wasn't constant.
0:03:42.299,0:03:46.176
Ignoring the problem actually wasn't a great solution
0:03:46.176,0:03:51.445
because we have these errors here.
0:03:51.445,0:03:56.622
For this example, I'd chose a step size of 2, a delta t of 2.
0:03:56.622,0:04:00.851
I said: let's figure out the temperature, capital T, every 2 minutes,
0:04:00.851,0:04:04.474
but it's this step size that got us into trouble
0:04:04.474,0:04:08.219
because I had to pretend that a constantly changing rate
0:04:08.219,0:04:12.364
was actually constant over this time of 2 minutes,
0:04:12.364,0:04:15.253
and that's clearly not true,
0:04:15.253,0:04:21.377
so, a way we could do better with this Euler method is to use a smaller delta t.