1 00:00:00,000 --> 00:00:00,000 2 00:00:00,000 --> 00:00:08,540 PROFESSOR: Welcome back to recitation. 3 00:00:08,540 --> 00:00:11,740 In this video I'd like us to practice some of the 4 00:00:11,740 --> 00:00:15,380 approximation techniques we've learned in the lectures. 5 00:00:15,380 --> 00:00:18,060 so in this one specifically, what I'd like us to do is 6 00:00:18,060 --> 00:00:23,130 estimate the integral from 0 to pi of sin x dx using these 7 00:00:23,130 --> 00:00:25,630 two approximation methods. 8 00:00:25,630 --> 00:00:29,160 a is going to be using the trapezoid rule, and b is going 9 00:00:29,160 --> 00:00:30,610 to be using Simpson's rule. 10 00:00:30,610 --> 00:00:34,610 In both cases, I'd like you to do this for n equal 4, and to 11 00:00:34,610 --> 00:00:38,760 get you started I have drawn a little sketch of what y equals 12 00:00:38,760 --> 00:00:43,490 sin x looks on the interval from 0 to pi. 13 00:00:43,490 --> 00:00:45,840 So I'll give you a while to work on this and then when 14 00:00:45,840 --> 00:00:47,465 you're finished you can come back and I'll show 15 00:00:47,465 --> 00:00:48,715 you how I do it. 16 00:00:48,715 --> 00:00:57,610 17 00:00:57,610 --> 00:00:57,870 OK. 18 00:00:57,870 --> 00:00:58,840 Welcome back. 19 00:00:58,840 --> 00:01:00,610 Hopefully you were able to get an 20 00:01:00,610 --> 00:01:02,940 approximation for both of these. 21 00:01:02,940 --> 00:01:05,580 Now I'll show you how I do it and make sure that you're 22 00:01:05,580 --> 00:01:07,375 doing it in the correct way. 23 00:01:07,375 --> 00:01:10,280 So I've done a little bit of work ahead of time, because I 24 00:01:10,280 --> 00:01:13,020 didn't want to have to write everything down in the video. 25 00:01:13,020 --> 00:01:15,650 So if you come over here to the right a little bit, we'll 26 00:01:15,650 --> 00:01:18,310 see that I've actually made myself a table of the 27 00:01:18,310 --> 00:01:21,150 important x-values and y-values. 28 00:01:21,150 --> 00:01:24,395 And if you recall, what I said is we're going to approximate 29 00:01:24,395 --> 00:01:29,190 the integral from 0 to pi using four sub-intervals. 30 00:01:29,190 --> 00:01:33,540 So we're interested in i going from 0 to 4, and then we need 31 00:01:33,540 --> 00:01:37,170 to subdivide that interval from 0 to pi into four equal 32 00:01:37,170 --> 00:01:37,840 sub-intervals. 33 00:01:37,840 --> 00:01:40,100 So that will be length pi over 4. 34 00:01:40,100 --> 00:01:44,390 So x0 is just 0, x1 is pi over4. 35 00:01:44,390 --> 00:01:47,240 x2 is pi over 2, you get the idea. 36 00:01:47,240 --> 00:01:49,160 x sub 4 is pi. 37 00:01:49,160 --> 00:01:52,040 And then what I've done, is to make it really easy on myself, 38 00:01:52,040 --> 00:01:55,220 is I've determined what the y-values are associated to 39 00:01:55,220 --> 00:01:58,150 that x-value, given that my function is sin x. 40 00:01:58,150 --> 00:02:01,060 So I filled in a table of values for myself right away, 41 00:02:01,060 --> 00:02:03,580 and then when I want to use the two rules, I can simply 42 00:02:03,580 --> 00:02:05,770 come back and look at this table. 43 00:02:05,770 --> 00:02:08,410 So the first thing I'm going to do is the trapezoid rule. 44 00:02:08,410 --> 00:02:09,990 So I'll come back over here a little bit. 45 00:02:09,990 --> 00:02:14,740 46 00:02:14,740 --> 00:02:16,690 So using the trapezoid rule, let's remember what the 47 00:02:16,690 --> 00:02:17,960 trapezoid rule is. 48 00:02:17,960 --> 00:02:22,290 The trapezoid rule is delta x times, in this case, we're 49 00:02:22,290 --> 00:02:29,920 going to have y0 over 2 plus y1 plus y2 plus y3 50 00:02:29,920 --> 00:02:33,250 plus y4 over 2. 51 00:02:33,250 --> 00:02:36,950 So let me actually move that. 52 00:02:36,950 --> 00:02:39,950 So remember, what you get is you get essentially you're 53 00:02:39,950 --> 00:02:42,920 averaging the right and the left hand end point ones. 54 00:02:42,920 --> 00:02:45,890 So you end up with the furthest left has a 1/2 55 00:02:45,890 --> 00:02:48,030 coefficient, the furthest rights has a 1/2, all the 56 00:02:48,030 --> 00:02:50,680 other coefficients are equal to 1. 57 00:02:50,680 --> 00:02:53,400 So what do we get when we actually evaluate this? 58 00:02:53,400 --> 00:02:55,365 When we plug in what we have for delta x and 59 00:02:55,365 --> 00:02:56,390 for all these values. 60 00:02:56,390 --> 00:02:59,520 Delta x, we know again, it should be the length of the 61 00:02:59,520 --> 00:03:00,650 interval divided by n. 62 00:03:00,650 --> 00:03:02,840 We're sub-dividing equally here. 63 00:03:02,840 --> 00:03:06,280 So we get pi over 4. 64 00:03:06,280 --> 00:03:07,910 And then let's look at our values. 65 00:03:07,910 --> 00:03:12,550 Well, y0 and y4 are both 0, so I'm going to not 66 00:03:12,550 --> 00:03:13,510 even put those in. 67 00:03:13,510 --> 00:03:18,420 You'll see 0 there, 0 there, so these two are both 0. 68 00:03:18,420 --> 00:03:21,340 So I just have to substitute in these values. 69 00:03:21,340 --> 00:03:24,100 y1, y2, and y3. 70 00:03:24,100 --> 00:03:29,190 So y sub 1 is root 2 over 2, y sub 2 is 1, and y sub 3 is 71 00:03:29,190 --> 00:03:30,570 root 2 over 2. 72 00:03:30,570 --> 00:03:37,570 So I should get root 2 over 2 plus 1 plus root 2 over 2. 73 00:03:37,570 --> 00:03:40,230 And if you want to simplify a little bit, you can do that. 74 00:03:40,230 --> 00:03:44,420 Root 2 over 2 plus root 2 over 2, is root 2. 75 00:03:44,420 --> 00:03:48,840 Hopefully you got something that looked like this. 76 00:03:48,840 --> 00:03:51,020 And I gotta tell you at this point, I'm stopping. 77 00:03:51,020 --> 00:03:53,040 Because I don't want to bother to simplify 78 00:03:53,040 --> 00:03:54,920 any more than this. 79 00:03:54,920 --> 00:03:57,300 But the main point is, I want to make sure we understand, 80 00:03:57,300 --> 00:04:00,930 once we have this method how to substitute everything in. 81 00:04:00,930 --> 00:04:03,880 So this first one was just using the trapezoid rule to 82 00:04:03,880 --> 00:04:05,540 approximate the integral. 83 00:04:05,540 --> 00:04:07,910 Now, what does that actually mean in terms of the graph? 84 00:04:07,910 --> 00:04:10,350 Let's go back to the graph and let's look at what that 85 00:04:10,350 --> 00:04:11,100 actually means. 86 00:04:11,100 --> 00:04:14,930 I'm going to get another color for this. 87 00:04:14,930 --> 00:04:17,110 So in the case of the trapezoid rule, what that 88 00:04:17,110 --> 00:04:25,710 means, I'm sub-dividing the interval like this and the 89 00:04:25,710 --> 00:04:29,300 trapezoid rule, remember, connects the two y-values. 90 00:04:29,300 --> 00:04:32,250 Consecutive y-values here. 91 00:04:32,250 --> 00:04:37,920 And it's giving you the area of each of those. 92 00:04:37,920 --> 00:04:47,190 So we found the blue, we found the blue shaded area with the 93 00:04:47,190 --> 00:04:48,560 trapezoid rule. 94 00:04:48,560 --> 00:04:50,520 So just to recall, that's actually what we did. 95 00:04:50,520 --> 00:04:53,310 This is a fairly good approximation, looks like in 96 00:04:53,310 --> 00:04:56,090 this case, of what the actual integral is. 97 00:04:56,090 --> 00:04:58,160 So now let's do Simpson's rule. 98 00:04:58,160 --> 00:05:00,160 And I'll come over to the right of the table to do 99 00:05:00,160 --> 00:05:01,410 Simpson's rule. 100 00:05:01,410 --> 00:05:03,430 101 00:05:03,430 --> 00:05:06,340 Now notice I can do Simpson's rule because 102 00:05:06,340 --> 00:05:07,650 n is an even number. 103 00:05:07,650 --> 00:05:10,960 I have to have n even in order to do Simpson's rule. 104 00:05:10,960 --> 00:05:14,750 So just to remind us what Simpson's rule is, Simpson't 105 00:05:14,750 --> 00:05:20,840 rule is delta x over 3 and then I have these funny 106 00:05:20,840 --> 00:05:23,830 coefficients, which at some point we will explain. 107 00:05:23,830 --> 00:05:29,810 I have a 1 in front of y0, a 4 in front of y1, 2 in front of 108 00:05:29,810 --> 00:05:37,660 y2, a 4 in front of y3, and a 1 in front of the y sub 4. 109 00:05:37,660 --> 00:05:40,330 So that's exactly the coefficients 110 00:05:40,330 --> 00:05:43,300 for Simpson's rule. 111 00:05:43,300 --> 00:05:45,940 And you saw in class why this is a 2. 112 00:05:45,940 --> 00:05:48,620 You'll see in another recitation video why we end up 113 00:05:48,620 --> 00:05:50,050 getting the 1, 4, 1. 114 00:05:50,050 --> 00:05:52,800 And those two things add up, 1, 4, 1, 1, 4, 1. 115 00:05:52,800 --> 00:05:54,260 And where the 3 comes from. 116 00:05:54,260 --> 00:05:56,270 We'll show all of that in another video. 117 00:05:56,270 --> 00:06:00,770 So let's fill in what we have. Well delta x is pi over 4 so I 118 00:06:00,770 --> 00:06:04,890 get pi over 4 times 1/3, so I get pi over 12. 119 00:06:04,890 --> 00:06:07,260 y0 is again 0. 120 00:06:07,260 --> 00:06:10,590 y1, come back here, it was root 2 over 2. 121 00:06:10,590 --> 00:06:16,920 Root 2 over 2 times 4 is 2 root 2. 122 00:06:16,920 --> 00:06:19,120 y2, if you remember, was 1. 123 00:06:19,120 --> 00:06:21,440 So I get 2 times 1 is 2. 124 00:06:21,440 --> 00:06:23,120 And then I have the same two values. 125 00:06:23,120 --> 00:06:26,340 Because this is a, this is symmetric about the y2 value. 126 00:06:26,340 --> 00:06:30,650 So I get another 2 root 2, and another 0. 127 00:06:30,650 --> 00:06:37,350 So if I simplify all this, I get pi over 12-- oops-- 128 00:06:37,350 --> 00:06:42,930 pi over 12 and then I get 4 root 2 plus 2. 129 00:06:42,930 --> 00:06:47,940 And so that we can maybe see a little bit more what it, how 130 00:06:47,940 --> 00:06:50,280 it compares, we can simplify this a little bit. 131 00:06:50,280 --> 00:06:54,950 I'm going to put the 1 in front, 1 plus 2 root 2. 132 00:06:54,950 --> 00:06:57,980 Now, if you wanted to actually do a comparison of those two 133 00:06:57,980 --> 00:07:01,590 values, and then compare that to the actual integral, you'd 134 00:07:01,590 --> 00:07:03,950 want to evaluate the actual integral and then maybe look 135 00:07:03,950 --> 00:07:06,690 at what these two are on a calculator. 136 00:07:06,690 --> 00:07:09,900 But, I just wanted to make sure we knew how to plug in 137 00:07:09,900 --> 00:07:13,190 the y-values, and the appropriate delta x to the 138 00:07:13,190 --> 00:07:13,726 appropriate formula. 139 00:07:13,726 --> 00:07:17,630 So, again, what we were trying to do is estimate the integral 140 00:07:17,630 --> 00:07:20,110 for one that we actually know, so we could do some comparison 141 00:07:20,110 --> 00:07:21,200 if we wanted. 142 00:07:21,200 --> 00:07:24,840 And see how these numerical methods, or these 143 00:07:24,840 --> 00:07:27,070 approximations actually work. 144 00:07:27,070 --> 00:07:29,290 So we did trapezoid rule, we had the formal up there. 145 00:07:29,290 --> 00:07:32,000 We did Simpson's rule and the formula's right here. 146 00:07:32,000 --> 00:07:34,320 And when we were doing this, the thing that made it simpler 147 00:07:34,320 --> 00:07:37,270 is at the very beginning I made a nice table of values. 148 00:07:37,270 --> 00:07:39,040 So when you're solving these types of problems that might 149 00:07:39,040 --> 00:07:42,700 be something you want to think about doing right at the very 150 00:07:42,700 --> 00:07:45,150 beginning to make things a little simpler for yourself. 151 00:07:45,150 --> 00:07:47,160 And I think I'll stop there. 152 00:07:47,160 --> 00:07:47,267