WEBVTT

00:00:00.000 --> 00:00:08.540
PROFESSOR: Welcome
back to recitation.

00:00:08.540 --> 00:00:11.000
In this video I'd
like us to practice

00:00:11.000 --> 00:00:12.960
some of the
approximation techniques

00:00:12.960 --> 00:00:15.205
we've learned in the lectures.

00:00:15.205 --> 00:00:16.580
So in this one
specifically, what

00:00:16.580 --> 00:00:20.710
I'd like us to do is estimate
the integral from 0 to pi

00:00:20.710 --> 00:00:25.630
of sin x dx using these
two approximation methods.

00:00:25.630 --> 00:00:28.330
a is going to be using
the trapezoid rule,

00:00:28.330 --> 00:00:30.610
and b is going to be
using Simpson's rule.

00:00:30.610 --> 00:00:34.050
In both cases, I'd like you
to do this for n equal 4,

00:00:34.050 --> 00:00:38.290
and to get you started I have
drawn a little sketch of what

00:00:38.290 --> 00:00:43.490
y equals sin x looks like on
the interval from 0 to pi.

00:00:43.490 --> 00:00:45.587
So I'll give you a while
to work on this and then

00:00:45.587 --> 00:00:47.170
when you're finished
you can come back

00:00:47.170 --> 00:00:48.420
and I'll show you how I do it.

00:00:57.370 --> 00:00:57.870
OK.

00:00:57.870 --> 00:00:58.840
Welcome back.

00:00:58.840 --> 00:01:01.380
Hopefully you were able
to get an approximation

00:01:01.380 --> 00:01:02.940
for both of these.

00:01:02.940 --> 00:01:05.270
Now I'll show you how
I do it and make sure

00:01:05.270 --> 00:01:07.375
that you're doing it
in the correct way.

00:01:07.375 --> 00:01:09.650
So I've done a little bit
of work ahead of time,

00:01:09.650 --> 00:01:11.900
because I didn't want to
have to write everything down

00:01:11.900 --> 00:01:13.020
in the video.

00:01:13.020 --> 00:01:15.310
So if you come over here
to the right a little bit,

00:01:15.310 --> 00:01:16.730
we'll see that
I've actually made

00:01:16.730 --> 00:01:21.150
myself a table of the important
x-values and y-values.

00:01:21.150 --> 00:01:23.550
And if you recall,
what I said is

00:01:23.550 --> 00:01:26.020
we're going to approximate
the integral from 0

00:01:26.020 --> 00:01:29.190
to pi using four sub-intervals.

00:01:29.190 --> 00:01:32.890
So we're interested in
i going from 0 to 4,

00:01:32.890 --> 00:01:35.970
and then we need to subdivide
that interval from 0

00:01:35.970 --> 00:01:37.840
to pi into four
equal sub-intervals.

00:01:37.840 --> 00:01:40.100
So that will be
length pi over 4.

00:01:40.100 --> 00:01:44.390
So x_0 is just 0,
x_1 is pi over 4.

00:01:44.390 --> 00:01:47.240
x_2 is pi over 2,
you get the idea.

00:01:47.240 --> 00:01:49.160
x sub 4 is pi.

00:01:49.160 --> 00:01:52.040
And then what I've done, is to
make it really easy on myself,

00:01:52.040 --> 00:01:55.140
is I've determined what
the y-values are associated

00:01:55.140 --> 00:01:58.150
to that x-value, given
that my function is sin x.

00:01:58.150 --> 00:02:01.060
So I filled in a table of
values for myself right away,

00:02:01.060 --> 00:02:03.030
and then when I want
to use the two rules,

00:02:03.030 --> 00:02:05.770
I can simply come back
and look at this table.

00:02:05.770 --> 00:02:08.282
So the first thing I'm going
to do is the trapezoid rule.

00:02:08.282 --> 00:02:09.990
So I'll come back over
here a little bit.

00:02:14.699 --> 00:02:16.490
So using the trapezoid
rule, let's remember

00:02:16.490 --> 00:02:17.960
what the trapezoid rule is.

00:02:17.960 --> 00:02:22.200
The trapezoid rule is delta
x times, in this case,

00:02:22.200 --> 00:02:29.920
we're going to have y_0 over
2 plus y_1 plus y_2 plus y_3

00:02:29.920 --> 00:02:33.250
plus y_4 over 2.

00:02:33.250 --> 00:02:36.950
So let me actually move that.

00:02:36.950 --> 00:02:39.820
So remember, what you get
is you get essentially

