Visualizing multiple integrals
> with(plots):
Warning, the name changecoords has been redefined
Example 1
> f:=(x,y) -> 9-x^2-y^2;
> p1:=plot3d({f(x,y),0},x=-2..2,y=-2..2,axes=boxed,labels=["x axis","y axis","z axis"]):
>
p2:=plot3d([-2, y, z], y=-2..2, z=0..f(-2,y)):
This creates the vertical face along the plane
>
p3:=plot3d([x, 2, z], x=-2..2, z=0..f(x,2)):
This creates the vertical face along the plane
> display({p1,p2,p3});
> int(int(f(x,y), y=-2..2), x=-2..2); It is shockingly easy to evaluate integrals exactly!
Example 2
> f:=(x,y) -> 9-x^2-y^2;
> p1:=plot3d({f(x,y),0},x=-2..2,y=-2..1-x,axes=boxed,labels=["x axis","y axis","z axis"]):
> p2:=plot3d([x, 1-x, z], x=-2..2, z=0..f(x,1-x)):
> p3:=plot3d([2, y, z], y=-2..-1, z=0..f(2,y)):
> display({p1,p2,p3}); Notice that the graph of the function actually goes below the xy plane. This part of the volume counts negatively.
> int(int(f(x,y), y=-2..1-x), x=-2..2); evalf(%); Notice that the variable limits of integration are handled quite easily.
> evalf(Int(Int(f(x,y), y=-2..1-x), x=-2..2)); If Maple can't do the integral exactly, you can approximate it numerically using this command.
Example 3
> f:=(x,y) -> 5 + cos(x)*cos(y);
> p1:=plot3d({f(x,y),0},x=0..3*Pi,y=6*Pi-2*x..6*Pi,axes=boxed,labels=["x axis","y axis","z axis"]):
> p2:=plot3d([x,6*Pi-2*x,z],x=0..3*Pi,z=0..f(x,6*Pi-2*x)):
> p3:=plot3d([3*Pi,y,z], y=0..6*Pi,z=0..f(3*Pi,y)):
> p4:=plot3d([x,6*Pi,z], x=0..3*Pi, z=0..f(x,6*Pi)):
> display({p4,p2,p3,p1}); The only trouble is that the y axis is labeled z. I don't know why!
> int(int(f(x,y), y=6*Pi-2*x..6*Pi), x=0..3*Pi);