104-feb8-inclass-answers

> f:= x -> sin(x^2);

f := proc (x) options operator, arrow; sin(x^2) end...

> plot(f(x),x=0 .. Pi, filled=true, color=grey);

[Maple Plot]

What happens if we try to antidifferentiate sin(x^2) using Maple?

> int(f(x),x);

1/2*sqrt(2)*sqrt(Pi)*FresnelS(sqrt(2)*x/(sqrt(Pi)))...

Okay, what if we tried to find the area between a and b using Maple?

> int(f(x),x=-2*Pi/3 .. Pi/4);

1/2*FresnelS(1/4*sqrt(2)*sqrt(Pi))*sqrt(2)*sqrt(Pi)...

In neither case did we get a result we understand.

So ... we want to approximate the area.

1 (a) Is f monotone?

f is not monotone , so we can not use Theorem 1 to find the error bounds when approximating using left, right, or trapezoidal sum.

1 (b) How closely will L_500 approximate I? R_500?

Notice that we are not asked to actually *find* L_500 or R_500!

Use Theorem 2:

|I-L_n| <= K1*(b-a)^2/(2n)

n=500,

b=Pi,

a=0.

We need to find K1.

K1 is any number greater than or equal to the maximum of the slope of f.

> fprime:= x -> 2*x*cos(x^2);

fprime := proc (x) options operator, arrow; 2*x*cos...

Choose a value for K1 by looking at the graph of |f'(x)|:

> plot([abs(fprime(x)), 7], x=0..Pi, color=[black, green]);

[Maple Plot]

We'll use K1=7. (Note that we could try to get K1 closer to the actual maximumof |f'(x)|.

Calculate the error bound:

> 7*(Pi-0)^2/(2*500);

7/1000*Pi^2

> evalf(%);

.6908723083e-1

Thus L_500 and R_500 are within .0691 of I.

Notice I can not say that L_500 and R_500 are within .069 of I!

1(c) Use L_n to approximate I within .001 of its actual value.

We want the actual error, |I-L_n|, to be less than or equal to .01. If we make the error bound be less than or equal to .001, then |I-L_n| is sure to be as well.

So we need to find n so that K1*(b-a)^2/(2n) <= .01.

a=0,

b=Pi

K1=7

n=?

I need to find n so that 7*(Pi - 0)^2/(2*n) <= .01.

> solve(7*(Pi)^2/(2*n) <= .01,n);

RealRange(-infinity,Open(0.)), RealRange(3454.36154...

It looks like n=3,455 will do it, but let me check:

> evalf(7*(Pi)^2/(2*3455));

.9998152073e-2

>

Sure enough!

Thus

> Ln := (Pi/3455)*Sum(sin((i*Pi/3455)^2),i=0..3454);

Ln := 1/3455*Pi*Sum(sin(1/11937025*i^2*Pi^2),i = 0 ...

approximates the integral to within .001.

Let's see if Maple can do it.

> evalf(%);

.7728469561

It takes Maple a while, but Maple can do it!

2.

> f:= x -> -2*ln(1+x^2);

f := proc (x) options operator, arrow; -2*ln(x^2+1)...

> plot(f(x),x=-1..2);

[Maple Plot]

2a) Is f monotone over [-1,2]?

f is not monotone and so Thm 1 does not apply.

2b) How closely will R500 approximate I?

Using Thm 2, the error using R500 will be less than:

K1*(b-a)^2/(2n).

b=2

a=-1

n=500

What's K1? Any upper bound on |f ' (x)|.

Look at graph of f ' (x):

> fprime := x -> -2*(1/(x^2+1))*2*x;

fprime := proc (x) options operator, arrow; -4*x/(x...

> plot([2,abs(fprime(x))], x=-1..2);

[Maple Plot]

It looks like the maximum is actually 2. To check this I would need to zoom in or take the derivative. Time is pressing, so I'll use K1=2.1 to be sure.

Thus the error using R500 is

> 2.1*(2+1)^2/(2*500);

.1890000000e-1

Thus the error is less than .019 when we use R500.

2c) Use Rn to approximate I to within .01.

K1=2.1

a=-1

b=2

n=?

> solve(2.1*(3)^2/(2*n)<=.01,n);

RealRange(-infinity,Open(0.)), RealRange(945.,infin...

check:

> 2.1*9/(2*945);

.1000000000e-1

> Rn:= (3/945)*Sum(-2*ln(1+(3*i/945)^2), i=1..945);

Rn := 1/315*Sum(-2*ln(1+1/99225*i^2),i = 1 .. 945)

> evalf(%);

-6.819004452

>