Application Center - Maplesoft

App Preview:

Volume of a 4-D sphere

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

muint.mws

The Volume of a 4-Dimensional Sphere

and Other Multiple Integrals

Using Maple and the vec_calc Package

In this worksheet we will see how to compute multiple integrals using Maple and the vec_calc package. The student package has the commands Doubleint and Tripleint for computing double and triple integrals. The vec_calc package has the command Multipleint which can compute multiple integrals of any dimension. In addition the multipleint command can display all the intermediate steps. As examples, we will consider problems which

* Compute a 5-Dimensional Integral and Display the Steps

* Interchange the Order of Integration

* Compute an Integral in Curvilinear Coordinates

* Compute the Volume of a 4-Dimensional Sphere

We start by initializing the vec_calc package:

> restart;

> libname:="C:/mylib/vec_calc7", libname:

> with(vec_calc): vc_aliases:

> with(linalg):with(student):with(plots):

Warning, the protected names norm and trace have been redefined and unprotected

Warning, the name changecoords has been redefined

Compute a 5-Dimensional Integral and Display the Steps

To compute the integral Int(Int(Int(Int(Int(x^2*y^3*z*cos(theta)*sin(phi),x... enter the integral using

> Muint(x^2*y^3*z*cos(theta)*sin(phi), x=2..4, y=-1..2, z=1..4, theta=0..Pi/2, phi=0..Pi/4);

Int(Int(Int(Int(Int(x^2*y^3*z*cos(theta)*sin(phi),x...

and compute it using

> value(%);

-525/2*sqrt(2)+525

Note: It is usually best to put the Muint and value commands on the same line. Then if you change the integral, the value automatically updates. This will be done throughout the rest of this worksheet.

You can also compute the answer directly using muint instead of Muint:

> muint(x^2*y^3*z*cos(theta)*sin(phi), x=2..4, y=-1..2, z=1..4, theta=0..Pi/2, phi=0..Pi/4);

-525/2*sqrt(2)+525

However, this should only be done in the middle of a program where there is no human to look at the output. In normal interactive use, you should use Muint, look at the result to be sure you typed it correctly, and only then use value to compute it.

The muint command can also be used to show all the intermediate steps of the computation:

> simplify(muint(x^2*y^3*z*cos(theta)*sin(phi), x=2..4, y=-1..2, z=1..4, theta=0..Pi/2, phi=0..Pi/4, step));

Int(Int(Int(Int(Int(x^2*y^3*z*cos(theta)*sin(phi),x...

` ` = Int(Int(Int(Int(vector([1/3*x^3*y^3*z*cos(the...

` ` = Int(Int(Int(Int(56/3*y^3*z*cos(theta)*sin(phi...

` ` = Int(Int(Int(vector([14/3*y^4*z*cos(theta)*sin...

` ` = Int(Int(Int(70*z*cos(theta)*sin(phi),z = 1 .....

` ` = Int(Int(vector([35*z^2*cos(theta)*sin(phi)])*...

` ` = Int(Int(525*cos(theta)*sin(phi),theta = 0 .. ...

` ` = Int(vector([525*sin(phi)*sin(theta)])*matrix(...

` ` = Int(525*sin(phi)*sin(1/2*Pi)-525*sin(phi)*sin...

` ` = vector([-525*sin(1/2*Pi)*cos(phi)+525*sin(0)*...

` ` = -525*sin(1/2*Pi)*cos(1/4*Pi)+525*sin(0)*cos(1...

-525/2*sqrt(2)+525

>

Interchange the Order of Integration

A typical problem in multivariable calculus is to compute the integral Int(Int(sin(x^2),x = y .. sqrt(Pi)),y = 0 .. sqrt(P... . To do this by hand, we need to reverse the order of integration. So we first plot the region. From the limits we have 0 <= y ` ` <= sqrt(Pi) and y <= x ` ` <= sqrt(Pi) . So the region is

> with(plottools):

Warning, the name arrow has been redefined

> display(polygon([[0,0], [sqrt(Pi),0], [sqrt(Pi),sqrt(Pi)]]), color=red, scaling=constrained);

[Maple Plot]

So the limits can also be taken as 0 <= x ` ` <= sqrt(Pi) and 0 <= y ` ` <= x . In this order the integral is which can easily be computed:

> simplify(muint(sin(x^2), y=0..x, x=0..sqrt(Pi), step));

Int(Int(sin(x^2),y = 0 .. x),x = 0 .. sqrt(Pi))

` ` = Int(vector([sin(x^2)*y])*matrix([[``[y = x]],...

` ` = Int(sin(x^2)*x,x = 0 .. sqrt(Pi))

` ` = vector([-1/2*cos(x^2)])*matrix([[``[x = sqrt(...

` ` = -1/2*cos(Pi)+1/2*cos(0)

1

With Maple, it may not be necessary to interchange the order. We can also compute the integral in the original order:

> Muint(sin(x^2), x=y..sqrt(Pi), y=0..sqrt(Pi)); value(%);

Int(Int(sin(x^2),x = y .. sqrt(Pi)),y = 0 .. sqrt(P...

1/2*FresnelS(sqrt(2))*sqrt(2)*Pi-1/12*Pi^2*hypergeo...

Unfortunately, Maple is unable to simplify this to 1:

> simplify(%);

1/2*FresnelS(sqrt(2))*sqrt(2)*Pi-1/12*Pi^2*hypergeo...

However, it can get a decimal value which is almost correct:

> evalf(%);

.9999999999

On the other hand, the muint command with the step parameter can do even better:

> muint(sin(x^2), x=y..sqrt(Pi), y=0..sqrt(Pi), step): simplify(%);

Int(Int(sin(x^2),x = y .. sqrt(Pi)),y = 0 .. sqrt(P...

` ` = Int(vector([1/2*sqrt(2)*sqrt(Pi)*FresnelS(2^(...

` ` = Int(1/2*FresnelS(sqrt(2))*sqrt(2)*sqrt(Pi)-1/...

` ` = vector([1/2*FresnelS(sqrt(2))*sqrt(2)*sqrt(Pi...

` ` = 1/2*FresnelS(sqrt(2))*sqrt(2)*Pi-1/2*Pi*(Fres...

1

I don't know why the value command gives the answer in a different form.

>

Compute an Integral in Curvilinear Coordinates

We want to compute the integral Int(Int(exp(x*y),x),y) over the regoin bounded by the curves y = 1/x , y = 4/x , y = x and y = 9*x .

We first plot the region:

> plot([1/x, 4/x, x, 9*x], x=0..3, y=0..7, color=[red, blue, green, maroon]);

[Maple Plot]

From the form of the boundary curves, we take the curvilinear coordinates as

> eqsuv:={u=x*y, v=y/x};

eqsuv := {u = x*y, v = y/x}

so that the limits are u = 1 , u = 4 , v = 1 and v = 9 . To convert the integral, we need to find the Jacobian and re-express the integrand in terms of u and v . To do this, we first express x and y in terms of u and v .

> solve(eqsuv,{x,y}); allvalues(%); eqsxy:=%[1];

{y = v*RootOf(-u+_Z^2*v,label = _L1), x = RootOf(-u...

{x = sqrt(u/v), y = v*sqrt(u/v)}, {y = -v*sqrt(u/v)...

eqsxy := {x = sqrt(u/v), y = v*sqrt(u/v)}

We use these equations to define a curvilinear coordinate system as a pair of functions:

> UV:=MF([u,v], subs(eqsxy,[x,y]));

UV := [proc (u, v) options operator, arrow; sqrt(u/...

From this we can find the Jacobian determinant:

> J:=JAC_DET(UV);

J := proc (u, v) options operator, arrow; 1/2*1/v e...

The integrand is

> integ:=exp(x*y);

integ := exp(x*y)

which becomes

> integ:=subs(eqsxy,integ);

integ := exp(u)

So the integral becomes

> Muint(integ*J(u,v), u=1..4, v=1..9); value(%);

Int(Int(1/2*exp(u)/v,u = 1 .. 4),v = 1 .. 9)

ln(3)*exp(4)-ln(3)*exp(1)

>

Compute the Volume of a 4-Dimensional Sphere

We will compute the 4-dimensional volume of a 4-dimensional sphere of radius R .

Spherical coordinates in 4-dimension are given by

> x0:=rho*sin(chi)*sin(phi)*cos(theta);
y0:=rho*sin(chi)*sin(phi)*sin(theta);
z0:=rho*sin(chi)*cos(phi);
w0:=rho*cos(chi);

x0 := rho*sin(chi)*sin(phi)*cos(theta)

y0 := rho*sin(chi)*sin(phi)*sin(theta)

z0 := rho*sin(chi)*cos(phi)

w0 := rho*cos(chi)

Here theta is defined on [0, 2*Pi] , while phi and chi are defined on [0, Pi] .

To find the Jacobian, we first define the coordinate system as a function

> T:=MF([rho,chi,phi,theta],[x0,y0,z0,w0]);

T := [proc (rho, chi, phi, theta) options operator,...

So the Jacobian is

> J:=JAC_DET(T);

J := proc (rho, chi, phi, theta) options operator, ...

Notice that this is negative. So we need to take the absolute value.

The volume is the 4-dimensional integral of the Jacobian:

> Muint(abs(J(rho,chi,phi,theta)), rho=0..R, chi=0..Pi, phi=0..Pi, theta=0..2*Pi); value(%);

Int(Int(Int(Int(abs((-1+cos(chi)^2)*sin(phi)*rho^3)...

1/2*Pi^2*R^4*signum(R)^3

>

>