Suppose that **D** is a rectangular region in the the **x-y** plane, and
that is a continuous, non-negative function on **D**. Then the
volume of the solid above **D** and below is given by the
double integral

We learned in class that such integrals can be evaluated by either of the iterated integrals

or

where the rectangle **D** is defined by the inequalities and .

Using Maple to evaluate double integrals proceeds in exactly the same fashion. For example, the following Maple session shows the computation of

for both orders of integration.

> int(int(x^2+y^2,x=-2..1),y=0..1);

> int(int(x^2+y^2,y=0..1),x=-2..1);

More complicated integrals are handled similarly. Suppose that we have
and we want to know the volume of the solid
between the region in the **x-y** plane bounded by the circle
and the graph of . Then an appropriate
integral is

Using Maple, we calculate this as

> int(int(x^2+y^2,y=-sqrt(1-(x-1)^2)..sqrt(1-(x-1)^2)),x=0..2);

Maple can also help you visualize the solids whose volumes you are
computing. Here we go through several Maple commands related
to the solid of the last example. We will plot cross-sections
through the solid as well as its sides, top, and bottom. To do this in
Maple, some of the plots have to be in parametric form, which means we
represent a surface by three coordinate functions ,
, and . We also use a special trick to plot a function
over
a region in the plane defined by an **x**-interval,
and two functions and with a command of the
following form,

> plot3d(h(x,y),x=a..b,y=f(x)..g(x);

assuming that forms the lower boundary and the upper
boundary of the region. Read
the help for `plot3d` for more details. Note that the **x** range,
`x=a..b`, *must* come first. Note also that we can plot
regions in the **x-y** plane with a similar command simply by using
.

In the Maple commands shown
below, first the `plots` package is loaded, and then a plot
of the region in
the **x-y** plane that forms the base of the solid is created. This region is the
same as the domain of integration we used above to compute the volume of the
solid. Note that we give the plot a label, and end
the command with a colon, not the usual semi-colon. The label is
important because we
want to display several plots on the same graph and the colon
suppresses the output of the command. (If you want to see this output,
use a semi-colon instead.) The final command defines our function.

> with(plots):

> base := plot3d(0,x=0..2,y=-sqrt(1-(x-1)^2)..sqrt(1-(x-1)^2)):

> f := (x,y) -> x^2+y^2;

The next two Maple commands create plots of cross-sections
through the solid for **x=1** and . The `display3d` command
actually displays the base of the solid and the two cross-sections.

> cross1 := plot3d([1,t,s*f(1,t)],t=-1..1,s=0..1):

> cross2 := plot3d([0.5,t*sqrt(1-1/4),s*f(0.5,t*sqrt(1-1/4))],t=-1..1,s=0..1):

> display3d({base,cross1,cross2},labels=[x,y,z],axes=boxed);

The three commands below generate a plot of the lateral boundary of the solid,
a plot of the top of the solid, and finally display the
solid with
a `display3d` command.

> side := plot3d([1+cos(t),sin(t),s*f(1+cos(t),sin(t))],t=0..2*Pi,s=0..1):

> top := plot3d(f(x,y),x=0..2,y=-sqrt(1-(x-1)^2)..sqrt(1-(x-1)^2)):

> display3d({side,top,base},labels=[x,y,z],axes=boxed);

The `display3d` command may not be familiar to you, but it
provides an easy way to display multiple three dimensional plots at
the same time. It also allows you to set some options for the plot, as
we did above to add axes and labels to the plot.

To help you understand where these Maple commands came from, first
consider the cross-section for . For this value of **x**, we get
from the equation the two roots and
. So now we have the parametric description
and for , of the line
joining these two
roots. Suppose is a point on this line. The solid contains
a vertical line segment above this point until we run into
. We parametrize this vertical line segment by **s**, so
that when **s=0** we are at the point and when **s=1** we are
at . So, finally, we represent the cross section through the
solid as the parametric surface , , and .

To generate the lateral surface of the solid, we do the same sort of thing for all the points on the boundary of the region. That is, if the boundary of the region is described by a parametric curve , , then the lateral surface can be plotted with a command of the following form.

> plot3d([x(t),y(t),s*f(x(t),y(t))],t=a..b,s=0..1);

Defining and in your Maple session might be a good idea, since it will save some typing.

Plotting the top of the solid is a little easier. Suppose that
the region is such that the volume can be computed with a one double
integral, with **x** being the outer variable of integration. This means
that the boundary can be decomposed into two curves and
with , where ``**u**'' and ``**l**'' stand for
upper and lower. For
example, for our region bounded by the circle , the
two curves are and , with . Then the top of our solid
is generated by a Maple command of the form

> plot3d(f(x,y),x=0..2,y=-sqrt(1-(x-1)^2)..sqrt(1-(x-1)^2));

Sun Sep 10 17:29:28 EDT 1995