00:02:39.820 --> 00:02:42.920
you're averaging the right and
the left hand end point ones.

00:02:42.920 --> 00:02:46.365
So you end up with the furthest
left has a 1/2 coefficient,

00:02:46.365 --> 00:02:48.740
the furthest rights has a 1/2,
all the other coefficients

00:02:48.740 --> 00:02:50.680
are equal to 1.

00:02:50.680 --> 00:02:53.264
So what do we get when we
actually evaluate this?

00:02:53.264 --> 00:02:55.680
When we plug in what we have
for delta x and for all these

00:02:55.680 --> 00:02:56.390
values.

00:02:56.390 --> 00:02:58.280
Delta x, we know
again, it should

00:02:58.280 --> 00:03:00.650
be the length of the
interval divided by n.

00:03:00.650 --> 00:03:02.840
We're sub-dividing equally here.

00:03:02.840 --> 00:03:06.280
So we get pi over 4.

00:03:06.280 --> 00:03:07.910
And then let's
look at our values.

00:03:07.910 --> 00:03:11.970
Well, y_0 and y_4
are both 0, so I'm

00:03:11.970 --> 00:03:13.510
going to not even put those in.

00:03:13.510 --> 00:03:18.420
You'll see 0 there, 0 there,
so these two are both 0.

00:03:18.420 --> 00:03:21.340
So I just have to
substitute in these values.

00:03:21.340 --> 00:03:24.100
y_1, y_2, and y_3.

00:03:24.100 --> 00:03:28.210
So y sub 1 is root 2
over 2, y sub 2 is 1,

00:03:28.210 --> 00:03:30.570
and y sub 3 is root 2 over 2.

00:03:30.570 --> 00:03:37.570
So I should get root 2 over
2 plus 1 plus root 2 over 2.

00:03:37.570 --> 00:03:40.230
And if you want to simplify a
little bit, you can do that.

00:03:40.230 --> 00:03:44.420
Root 2 over 2 plus root
2 over 2, is root 2.

00:03:44.420 --> 00:03:48.840
Hopefully you got something
that looked like this.

00:03:48.840 --> 00:03:51.020
And I gotta tell you at
this point, I'm stopping.

00:03:51.020 --> 00:03:54.920
Because I don't want to bother
to simplify any more than this.

00:03:54.920 --> 00:03:57.300
But the main point is, I want
to make sure we understand,

00:03:57.300 --> 00:04:00.930
once we have this method how
to substitute everything in.

00:04:00.930 --> 00:04:03.730
So this first one was just
using the trapezoid rule

00:04:03.730 --> 00:04:05.540
to approximate the integral.

00:04:05.540 --> 00:04:07.910
Now, what does that actually
mean in terms of the graph?

00:04:07.910 --> 00:04:09.934
Let's go back to the
graph and let's look

00:04:09.934 --> 00:04:11.100
at what that actually means.

00:04:11.100 --> 00:04:14.930
I'm going to get
another color for this.

00:04:14.930 --> 00:04:17.410
So in the case of the trapezoid
rule, what that means,

00:04:17.410 --> 00:04:25.130
I'm sub-dividing the
interval like this

00:04:25.130 --> 00:04:27.210
and the trapezoid
rule, remember,

00:04:27.210 --> 00:04:29.300
connects the two y-values.

00:04:29.300 --> 00:04:32.250
Consecutive y-values here.

00:04:32.250 --> 00:04:37.920
And it's giving you the
area of each of those.

00:04:37.920 --> 00:04:46.860
So we found the blue, we
found the blue shaded area

00:04:46.860 --> 00:04:48.560
with the trapezoid rule.

00:04:48.560 --> 00:04:50.520
So just to recall, that's
actually what we did.

00:04:50.520 --> 00:04:52.810
This is a fairly
good approximation,

00:04:52.810 --> 00:04:56.090
looks like in this case, of
what the actual integral is.

00:04:56.090 --> 00:04:58.077
So now let's do Simpson's rule.

00:04:58.077 --> 00:04:59.910
And I'll come over to
the right of the table

00:04:59.910 --> 00:05:00.850
to do Simpson's rule.

00:05:03.314 --> 00:05:04.730
Now notice I can
do Simpson's rule

00:05:04.730 --> 00:05:07.650
because n is an even number.

00:05:07.650 --> 00:05:10.960
I have to have n even in
order to do Simpson's rule.

00:05:10.960 --> 00:05:14.280
So just to remind us
what Simpson's rule is,

