The command to use is shown below.

> int(x^2,x=0..4);

Notice that Maple gives an exact answer, as a fraction. If you want a
decimal approximation to an integral, you just put an `evalf`
command around the `int` command, as shown below.

> evalf(int(x^2,x=0..4));

To compute an indefinite integral with Maple, you just leave out the range for the limits of integration, as shown below.

> int(x^2,x);Note that Maple does not include a constant of integration.

You can also use the Maple `int` command with functions or
expressions you have defined in Maple.
For
example, suppose you wanted to find area under the curve of the
function
on the
interval . Then you can define this function in Maple with
the command

> f := x -> x*sin(x);and then use this definition as shown below.

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

You can also simply give the expression corresponding to a label in Maple, and then use that label in subsequent commands as shown below. However, notice the difference between the two methods. You are urged you to choose one or the other, so you don't mix the syntax up.

> p := x*sin(x); > int(p,x=0..Pi);If you want to find the area bounded by the graph of two functions, you should first plot both functions on the same graph. You can then find the intersection points using either the

> f := x-> -x^2+4*x+6; > g := x-> x/3+2; > plot({f(x),g(x)},x=-2..6); > a := fsolve(f(x)=g(x),x=-2..0); > b := fsolve(f(x)=g(x),x=4..6); > int(f(x)-g(x),x=a..b);

> with(CalcP7): > f := x -> x^2+1; > plot(f(x),x=-2..2); > revolve(f(x),x=-2..2); > revolve(f(x),x=-2..2,y=-2);

The `revolve` command has other options that you should read about
in the help screen. For example, you can speed the command up by only
plotting the surface generated by revolving the curve with the `nocap` argument, and you can also plot a solid of revolution formed
by revolving the area between two functions. Try the following
examples. (Note: The last example shows how to use `revolve` with
a function defined piecewise using the `piecewise` command.)

> revolve({f(x),0.5},x=-2..2,y=-1); > revolve(cos(x),x=0..4*Pi,y=-2,nocap); > revolve({5,x^2+1},x=-2..2); > g := x -> piecewise(x<0,-x+1/2,x^2-x+1/2); > revolve(g(x),x=-1..2);

Recall that if you revolve the area under the graph of
for
about the x-axis, the volume is given by

The easiest way to compute volumes of solids of revolution in Maple is just to use the

> f:= x-> sqrt(x) +1; > vol:= int(Pi*f(x)^2, x=0..9); > evalf(vol);

- Use Maple to compute the following definite integrals.
- Several years ago, Frankie Kumala (class of '98) was asked to
design a drinking glass by revolving a
suitable function about the axis. Here is the function he came
up with.

He obtained the shape of his glass by revolving this function about the axis over the interval . The Maple command he used to define this function is given below.> f := x -> piecewise(x<0,x^2+0.05,x<1,0.05,cos(x));

Plot this function (without revolving it) over the interval and identify the formula for each part of the graph. Then, revolve this function about the axis over the same interval and comment on the glass Frankie designed. Finally, compute the volume of the part of this glass that could be filled with liquid, assuming the stem is solid. (Hint - your integral will involve only one of the formulas used to define the function.)

- If you have time, design your own drinking glass by defining a function that, when revolved, produces a pleasing shape.

2003-09-05