1 00:00:01,660 --> 00:00:05,650 The Euler's Method applet helps us understand numerical methods 2 00:00:05,650 --> 00:00:10,360 for approximating solutions to differential equations. 3 00:00:10,360 --> 00:00:12,130 I can choose the differential equation 4 00:00:12,130 --> 00:00:14,440 using this pull down menu, and I've 5 00:00:14,440 --> 00:00:17,680 selected the equation y prime equals y squared 6 00:00:17,680 --> 00:00:24,130 minus x, the same equation that we used in the isocline applet. 7 00:00:24,130 --> 00:00:28,090 The graphing window shows a slope field, the slope field 8 00:00:28,090 --> 00:00:29,190 of this equation. 9 00:00:29,190 --> 00:00:31,670 And the value of the slope field can be read off 10 00:00:31,670 --> 00:00:33,380 by rolling over the window. 11 00:00:33,380 --> 00:00:35,750 It's read off on the right-hand side here. f 12 00:00:35,750 --> 00:00:41,830 of x, y is various values depending on where I'm located. 13 00:00:41,830 --> 00:00:46,570 I've also chosen an initial condition, initial value, 14 00:00:46,570 --> 00:00:54,220 of x equals-- x_0 is zero, and y_0 is minus 1. 15 00:00:54,220 --> 00:00:59,570 I can see the actual solution with that initial condition 16 00:00:59,570 --> 00:01:07,520 by pressing Actual from this set of boxes and checking Start. 17 00:01:07,520 --> 00:01:10,450 Now a curve is drawn on the graphing plane. 18 00:01:10,450 --> 00:01:13,050 This is the solution with that initial condition. 19 00:01:13,050 --> 00:01:15,820 And a table of values shows up in this left table. 20 00:01:18,480 --> 00:01:21,230 We can see that this is one of the solutions which 21 00:01:21,230 --> 00:01:22,790 is sucked into the funnel. 22 00:01:22,790 --> 00:01:26,860 So we understand the values of y of x 23 00:01:26,860 --> 00:01:29,330 quite well when x is large. 24 00:01:29,330 --> 00:01:33,240 But what if I want to know the value of y of 1? 25 00:01:33,240 --> 00:01:35,410 According to the table over here, 26 00:01:35,410 --> 00:01:39,100 the value is approximately minus 0.83. 27 00:01:39,100 --> 00:01:42,340 But how do we know that? 28 00:01:42,340 --> 00:01:45,740 Euler's method is the simplest numerical method. 29 00:01:45,740 --> 00:01:49,030 It uses the tangent line approximation. 30 00:01:49,030 --> 00:02:00,150 If I set the step size to be 1, I can then click Start, 31 00:02:00,150 --> 00:02:04,600 and this will draw a tangent line segment, with delta x 32 00:02:04,600 --> 00:02:07,720 equal to 1, starting at my initial condition, 33 00:02:07,720 --> 00:02:11,020 and with slope given by the slope field at that point. 34 00:02:11,020 --> 00:02:16,430 So the tangent line approximation to y of 1 35 00:02:16,430 --> 00:02:20,200 is the value zero. 36 00:02:20,200 --> 00:02:22,820 Well, that's not very good. 37 00:02:22,820 --> 00:02:27,060 But I can improve things by using a smaller step size. 38 00:02:27,060 --> 00:02:33,480 So let's go down to a step size of 1/4, start again. 39 00:02:33,480 --> 00:02:37,300 Now I've drawn a tangent line segment, 40 00:02:37,300 --> 00:02:40,410 but the horizontal distance is only 1/4. 41 00:02:43,850 --> 00:02:45,840 Let's see if we can see this more clearly 42 00:02:45,840 --> 00:02:48,130 by pressing the zoom key. 43 00:02:48,130 --> 00:02:50,630 This will zoom in on the same picture that we had before. 44 00:02:53,560 --> 00:02:56,330 I can measure the slope field at the end point 45 00:02:56,330 --> 00:02:58,700 of this green line segment. 46 00:02:58,700 --> 00:03:01,540 It seems to be about 0.32. 47 00:03:01,540 --> 00:03:05,570 And by pressing Next Step, I can draw a line segment 48 00:03:05,570 --> 00:03:07,810 moving off with that slope. 49 00:03:07,810 --> 00:03:12,200 So this now, it produces a polygon, the Euler polygon, 50 00:03:12,200 --> 00:03:14,860 which will stay closer to the actual curve 51 00:03:14,860 --> 00:03:18,300 than the simple tangent line approximation did. 52 00:03:18,300 --> 00:03:22,810 I can continue this process by continuing to say Next Step. 53 00:03:22,810 --> 00:03:25,550 The table of values appears on the left, 54 00:03:25,550 --> 00:03:28,500 and we discover that the Euler approximation 55 00:03:28,500 --> 00:03:34,560 to y of 1 with step size 1/4, is minus 0.75. 56 00:03:34,560 --> 00:03:38,070 Much better than the earlier value we had. 57 00:03:38,070 --> 00:03:40,210 And I can improve things still further 58 00:03:40,210 --> 00:03:42,660 by choosing a smaller step size. 59 00:03:42,660 --> 00:03:46,210 In fact, you get as close as you want to the actual solution 60 00:03:46,210 --> 00:03:50,430 by selecting sufficiently small step sizes. 61 00:03:50,430 --> 00:03:54,730 Let's do one more example with step size of 1/8. 62 00:03:54,730 --> 00:04:00,170 Now I will click 8 times to produce an Euler polygon 63 00:04:00,170 --> 00:04:02,130 with 8 segments. 64 00:04:02,130 --> 00:04:06,380 And I have an estimate of minus 0.8. 65 00:04:06,380 --> 00:04:08,550 All of these estimates are too large. 66 00:04:08,550 --> 00:04:10,610 All of these curves, these polygons, 67 00:04:10,610 --> 00:04:14,560 lie above the actual solution curve. 68 00:04:14,560 --> 00:04:16,270 Let's see if we can see why this is. 69 00:04:19,360 --> 00:04:24,980 You'll notice that the slope field is given by the formula 70 00:04:24,980 --> 00:04:26,780 y squared minus x. 71 00:04:26,780 --> 00:04:32,440 So as x increases, the slope field decreases in value. 72 00:04:32,440 --> 00:04:36,170 So as we're moving out along one of these Euler struts, 73 00:04:36,170 --> 00:04:39,030 the slope field is decreasing under it. 74 00:04:39,030 --> 00:04:41,660 And that causes the actual solution 75 00:04:41,660 --> 00:04:46,190 to fall below the Euler polygon. 76 00:04:46,190 --> 00:04:51,390 And that process will continue as I iterate the Euler process. 77 00:04:51,390 --> 00:04:54,970 So the general rule is, if the direction field is decreasing 78 00:04:54,970 --> 00:04:58,600 in the x-direction, you should expect the actual solution 79 00:04:58,600 --> 00:05:01,410 to be less than the Euler estimate. 80 00:05:01,410 --> 00:05:03,260 There are lots of things that can go wrong 81 00:05:03,260 --> 00:05:05,340 in this kind of numerical work. 82 00:05:05,340 --> 00:05:08,610 To see one of them, let's unzoom. 83 00:05:08,610 --> 00:05:16,800 Zoom back, clear the screen, redraw the actual solution, 84 00:05:16,800 --> 00:05:20,320 and choose step size 1. 85 00:05:20,320 --> 00:05:22,930 Now instead of wanting to compute y of 1, 86 00:05:22,930 --> 00:05:27,140 suppose that I wanted to compute the value of the solution 87 00:05:27,140 --> 00:05:29,250 at x equals 6. 88 00:05:29,250 --> 00:05:32,742 Well if I try doing this using step size of 1, 89 00:05:32,742 --> 00:05:33,700 let's see what happens. 90 00:05:33,700 --> 00:05:34,520 So I begin. 91 00:05:34,520 --> 00:05:36,460 I have the same strut I had before. 92 00:05:36,460 --> 00:05:38,670 It's too large, but now the slope field 93 00:05:38,670 --> 00:05:43,020 has a negative value so that comes back down. 94 00:05:43,020 --> 00:05:44,620 Things are looking better. 95 00:05:44,620 --> 00:05:46,550 In the next step, I've overshot. 96 00:05:49,110 --> 00:05:52,690 And if I take another step, then I've 97 00:05:52,690 --> 00:05:56,390 overshot again in the other direction, more dramatically. 98 00:05:56,390 --> 00:05:58,980 And now the slope field is even more negative. 99 00:05:58,980 --> 00:06:01,210 So when I take the next step, I've 100 00:06:01,210 --> 00:06:04,330 overshot yet again, more dramatically. 101 00:06:04,330 --> 00:06:10,550 And if I take the next step, now my estimate for the solution, 102 00:06:10,550 --> 00:06:15,830 which is down here, at x equals 6 is the value 7, 103 00:06:15,830 --> 00:06:19,500 this is in the range where the slope field continues 104 00:06:19,500 --> 00:06:20,800 to increase forever. 105 00:06:20,800 --> 00:06:25,110 And so my estimated solution will zoom off towards infinity, 106 00:06:25,110 --> 00:06:28,200 while the actual curve is down here. 107 00:06:28,200 --> 00:06:30,940 I call this catastrophic overshoot. 108 00:06:30,940 --> 00:06:32,970 It's just one of a number of different things 109 00:06:32,970 --> 00:06:37,340 that can go wrong when you try to use these numerical methods.