1
00:00:01,167 --> 00:00:04,046
So, let's continue with this example.
2
00:00:04,046 --> 00:00:07,415
We just found the T(2) was 11, or approximately 11
3
00:00:07,415 --> 00:00:10,961
because we had to do some make-believe to get this,
4
00:00:10,961 --> 00:00:14,078
but now let's see if we can figure out T(4).
5
00:00:14,078 --> 00:00:16,964
I can figure out how fast the temperature is changing
6
00:00:16,964 --> 00:00:22,126
at time 2, assuming that the temperature is 11.
7
00:00:22,126 --> 00:00:24,960
What's the rate of change? Well I just ask the equation
8
00:00:24,960 --> 00:00:28,463
- that's what the differential equation does - it's a rule that tells me how fast
9
00:00:28,463 --> 00:00:31,895
the temperature is changing, if we know the temperature.
10
00:00:31,895 --> 00:00:34,407
So let's do that.
11
00:00:36,146 --> 00:00:39,148
So we use the equation - we ask the equation:
12
00:00:39,148 --> 00:00:43,047
When the temperature is 11, what's the rate of change? what's the derivative?
13
00:00:43,047 --> 00:00:50,896
So, when time is 2, we plug in 11, so capital T is 11, 20 -11 is 9,
14
00:00:50,896 --> 00:00:53,632
times .2 is 1.8
15
00:00:53,632 --> 00:00:57,615
So now we know that when the temperature is 11,
16
00:00:57,615 --> 00:01:01,964
it is warming up at 1.8 degrees per minute.
17
00:01:01,964 --> 00:01:05,173
So now suppose we want to know T(4), 4 minutes in,
18
00:01:05,173 --> 00:01:07,924
again, we have the same problem
19
00:01:07,924 --> 00:01:10,629
- this rate isn't constant - it's changing all the time,
20
00:01:10,629 --> 00:01:13,736
as soon as a temperature changes we get a new rate,
21
00:01:13,736 --> 00:01:16,742
but as before, we'll ignore the problem
22
00:01:16,742 --> 00:01:19,879
and pretend that it's constant.
23
00:01:25,050 --> 00:01:27,943
So, again the problem is: the rate is not constant
24
00:01:27,943 --> 00:01:29,337
- our solution is to ignore the problem
25
00:01:29,337 --> 00:01:32,206
- not always a good way to go about things
26
00:01:32,206 --> 00:01:34,655
but for Euler's method, it turns out to work okay
27
00:01:34,655 --> 00:01:36,662
- we'll ignore the problem - pretend it is constant
28
00:01:36,662 --> 00:01:41,204
and then we can figure out the temperature at time 4, 4 minutes in,
29
00:01:41,204 --> 00:01:43,736
in these 2 minutes, that we're pretending:
30
00:01:43,736 --> 00:01:46,252
how much temperature increase do we have,
31
00:01:46,252 --> 00:01:51,331
well at 1.8 degrees per minute for 2 minutes, that's 3.6,
32
00:01:51,331 --> 00:01:58,128
3.6 +11, where we started, gives us 14.6
33
00:01:58,128 --> 00:02:03,046
So now, I know the temperature at T equals 4 minutes.
34
00:02:03,046 --> 00:02:04,544
We can keep doing this,
35
00:02:04,544 --> 00:02:06,961
continue along with this process, and we'll get
36
00:02:06,961 --> 00:02:12,454
a series of temperature values for a series of times.
37
00:02:15,653 --> 00:02:17,935
So, we continue this process,
38
00:02:17,935 --> 00:02:21,211
and we can put our results in a table.
39
00:02:21,211 --> 00:02:24,210
So these first 3 entries we've already figured out
40
00:02:24,210 --> 00:02:27,785
- the initial temperature is 5, then at time 2 it was 11,
41
00:02:27,785 --> 00:02:31,377
at 4, it was 14.6, and at 6,
42
00:02:31,377 --> 00:02:36,171
if when one follow this process along, one would get 16.76,
43
00:02:36,171 --> 00:02:39,331
and we could keep on going.
44
00:02:39,331 --> 00:02:42,426
So, let's make a graph - let's make a plot of these numbers
45
00:02:42,426 --> 00:02:47,043
and see what it looks like, and compare it to the exact solution.
46
00:02:47,043 --> 00:02:50,557
So, for this equation, it turns out one can use calculus to figure out
47
00:02:50,557 --> 00:02:55,017
an exact solution for this differential equation,
48
00:02:55,017 --> 00:02:57,823
and that shown as this solid line here.
49
00:02:57,823 --> 00:03:00,047
Towards the end of this sub unit, I'll talk a little bit about
50
00:03:00,047 --> 00:03:02,570
how one would get this solid line.
51
00:03:02,570 --> 00:03:05,416
The Euler solution - that's what we're doing here
52
00:03:05,416 --> 00:03:08,623
- are these squares - so we start at
53
00:03:08,623 --> 00:03:12,490
the initial condition, and then here at 11,
54
00:03:12,490 --> 00:03:16,739
a little bit less than 15, almost 17, and so on.
55
00:03:16,739 --> 00:03:19,180
So we can see that the Euler solution
56
00:03:19,180 --> 00:03:22,018
- the squares connected by the dotted line
57
00:03:22,018 --> 00:03:25,395
is not that close to the exact solution.
58
00:03:25,395 --> 00:03:28,378
It's not that bad, but it's not a perfect match
59
00:03:28,378 --> 00:03:31,136
and we wouldn't expect a perfect match
60
00:03:31,136 --> 00:03:35,798
because we had to do some pretending in order to get this.
61
00:03:35,798 --> 00:03:38,458
So, as is often the case, ignoring the problem
62
00:03:38,458 --> 00:03:40,258
- remember the problem was that:
63
00:03:40,258 --> 00:03:42,299
the derivative - the rate of change wasn't constant.
64
00:03:42,299 --> 00:03:46,176
Ignoring the problem actually wasn't a great solution
65
00:03:46,176 --> 00:03:51,445
because we have these errors here.
66
00:03:51,445 --> 00:03:56,622
For this example, I'd chose a step size of 2, a delta t of 2.
67
00:03:56,622 --> 00:04:00,851
I said: let's figure out the temperature, capital T, every 2 minutes,
68
00:04:00,851 --> 00:04:04,474
but it's this step size that got us into trouble
69
00:04:04,474 --> 00:04:08,219
because I had to pretend that a constantly changing rate
70
00:04:08,219 --> 00:04:12,364
was actually constant over this time of 2 minutes,
71
00:04:12,364 --> 00:04:15,253
and that's clearly not true,
72
00:04:15,253 --> 00:04:21,377
so, a way we could do better with this Euler method is to use a smaller delta t.