in this video we're computing a trapezoid approximation for a function that there's no way
you're going to integrate symbolically and that's the sine of e to the x and we're integrating on
zero to one we want to use an n equals one thousand trapezoid sum in other words we're
slicing into a thousand trapezoids any attempt to show a thousand trapezoids in the little picture
of this function is just going to look like continuous shading so i'm going to exaggerate
the size of the first trapezoid and the starting point here is what we normally call x zero the
next cut point is going to be very close to x zero and again i'm exaggerating it and that'll be x one
and then to create a trapezoid we connect these two points where the height on the left is f of x
zero the height on the right is f of x one and when we average those two heights and then
multiply by the width of the trapezoid which we call delta x here that gives us the area of the
trapezoid so what we're doing in the problem is trying to set up using summation notation
the sum of all the areas of the trapezoids all 1000 of those trapezoids as we go all the way
from x0 to the final point which we normally call xn n steps to the right and that happens to be one
in this problem the upper limit of integration and things are laid out in a nice step-by-step form
here so in part a we're asked for the sub interval width as a decimal so we simply take the width of
our interval which is one formally here i could say one minus zero and then we divide by how many
subintervals we're slicing into which is a thousand and one over a thousand as a
decimal is point zero zero one in part b we want the i cut point in terms of
i so i want to express if i've taken i steps to the right what is the x value at that point and
in general that's always the starting point plus i steps to the right so x naught plus i delta x
but x naught is zero here it just happens to be the lower limit of integration so i end up
with i times delta x which is point zero zero one i in part c we're asked to express the sum
approximating the integral in terms of x i x i minus 1 and delta x in other words we're still
trying to stay general we're going to sub in the details of our function in part d
so this is a way of just sort of easing the transition into the final answer
and if i look at the area of my first trapezoid that's why i wanted a picture of it i want f of
x naught plus f of x one divided by two that's the average of the two heights and then i want
to multiply that by delta x so we need to make sure that our sum is starting in the right place
and that picture is going to help us decide where our index i should begin all right so
i have the average of two heights where i have f x i and then the cut point before that was
x i minus one so i have f of x i minus one i take the arithmetic mean of those two things and i get
the average height of the trapezoid i multiply by delta x now i have the area of the trapezoid but i
need to make sure my eye is starting in the right place in order to start with this first trapezoid
that's in the picture so what i need for that trapezoid is an x one and an x zero and this means
i'm going to start with i equals one that gives me f of x one and f of x one minus one or f of x is
zero so it's starting correctly and then i need to have a thousand of these things so i must be
terminating the sum at i equals one thousand and just to check my end point real quick my last cut
point is x one thousand one thousand steps to the right of the starting point the one before that
is x nine ninety nine and again these trapezoids are greatly exaggerated but i'm going to connect
these two points with a straight line i've got the area of a trapezoid there and i'm just double
checking that when i put in the last value of i in my summation notation i get the correct heights
here so f x i would be f of x 1000 that's this height right here f of x i minus 1 would be f of x
999 and i can see that my last trapezoid is working correctly as well so now i'm confident
that my formula is good so in part d we're finally going to put this all into a form that we can put
into a piece of technology so i want to write x i x i minus 1 and delta x in terms of i and we've
done all the prep work on this i have delta x up here is point zero zero one x i is .001 i i'll
go ahead and throw in an extra note here this means that x i minus 1 is .001 times i minus 1.
and our function f of x is the sine of e to the x so we can throw all this stuff
into the sum so f of x i is the sine of e to the x i but x i is point zero zero one i f of x i
minus one well i just replace the x in my formula with x i minus one which is point zero zero one
times the quantity i minus one and then i still have to multiply by delta x which is point zero
zero one and i'm going to sum all of these terms as i go from i equals one to a thousand
so this is now ready to plug into a computer algebra system or a calculator that's capable of
computing sums i'm using wx maxima for this it's a free open source computer algebra system and one
thing that's going to simplify things a little bit is to just pull the constants out in front
so i have a one half and a point zero zero one common to every term inside the sum that could be
written as point zero zero five and we can factor it out in front of the sum before we write the
sum in maxima so there's our sum input into maxima and i have the .0005 out in front multiplying this
sum and a couple things to note inside the sum percent e is the special symbol for e in maxima
we've got a ton of parentheses so you have to be careful about having those things nested correctly
and then i take the sum as i goes from one to a thousand now maxima may attempt to do
an exact symbolic solution to this instead of a decimal approximation so we're going to
force a decimal approximation by putting the word float out in front and then we hit shift
enter to get our approximation so we were asked to round to the thousandths place and i get .875
and the last thing i want to do here is just verify that maxima's built-in numerical
integration routines get the same answer and that'll give me a high degree of confidence that
i've set the whole sum up correctly so the way we do this in maxima is we use a command called quad
qag and the function we're integrating here is the sine of e to the x remember e is percent e
and i'm integrating as x goes from zero to one and then we have to pick the algorithm number
any number between one and six tells you the algorithm number that quad qag is going to use
and these are all incredibly precise way beyond what we're even interested in it doesn't matter
which one you pick but just to mix it up i'm choosing number four today hit shift enter and
i get the same decimal approximation i lost my original sum up here so i'm going to hit shift
enter again i just want to count how many decimal points our trapezoid approximation was good to
and it looks like we differ in the millionths place and now that we can see our trapezoid sum
agrees with the numerical integral in maxima we have a high degree of confidence we've got the
right answer and we're done with the problem if you enjoyed this video or at least found it
useful check out another one by clicking one of the links on the left or click the zackslab logo
on the right to explore dozens of physics and math playlists as always you can leave your questions
comments and requests in the comments section below and i'll get back to you within 24 hours
thanks for watching zach's lab and best of luck on your math and physics journey