CHAPTER 4 - Integration

Section 4.1, page 280

Problem 41

Maple just does these.

>   Int(-3*(csc(x))^2,x)=int(-3*(csc(x))^2,x);

Int(-3*csc(x)^2,x) = 3*cos(x)/sin(x)

This is 3cot(x) of course, but note that Maple doesn't add the "+C" when it does anti-derivatives.

Section 4.3, page 296

Problem 52

There are two ways to solve this problem. First, we can just integrate (and put in the "+C" ourselves):

>   y:=int(4*x*(x^2+8)^(-1/3),x)+C;

y := 3*(x^2+8)^(2/3)+C

Next, find C to satisfy the initial condition:

>   simplify(solve(subs(x=0,y)=0,C));

-12

Now put this value of C back into y to get the answer:

>   subs(C=-12,y);

3*(x^2+8)^(2/3)-12

The other way to solve this problem is to use the "dsolve" command on the differential equation and initial condition as follows:

>   restart;

>   simplify(dsolve({diff(y(x),x)=4*x*(x^2+8)^(-1/3),y(0)=0},y(x)));

y(x) = 3*(x^2+8)^(2/3)-12

It's reassuriung that the answers are the same!

Section 4.5, page 320

Problem 20

Maple knows how to do sums, too:

>   Sum(k,k=1..13)=sum(k,k=1..13);

Sum(k,k = 1 .. 13) = 91

>   Sum(k^2,k=1..13)=sum(k^2,k=1..13);

Sum(k^2,k = 1 .. 13) = 819

>   Sum(k^3,k=1..13)=sum(k^3,k=1..13);

Sum(k^3,k = 1 .. 13) = 8281

Problem 29

Maple has commands in the "student" library for drawing the rectangles associated

to various Riemann sums:

>   f:=x^2-1;

f := x^2-1

>   with(student):

>   leftbox(f,x=0..2,4);

[Maple Plot]

>   middlebox(f,x=0..2,4);

[Maple Plot]

>   rightbox(f,x=0..2,4);

[Maple Plot]

We can also evaluate the corresponding Riemann sums:

>   leftsum(f,x=0..2,4),middlesum(f,x=0..2,4),rightsum(f,x=0..2,4);

1/2*Sum(1/4*i^2-1,i = 0 .. 3), 1/2*Sum((1/2*i+1/4)^2-1,i = 0 .. 3), 1/2*Sum(1/4*i^2-1,i = 1 .. 4)

and find their values:

>   value(leftsum(f,x=0..2,4)),value(middlesum(f,x=0..2,4)),value(rightsum(f,x=0..2,4));

-1/4, 5/8, 7/4

Compare these to the actual integral:

>   int(f,x=0..2);

2/3

We'll need more rectangles to get a better approximation.

Section 4.6, page 330

Problem 30

The average value of a function on an interval is its integral divided by the length of the interval. So for this problem,

>   avg:=int(3*x^2-3,x=0..1)/(1-0);

avg := -2

We are also asked to find where the function assumes its average:

>   solve(3*x^2-3=avg,x);

1/3*3^(1/2), -1/3*3^(1/2)

Only the first of these is in the interval, however.

Section 4.7, page 338

Problem 85

(a) We start by defining the requisite functions:

>   f:=x->sin(2*x)*cos(x/3);

f := proc (x) options operator, arrow; sin(2*x)*cos(1/3*x) end proc

>   F:=x->int(f(t),t=0..x);

F := proc (x) options operator, arrow; int(f(t),t = 0 .. x) end proc

>   plot({f(x),F(x)},x=0..2*Pi,color=blue,thickness=2);

[Maple Plot]

>   G:=D(F);

G := f

Note that Maple knows the fundamental theorem! Since F was defined as the integral of f, it gave immediately that the derivative of F is f.

>   G(x);

sin(2*x)*cos(1/3*x)

(b)

>   solve(G(x)=0);

0

Maple gives only one solution of G(x)=0, but we suspect there are more (we saw them on the graph -- one between 1 and 2, another between 3 and 4, perhaps another between 4 and 5), since G(x) is a periodic, trigonometric function. Let's try "fsolving" for them:

>   fsolve(G(x)=0,x=1..2);fsolve(G(x)=0,x=3..4);fsolve(G(x)=0,x=4..5);

1.570796327

3.141592654

4.712388980

That looks like Pi/4, Pi and 3*Pi/2.

(c) Of course, since f is the derivative of F, we see that f is positive when F is increasing (check out the graph). So F is increasing on [0, Pi/2], and then on [Pi, 2*Pi].

(d) The derivative of f is the second derivative of F, so f ' should reflect the concavity of F, and zeroes of f ' should be inflection points:

 

>   plot({diff(f(x),x),F(x)},x=0..2*Pi,color=blue,thickness=2);

[Maple Plot]

Section 4.8, page 344

Problem 27

To find the area, we need to integrate the function -y over the region, since y is negative:

>   y:=3*sin(x)*sqrt(1+cos(x));

y := 3*sin(x)*(1+cos(x))^(1/2)

>   plot(y,x=-Pi..0,color=blue,thickness=2);

[Maple Plot]

>   area:=int(-y,x=-Pi..0);

area := 4*2^(1/2)

Section 4.9, page 353

Problem 7

We will use the commands "trapezoid" and "simpson" from the student library:

>   with(student,trapezoid,simpson):

Let's calculate the actual integral first:

>   exact:=int(1/s^2,s=1..2);

exact := 1/2

OK, next up is the trapezoidal rule:

>   tapp:=trapezoid(1/s^2,s=1..2,4);

tapp := 5/32+1/4*Sum(1/((1+1/4*i)^2),i = 1 .. 3)

>   value(%);

179573/352800

>   tapp:=evalf(%);

tapp := .5089937642

Pretty close, how about Simpson's rule?

>   sapp:=evalf(simpson(1/s^2,s=1..2,4));

sapp := .5004176115

Even better.  Now for error estimates. For trapezoidal error we need an upper bound on the second derivative of the integrand, and for Simpson's error we need a bound on the fourth derivative:

>   diff(1/s^2,s$2); diff(1/s^2,s$4);

6/s^4

120/s^6

Since these are decreasing functions for positive s, the upper bounds occur at the left point of our interval, i.e., at s=1. Now we plug into formulas (3) and (7) for the error bouds:

>   trapbound:=(2-1)/12*((2-1)/4)^2*6; simpbound:=(2-1)/180*((2-1)/4)^4*120;

trapbound := 1/32

simpbound := 1/384

>   evalf(trapbound),evalf(simpbound);

.3125000000e-1, .2604166667e-2

We can see that these bounds are bigger than the actual errors, which are:

>   tapp-exact,sapp-exact;

.89937642e-2, .4176115e-3

The actual percentage error in the calculations are:

>   trappcterr:=(tapp-exact)/exact*100; simppcterr:=(sapp-exact)/exact*100;

trappcterr := 1.798752840

simppcterr := .835223000e-1