1. Rewrite the following using sigma notation:
cos(0)+cos(pi/8)+cos(pi/4)+cos(3pi/8)+cos(pi/2)
+ cos(5pi/8)+cos(3pi/4)+cos(7pi/8) +cos(pi)
First, I look at this and I see that I have 9 terms, each of which is cosine of something. The terms I'm taking cosine of vary, but they vary regularly -- each one is a multiple of pi/8, and they go in order, from 0 in the first term to 8 in the second term. Thus it makes the most sense for me to add from 0 to 8.
So if I have j going from 0 to 8, then my inputs are going from 0*pi/8 to 8*pi/8, so they're
j*pi/8 for j=0 to 8.
Thus, rewriting my sum in sigma notation gives me:
> Sum(cos(j*Pi/8),j=0..8);
Notice that I capitalized the 's' in "Sum". If I hadn't, I would get the actual value of the sum:
> sum(cos(j*Pi/8),j=0..8);
2. Consider the definite integral
> Int(sin(x), x=0..Pi);
a) Evaluate this integral using the FTC.
In order to use the fundamental theorem of calculus, I first need to antidifferentiate sin(x).
An antiderivative of sin(x) is -cos(x). Thus the area under sin(x) from 0 to Pi is
> -cos(Pi)-(-cos(0));
b) Write L_4 and R_4 out term-by-term, and then rewrite them using sigma notation.
First I need to find out what the base of each rectangle is:
> Dx := (Pi-0)/4;
This divides the interval [0,Pi] into four subintervals
[0,Pi/4], [Pi/4,Pi/2], [Pi/2, 3Pi/4], [3Pi/4,Pi].
To approximate the area with a left-hand sum involving four subintervals, I will have four rectangles.
Their heights will be given by sin(x) (since that's my original function) evaluated at the left endpoint of each of these subintervals.
That is,
> f := x -> sin(x);
> L_4 := Pi/4 * (f(0)+f(Pi/4)+f(Pi/2)+f(3*Pi/4)):
Now to rewrite this using sigma notation, I need to see what's the same and what's varying in each term.
The only thing that's varying is that the input into f is changing. In the first term, we have 0. In the second term, we have 1*Pi/4, in the third we have 2*Pi/4, and in the fourth, we have 3*Pi/4.
There are two ways to write this in sigma notation. (Well, there are lots, but we'll do the two most likely). One is to stick with calling the first term the "first" term. In that case, we'll begin counting with 1 and go to 4. But if we do that, then we have to subtract one to figure out what we're multiplying by. That is, in the first term, we're multiplying Pi/4 by 0, in the second term we're multiplying Pi/4 by 1, etc.
So we get
> L_4a := Pi/4*Sum(f((i-1)*Pi/4), i=1..4);
The other option is to begin counting with 0. Then in the 0th term we have 0 *Pi/4, in the 1st term we have 1*Pi/4, etc. In that case, we have
> L_4b := Pi/4 * Sum( f(i*Pi/4), i=0..3);
These are the same -- check it out:
c)
> value(L_4a); value(L_4b);
Notice that value gives exact results, rather than decimal approximations. This is great when we're only adding up a few terms, but would be a mess if we tried to do it with a lot of terms. When we have a lot of terms, we can save Maple a lot of time if we use the evalf command.
> evalf(L_4a); evalf(L_4b);
I also need to do the right sum with 4 subintervals.
For this, I'm using the right endpoints of the intervals to determine the heights.
The base of each rectangle is still Pi/4. Thus I get:
> R_4 := Pi/4 * ( sin(Pi/4) + sin(Pi/2) + sin(3*Pi/4) + sin(Pi)):
Writing that in sigma notation gives
> R_4:= Pi/4 * Sum(sin(i*Pi/4), i=1..4);
> evalf(%);
Write L_20 and R_20 using sigma notation.
> L_20 := Pi/20 * Sum(sin(i*Pi/20), i=0..19);
> evalf(%);
> R_20 := Pi/20 * Sum(sin(i*Pi/20), i=1..20);
> evalf(%);
L_4 and R_4 are off by
> 2-evalf(R_4);
L_20 and R_20 are off by
> 2-evalf(R_20);
How about L_50 and R_50?
>
> L_50:= Pi/50*Sum(sin(i*Pi/50), i=0..49);
> evalf(%);
> R_50 := Pi/50*Sum(sin(i*Pi/50),i=1..50);
> evalf(%);
These are both off by
> 2-%;
Thus as expected, the error gets smaller the more subdivisions we use in our approximations.