00:05:14.280 --> 00:05:18.960
Simpson's rule is
delta x over 3 and then

00:05:18.960 --> 00:05:22.170
I have these funny coefficients,
which at some point

00:05:22.170 --> 00:05:23.830
we will explain.

00:05:23.830 --> 00:05:29.040
I have a 1 in front of
y_0, a 4 in front of y_1,

00:05:29.040 --> 00:05:34.540
2 in front of y_2, a 4
in front of y_3, and a 1

00:05:34.540 --> 00:05:37.660
in front of the y sub 4.

00:05:37.660 --> 00:05:40.330
So that's exactly
the coefficients

00:05:40.330 --> 00:05:43.300
for Simpson's rule.

00:05:43.300 --> 00:05:45.940
And you saw in class
why this is a 2.

00:05:45.940 --> 00:05:47.750
You'll see in another
recitation video

00:05:47.750 --> 00:05:50.050
why we end up
getting the 1, 4, 1.

00:05:50.050 --> 00:05:52.800
And those two things add
up, 1, 4, 1; 1, 4, 1.

00:05:52.800 --> 00:05:54.260
And where the 3 comes from.

00:05:54.260 --> 00:05:56.270
We'll show all of
that in another video.

00:05:56.270 --> 00:05:57.600
So let's fill in what we have.

00:05:57.600 --> 00:06:03.040
Well delta x is pi over 4 so
I get pi over 4 times 1/3,

00:06:03.040 --> 00:06:04.890
so I get pi over 12.

00:06:04.890 --> 00:06:07.260
y_0 is again 0.

00:06:07.260 --> 00:06:10.590
y_1, come back here,
it was root 2 over 2.

00:06:10.590 --> 00:06:16.920
Root 2 over 2 times
4 is 2 root 2.

00:06:16.920 --> 00:06:19.120
y_2, if you remember, was 1.

00:06:19.120 --> 00:06:21.440
So I get 2 times 1 is 2.

00:06:21.440 --> 00:06:23.120
And then I have the
same two values.

00:06:23.120 --> 00:06:26.340
Because this is a-- this is
symmetric about the y_2 value.

00:06:26.340 --> 00:06:30.650
So I get another 2
root 2, and another 0.

00:06:30.650 --> 00:06:37.485
So if I simplify all this, I get
pi over 12-- oops-- pi over 12

00:06:37.485 --> 00:06:42.930
and then I get 4 root 2 plus 2.

00:06:42.930 --> 00:06:47.750
And so that we can maybe see
a little bit more what it,

00:06:47.750 --> 00:06:50.280
how it compares, we can
simplify this a little bit.

00:06:50.280 --> 00:06:54.950
I'm going to put the 1 in
front, 1 plus 2 root 2.

00:06:54.950 --> 00:06:57.980
Now, if you wanted to actually
do a comparison of those two

00:06:57.980 --> 00:07:01.440
values, and then compare
that to the actual integral,

00:07:01.440 --> 00:07:03.190
you'd want to evaluate
the actual integral

00:07:03.190 --> 00:07:06.394
and then maybe look at what
these two are on a calculator.

00:07:06.394 --> 00:07:07.810
But, I just wanted
to make sure we

00:07:07.810 --> 00:07:12.110
knew how to plug in the y-values
and the appropriate delta

00:07:12.110 --> 00:07:13.726
x to the appropriate formula.

00:07:13.726 --> 00:07:15.440
So, again, what we
were trying to do

00:07:15.440 --> 00:07:18.830
is estimate the integral for
one that we actually know,

00:07:18.830 --> 00:07:21.200
so we could do some
comparison if we wanted.

00:07:21.200 --> 00:07:23.410
And see how these
numerical methods,

00:07:23.410 --> 00:07:27.041
or these approximations
actually work.

00:07:27.041 --> 00:07:29.290
So we did trapezoid rule,
we had the formula up there.

00:07:29.290 --> 00:07:31.862
We did Simpson's rule and
the formula's right here.

00:07:31.862 --> 00:07:34.320
And when we were doing this,
the thing that made it simpler

00:07:34.320 --> 00:07:36.784
is at the very beginning I
made a nice table of values.

00:07:36.784 --> 00:07:38.700
So when you're solving
these types of problems

00:07:38.700 --> 00:07:41.100
that might be something
you want to think

00:07:41.100 --> 00:07:43.090
about doing right at
the very beginning

00:07:43.090 --> 00:07:45.150
to make things a little
simpler for yourself.

00:07:45.150 --> 00:07:46.767
And I think I'll stop there.