> f:= x -> sin(x^2);
> plot(f(x),x=-2*Pi/3 .. Pi/4, filled=true, color=grey);
We saw Friday that this area can not be found using the FTC, even using Maple. So we must approximate the integral.
1) Find n so that L_n approximates the integral to within .001 of its actual value.
Use Theorem 2
|I-L_n| <= K1*(b-a)^2/(2n)
We want the actual error, |I-L_n|, to be less than or equal to .001. If we make the error bound be less than or equal to .001, then |I-L_n| is sure to be as well.
Need to find: n so that K1*(b-a)^2/(2n) <= .001.
a= - 2*Pi/3
b=Pi/4.
To find K1 , look at a graph of |f ' (x)|.
> fprime := 2*x*cos(x^2);
> plot([abs(fprime(x)), 4], x=-2*Pi/3..Pi/4, color=[black, green]);
I will use K1=4. K1=3.75 would probably do as well.
Find n so that 4*(Pi/4 - (-2*Pi/3))^2/(2*n) < = .001.
> solve(4*(Pi/4+2*Pi/3)^2/(2*n) <= .001,n);
It looks like n=16,587 will do it, but let me check:
> evalf(4*(Pi/4+2*Pi/3)^2/(2*16587));
Sure enough! If n=16,587, Ln will approximate I within .001 of its actual value.
2. Find n so that Tn approximates I within .001 of its actual value.
Because f is not monotone, we cannot use Theorem 1.
Use Theorem 3:
|I-Tn|<=K2*(b-a)^3/12n^2
We want |I-Tn|<=.001.
If we find n so that
K2*(b-a)^3/12n^2 <=.001
then |I-Tn| will indeed by <=.001.
b=Pi/4
a=-2Pi/3
K2=?
K2 is greater than or equal to |f''| on [a,b]. so I need to find f'' and then graph its absolute value.
> fprime;
To take the derivative of this, I'm going to have to use the product rule and the chain rule.
> fprimeprime:= x -> 2*cos(x^2)+2*x*(-sin(x^2)*2*x);
> plot([abs(fprimeprime(x)),16], x=-2*Pi/3..Pi/4);
> plot([fprimeprime(x),16], x=-2*Pi/3..-2*Pi/3+.1);
> evalf(abs(fprimeprime(-2*Pi/3)));
K2=16 will do!
So, with a=-2Pi/3, b=Pi/4, and K2=16, I need to find n so that
K2*(b-a)^3/12n^2<=.001
> solve(16*(Pi/4+2*Pi/3)^3/(12*n^2)<=.001, n);
Looks like n=179
check:
> evalf(16*(Pi/4+2*Pi/3)^3/(12*179^2));
So if n=179, Tn will approximate I within .001 of its actual value. This is a lot better than the thousands of subintervals we'd need to ensure the left sum was sufficiently accurate! Maple takes too long adding up such huge sums!
3. Find n so that Mn approximates I within .001 of its actual value.
Use Theorem 3 again. This time, we have:
|I-Mn| <= K2*(b-a)^3/(24*n^2)
We want to find n so that
K2*(b-a)^3/(24*n^2) <= .001
a=-2Pi/3
b=Pi/4
K2=16
> solve(16*(Pi/4+2*Pi/3)^3/(24*n^2)<=.001,n);
Looks like n=127 will do
4) Which would you rather do?
On the surface, I'd rather do the midpoint sum, since it uses the fewest subintervals. On the other hand, the formula for it is somewhat more complicated.
The trapezoidal sum still uses under 200 subintervals, and I can find it by doing both the left and right sums (L200 and R200), which are much easier, and then averaging them. So I suspect I'd rather do the trapezoidal sum.