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); |
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; |
Next, find C to satisfy the initial condition:
> | simplify(solve(subs(x=0,y)=0,C)); |
Now put this value of C back into y to get the answer:
> | subs(C=-12,y); |
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))); |
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^2,k=1..13)=sum(k^2,k=1..13); |
> | Sum(k^3,k=1..13)=sum(k^3,k=1..13); |
Problem 29
Maple has commands in the "student" library for drawing the rectangles associated
to various Riemann sums:
> | f:=x^2-1; |
> | with(student): |
> | leftbox(f,x=0..2,4); |
> | middlebox(f,x=0..2,4); |
> | rightbox(f,x=0..2,4); |
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); |
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)); |
Compare these to the actual integral:
> | int(f,x=0..2); |
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); |
We are also asked to find where the function assumes its average:
> | solve(3*x^2-3=avg,x); |
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:=x->int(f(t),t=0..x); |
> | plot({f(x),F(x)},x=0..2*Pi,color=blue,thickness=2); |
> | G:=D(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); |
(b)
> | solve(G(x)=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); |
That looks like , and .
(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 , and then on .
(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); |
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)); |
> | plot(y,x=-Pi..0,color=blue,thickness=2); |
> | area:=int(-y,x=-Pi..0); |
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); |
OK, next up is the trapezoidal rule:
> | tapp:=trapezoid(1/s^2,s=1..2,4); |
> | value(%); |
> | tapp:=evalf(%); |
Pretty close, how about Simpson's rule?
> | sapp:=evalf(simpson(1/s^2,s=1..2,4)); |
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); |
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; |
> | evalf(trapbound),evalf(simpbound); |
We can see that these bounds are bigger than the actual errors, which are:
> | tapp-exact,sapp-exact; |
The actual percentage error in the calculations are:
> | trappcterr:=(tapp-exact)/exact*100; simppcterr:=(sapp-exact)/exact*100; |