Application Center - Maplesoft

App Preview:

Stokes' Theorem

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

Learn about Maple
Download Application


 

Image 

Stokes' Theorem
Attila Andai
Mathematical Institute, Budapest University of Technology and Economics
 

Hungary 

andaia@math.bme.hu
This Maple worksheet demonstrates Stokes' Theorem.
 

 

Image 

Mathematical implementation of Stokes' Theorem 

 

In this section we explain the mathematical implementation of the Theorem, using an example. 

We consider a five dimensional Euclidean vector space V. The manifold G is the closed sphere with radius rho and center origin. 

> restart;
 

> with(tensor):
with(linalg):
with(combinat):
 

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

Warning, the assigned name fibonacci now has a global binding
 

Warning, the protected name Chi has been redefined and unprotected
 

Input 

N: Dimension of the vector space V.
M
: Dimension of the manifold G. 

> N:=5;
M:=5;
 

N := 5 

M := 5 

Input 

parcord: List, which contains the name of the coordinates of the manifold G, it contains M symbols. 

p[i]: Parametrization of the manifold G, the index i runs from 1 to N, and p[i] is a function of M variables. 

> parcoord:=[r,a,b,c,d];
 

parcoord := [r, a, b, c, d] 

The parametrization of the ball, with center origin, in 5 dimension is the following. 

> p[1]:=(r,a,b,c,d)->r*sin(a)*sin(b)*sin(c)*sin(d);
p[2]:=(r,a,b,c,d)->r*sin(a)*sin(b)*sin(c)*cos(d);
p[3]:=(r,a,b,c,d)->r*sin(a)*sin(b)*cos(c);
p[4]:=(r,a,b,c,d)->r*sin(a)*cos(b);
p[5]:=(r,a,b,c,d)->r*cos(a);
 

p[1] := proc (r, a, b, c, d) options operator, arrow; r*sin(a)*sin(b)*sin(c)*sin(d) end proc 

p[2] := proc (r, a, b, c, d) options operator, arrow; r*sin(a)*sin(b)*sin(c)*cos(d) end proc 

p[3] := proc (r, a, b, c, d) options operator, arrow; r*sin(a)*sin(b)*cos(c) end proc 

p[4] := proc (r, a, b, c, d) options operator, arrow; r*sin(a)*cos(b) end proc 

p[5] := proc (r, a, b, c, d) options operator, arrow; r*cos(a) end proc 

Input
parcordb
: List, which contains the name of the coordinates of the manifold G, it contains M-1 symbols.
pb[i]
: Parametrization of the manifold G, the index i runs from 1 to N, and pb[i] is a function of M-1 variables. 

> parcoordb:=[a,b,c,d];
 

parcoordb := [a, b, c, d] 

The parametrization of the sphere, with radius and center origin, in 5 dimension is the following. 

> pb[1]:=(a,b,c,d)->rho*sin(a)*sin(b)*sin(c)*sin(d);
pb[2]:=(a,b,c,d)->rho*sin(a)*sin(b)*sin(c)*cos(d);
pb[3]:=(a,b,c,d)->rho*sin(a)*sin(b)*cos(c);
pb[4]:=(a,b,c,d)->rho*sin(a)*cos(b);
pb[5]:=(a,b,c,d)->rho*cos(a);
 

pb[1] := proc (a, b, c, d) options operator, arrow; rho*sin(a)*sin(b)*sin(c)*sin(d) end proc 

pb[2] := proc (a, b, c, d) options operator, arrow; rho*sin(a)*sin(b)*sin(c)*cos(d) end proc 

pb[3] := proc (a, b, c, d) options operator, arrow; rho*sin(a)*sin(b)*cos(c) end proc 

pb[4] := proc (a, b, c, d) options operator, arrow; rho*sin(a)*cos(b) end proc 

pb[5] := proc (a, b, c, d) options operator, arrow; rho*cos(a) end proc 

>
 

Input 

coord: The coordinates of the vector space V, it contsins N symbols. 

f[,,...,]: The components of the function f, < <...<   

> coord:=[x,y,z,u,v];
 

coord := [x, y, z, u, v] 

 

Image 

> f[1,2,3,4]:=(x,y,z,u,v)->alpha*(x^3+y^3+z^3+u^3+v^3);
f[1,2,3,5]:=(x,y,z,u,v)->beta*(x+y+z+u+v);
f[1,2,4,5]:=(x,y,z,u,v)->x*y^2*z^4;
f[1,3,4,5]:=(x,y,z,u,v)->y^2*z;
f[2,3,4,5]:=(x,y,z,u,v)->y^2*u*v;
 

f[1, 2, 3, 4] := proc (x, y, z, u, v) options operator, arrow; alpha*(x^3+y^3+z^3+u^3+v^3) end proc 

f[1, 2, 3, 5] := proc (x, y, z, u, v) options operator, arrow; beta*(x+y+z+u+v) end proc 

f[1, 2, 4, 5] := proc (x, y, z, u, v) options operator, arrow; x*y^2*z^4 end proc 

f[1, 3, 4, 5] := proc (x, y, z, u, v) options operator, arrow; y^2*z end proc 

f[2, 3, 4, 5] := proc (x, y, z, u, v) options operator, arrow; y^2*u*v end proc 

The integral of the exterior derivative of the function f on the manifold G: 

 

First we create the tensorial form of the function f, using the tensorcreate function from the tensor package. 

Then it is easy to compute the exterior derivative of f, using the exterior_diff function of the tensor package. 

Tensorial form of the function f is tens.
The components of the exterior derivative of the function
f are in exttens. 

> L:=[seq(1..N,i=1..M-1)]:
tensorcreate:=array(antisymmetric, op(L)):
listtype:=[seq(-1,i=1..M-1)]:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then tensorcreate[op(zz)]:=f[op(zz)](op(coord)): end if:
end do:
tens:= create(listtype,eval(tensorcreate)):
exttens:=exterior_diff(tens,coord):
 

One can check the components of exttens. 

> get_compts(exttens):
 

The vectorial measure of the manifold G is in vectormeasure. 

> for j from 1 to M do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](p[i])(op(parcoord)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=1 then vectormeasure:=vv[1]: else vectormeasure:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M do
 vectormeasure:=exterior_prod(vectormeasure,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasure. 

> get_compts(vectormeasure):
 

The product of the exterior derivative of the function and the vectorial measure of the manifold is in summ1. 

> helye:={op([seq( coord[i]=p[i](op(parcoord)) ,i=1..N)])}:
summ1:=0:
for zz in permute(N,M) do
 wperm:=0:
 for i from 1 to M-1 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-1: end if:
 end do:
 if wperm=0 then         
 summ1:=summ1+subs(helye,get_compts(exttens)[op(zz)])*get_compts(vectormeasure)[op(zz)]:   end if:
end do:
 

One can check the first integrand summ1. 

> summ1:=expand(summ1):
 

Integrating summ1 over the parameter space, this is StLeft.  (This is the left hand side of Stokes' equation.) 

> StLeft:=int(int(int(int(int(summ1,d=0..2*Pi),c=0..Pi),b=0..Pi),a=0..Pi),r=0..rho);
 

StLeft := 8/35*Pi^2*alpha*rho^7-8/15*Pi^2*beta*rho^5 

 

Integral of the function f on the boundary of the manifold G : 

 

The vectorial measure of the boundary of the manifold G is in vectormeasureb. 

> for j from 1 to M-1 do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](pb[i])(op(parcoordb)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=2 then vectormeasureb:=vv[1]: else vectormeasureb:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M-1 do
   vectormeasureb:=exterior_prod(vectormeasureb,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasureb. 

> get_compts(vectormeasureb):
 

The product of the function f and the vectorial measure of the boundary of the manifold G is in summ2. 

> helye:={op([seq( coord[i]=pb[i](op(parcoordb)) ,i=1..N)])}:
summ2:=0:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then       summ2:=summ2+subs(helye,f[op(zz)](op(coord)))*get_compts(vectormeasureb)[op(zz)]:
 end if:
end do:
 

One can check the second integrand summ2. 

> summ2:=expand(summ2):
 

Integrating summ2 over the parameter space, this is StRight. (This is the right hand side of Stokes' equation.) 

> StRight:=int(int(int(int(summ2,d=0..2*Pi),c=0..Pi),b=0..Pi),a=0..Pi);
 

StRight := 8/35*Pi^2*alpha*rho^7-8/15*Pi^2*beta*rho^5 

The left hand side of Stokes' equation (StLeft) is equal to the right hand side (StRight). 

> simplify(StLeft-StRight);
 

0 

>
 

Some other examples: 

Stokes' Theorem 

In a 3 dimensional vector space for a 2 dimensional manifold 

 

 

Image 

> restart;
 

> with(tensor):
with(linalg):
with(combinat):
 

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

Warning, the assigned name fibonacci now has a global binding
 

Warning, the protected name Chi has been redefined and unprotected
 

Input 

N: Dimension of the vector space V.
M
: Dimension of the manifold G. 

> N:=3;
M:=2;
 

N := 3 

M := 2 

Input 

parcord: List, which contains the name of the coordinates of the manifold G, it contains M symbols. 

p[i]: Parametrization of the manifold G, the index i runs from 1 to N, and p[i] is a function of M variables. 

> parcoord:=[r,phi];
 

parcoord := [r, phi] 

> p[1]:=(r,phi)->r*cos(phi);
p[2]:=(r,phi)->r*sin(phi);
p[3]:=(r,phi)->r*cos(phi)^2;
 

p[1] := proc (r, phi) options operator, arrow; r*cos(phi) end proc 

p[2] := proc (r, phi) options operator, arrow; r*sin(phi) end proc 

p[3] := proc (r, phi) options operator, arrow; r*cos(phi)^2 end proc 

Input
parcordb
: List, which contains the name of the coordinates of the manifold G, it contains M-1 symbols.
pb[i]
: Parametrization of the manifold G, the index i runs from 1 to N, and pb[i] is a function of M-1 variables. 

> parcoordb:=[phi];
 

parcoordb := [phi] 

> pb[1]:=(phi)->R*cos(phi);
pb[2]:=(phi)->R*sin(phi);
pb[3]:=(phi)->R*cos(phi)^2;
 

pb[1] := proc (phi) options operator, arrow; R*cos(phi) end proc 

pb[2] := proc (phi) options operator, arrow; R*sin(phi) end proc 

pb[3] := proc (phi) options operator, arrow; R*cos(phi)^2 end proc 

Input 

coord: The coordinates of the vector space V, it contains N symbols.
f[i]
: The components of the function f. 

> coord:=[x,y,z];
 

coord := [x, y, z] 

> f[1]:=(x,y,z)->x^2*y;
f[2]:=(x,y,z)->y*z;
f[3]:=(x,y,z)->z^2;
 

f[1] := proc (x, y, z) options operator, arrow; x^2*y end proc 

f[2] := proc (x, y, z) options operator, arrow; y*z end proc 

f[3] := proc (x, y, z) options operator, arrow; z^2 end proc 

The integral of the exterior derivative of the function f on the manifold G: 

 

Tensorial form of the function f is tens.
The components of the exterior derivative of the function
f are in exttens. 

> L:=[seq(1..N,i=1..M-1)]:
tensorcreate:=array(antisymmetric, op(L)):
listtype:=[seq(-1,i=1..M-1)]:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then tensorcreate[op(zz)]:=f[op(zz)](op(coord)): end if:
end do:
tens:= create(listtype,eval(tensorcreate)):
exttens:=exterior_diff(tens,coord):
 

One can check the components of exttens. 

> get_compts(exttens):
 

The vectorial measure of the manifold G is in vectormeasure. 

> for j from 1 to M do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](p[i])(op(parcoord)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=1 then vectormeasure:=vv[1]: else vectormeasure:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M do
 vectormeasure:=exterior_prod(vectormeasure,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasure. 

> get_compts(vectormeasure):
 

The product of the exterior derivative of the function and the vectorial measure of the manifold is in summ1. 

> helye:={op([seq( coord[i]=p[i](op(parcoord)) ,i=1..N)])}:
summ1:=0:
for zz in permute(N,M) do
 wperm:=0:
 for i from 1 to M-1 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-1: end if:
 end do:
 if wperm=0 then
 summ1:=summ1+subs(helye,get_compts(exttens)[op(zz)])*get_compts(vectormeasure)[op(zz)]:      end if:
end do:
 

One can check the first integrand summ1. 

> summ1:=expand(summ1);
 

summ1 := -r^3*cos(phi)^2-r^2*sin(phi)*cos(phi)^3+2*r^2*sin(phi)*cos(phi) 

Integrating summ1 over the parameter space, this is StLeft. 

> StLeft:=int(int(summ1,phi=0..2*Pi),r=0..R);
 

StLeft := -1/4*Pi*R^4 

Integral of the function f on the boundary of the manifold G: 

 

The vectorial measure of the boundary of the manifold G is in vectormeasureb. 

> for j from 1 to M-1 do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](pb[i])(op(parcoordb)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=2 then vectormeasureb:=vv[1]: else vectormeasureb:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M-1 do
   vectormeasureb:=exterior_prod(vectormeasureb,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasureb. 

> get_compts(vectormeasureb):
 

The product of the function f and the vectorial measure of the boundary of the manifold G is in summ2. 

> helye:={op([seq( coord[i]=pb[i](op(parcoordb)) ,i=1..N)])}:
summ2:=0:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then       summ2:=summ2+subs(helye,f[op(zz)](op(coord)))*get_compts(vectormeasureb)[op(zz)]:
 end if:
end do:
 

One can check the first integrand summ2.  

> summ2:=expand(summ2):
 

Integrating summ2 over the parameter space, this is StRight. 

> StRight:=int(summ2,phi=0..2*Pi);
 

StRight := -1/4*Pi*R^4 

The left hand side of Stokes' equation (StLeft) is equal to the right hand side (StRight). 

> simplify(StLeft-StRight);
 

0 

>
 

Stokes' Theorem 

In a 3 dimensional vector space for a 3 dimensional manifold 

 

 

Image 

> restart;
 

> with(tensor):
with(linalg):
with(combinat):
 

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

Warning, the assigned name fibonacci now has a global binding
 

Warning, the protected name Chi has been redefined and unprotected
 

Input 

N: Dimension of the vector space V.
M
: Dimension of the manifold G. 

> N:=3;
M:=3;
 

N := 3 

M := 3 

Input 

parcord: List, which contains the name of the coordinates of the manifold G, it contains M symbols. 

p[i]: Parametrization of the manifold G, the index i runs from 1 to N, and p[i] is a function of M variables. 

> parcoord:=[r,theta,phi];
 

parcoord := [r, theta, phi] 

> p[1]:=(r,theta,phi)->r*sin(theta)*cos(phi);
p[2]:=(r,theta,phi)->r*sin(theta)*sin(phi);
p[3]:=(r,theta,phi)->r*cos(theta);
 

p[1] := proc (r, theta, phi) options operator, arrow; r*sin(theta)*cos(phi) end proc 

p[2] := proc (r, theta, phi) options operator, arrow; r*sin(theta)*sin(phi) end proc 

p[3] := proc (r, theta, phi) options operator, arrow; r*cos(theta) end proc 

Input
parcordb
: List, which contains the name of the coordinates of the manifold G, it contains M-1 symbols.
pb[i]
: Parametrization of the manifold G, the index i runs from 1 to N, and pb[i] is a function of M-1 variables. 

> parcoordb:=[theta,phi];
 

parcoordb := [theta, phi] 

> pb[1]:=(theta,phi)->R*sin(theta)*cos(phi);
pb[2]:=(theta,phi)->R*sin(theta)*sin(phi);
pb[3]:=(theta,phi)->R*cos(theta);
 

pb[1] := proc (theta, phi) options operator, arrow; R*sin(theta)*cos(phi) end proc 

pb[2] := proc (theta, phi) options operator, arrow; R*sin(theta)*sin(phi) end proc 

pb[3] := proc (theta, phi) options operator, arrow; R*cos(theta) end proc 

Input 

coord: The coordinates of the vector space V, it contains N symbols.
f[i,j]
: The components of the function f, i<j. 

> coord:=[x,y,z];
 

coord := [x, y, z] 

> f[1,2]:=(x,y,z)->y^2*z;
f[1,3]:=(x,y,z)->x^3+z^2;
f[2,3]:=(x,y,z)->x^2*y^2*z;
 

f[1, 2] := proc (x, y, z) options operator, arrow; y^2*z end proc 

f[1, 3] := proc (x, y, z) options operator, arrow; x^3+z^2 end proc 

f[2, 3] := proc (x, y, z) options operator, arrow; x^2*y^2*z end proc 

The integral of the exterior derivative of the function f on the manifold G: 

 

Tensorial form of the function f is tens.
The components of the exterior derivative of the function
f are in exttens. 

> L:=[seq(1..N,i=1..M-1)]:
tensorcreate:=array(antisymmetric, op(L)):
listtype:=[seq(-1,i=1..M-1)]:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then tensorcreate[op(zz)]:=f[op(zz)](op(coord)): end if:
end do:
tens:= create(listtype,eval(tensorcreate)):
exttens:=exterior_diff(tens,coord):
 

One can check the components of  exttens. 

> get_compts(exttens):
 

The vectorial measure of the manifold G is in vectormeasure. 

> for j from 1 to M do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](p[i])(op(parcoord)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=1 then vectormeasure:=vv[1]: else vectormeasure:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M do
 vectormeasure:=exterior_prod(vectormeasure,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasure. 

> get_compts(vectormeasure):
 

The product of the exterior derivative of the function and the vectorial measure of the manifold is in summ1. 

> helye:={op([seq( coord[i]=p[i](op(parcoord)) ,i=1..N)])}:
summ1:=0:
for zz in permute(N,M) do
 wperm:=0:
 for i from 1 to M-1 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-1: end if:
 end do:
 if wperm=0 then
 summ1:=summ1+subs(helye,get_compts(exttens)[op(zz)])*get_compts(vectormeasure)[op(zz)]:          end if:
end do:
 

One can check the first integrand summ1. 

> summ1:=expand(summ1):
 

Integrating summ1 over the parameter space, this is StLeft. 

> StLeft:=int(int(int(summ1,phi=0..2*Pi),theta=0..Pi),r=0..R);
 

StLeft := 4/15*Pi*R^5 

Integral of the function f on the boundary of the manifold G: 

 

The vectorial measure of the boundary of the manifold G is in vectormeasureb. 

> for j from 1 to M-1 do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](pb[i])(op(parcoordb)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=2 then vectormeasureb:=vv[1]: else vectormeasureb:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M-1 do
   vectormeasureb:=exterior_prod(vectormeasureb,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasureb. 

> get_compts(vectormeasureb):
 

The product of the function f and the vectorial measure of the boundary of the manifold G is in summ2. 

> helye:={op([seq( coord[i]=pb[i](op(parcoordb)) ,i=1..N)])}:
summ2:=0:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then       summ2:=summ2+subs(helye,f[op(zz)](op(coord)))*get_compts(vectormeasureb)[op(zz)]:
 end if:
end do:
 

One can check the second integrand summ2. 

> summ2:=expand(summ2):
 

Integrating summ2 over the parameter space, this is StRight. 

> StRight:=int(int(summ2,phi=0..2*Pi),theta=0..Pi);
 

StRight := 4/15*Pi*R^5 

The left hand side of Stokes' equation (StLeft) is equal to the right hand side (StRight). 

> simplify(StLeft-StRight);
 

0 

>
 

Stokes' Theorem 

In a 4 dimensional vector space for a 2 dimensional manifold 

 

 

Image 

> restart;
 

> with(tensor):
with(linalg):
with(combinat):
 

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

Warning, the assigned name fibonacci now has a global binding
 

Warning, the protected name Chi has been redefined and unprotected
 

Input 

N: Dimension of the vector space V.
M
: Dimension of the manifold G. 

> N:=4;
M:=2;
 

N := 4 

M := 2 

Input 

parcord: List, which contains the name of the coordinates of the manifold G, it contains M symbols. 

p[i]: Parametrization of the manifold G, the index i runs from 1 to N, and p[i] is a function of M variables. 

> parcoord:=[r,phi];
 

parcoord := [r, phi] 

> p[1]:=(r,phi)->r*cos(phi);
p[2]:=(r,phi)->r*sin(phi);
p[3]:=(r,phi)->r^2*cos(2*phi);
p[4]:=(r,phi)->r^2;
 

p[1] := proc (r, phi) options operator, arrow; r*cos(phi) end proc 

p[2] := proc (r, phi) options operator, arrow; r*sin(phi) end proc 

p[3] := proc (r, phi) options operator, arrow; r^2*cos(2*phi) end proc 

p[4] := proc (r, phi) options operator, arrow; r^2 end proc 

Input
parcordb
: List, which contains the name of the coordinates of the manifold G, it contains M-1 symbols.
pb[i]
: Parametrization of the manifold G, the index i runs from 1 to N, and pb[i] is a function of M-1 variables. 

> parcoordb:=[phi];
 

parcoordb := [phi] 

> pb[1]:=(phi)->R*cos(phi);
pb[2]:=(phi)->R*sin(phi);
pb[3]:=(phi)->R^2*cos(2*phi);
pb[4]:=(phi)->R^2;
 

pb[1] := proc (phi) options operator, arrow; R*cos(phi) end proc 

pb[2] := proc (phi) options operator, arrow; R*sin(phi) end proc 

pb[3] := proc (phi) options operator, arrow; R^2*cos(2*phi) end proc 

pb[4] := proc (phi) options operator, arrow; R^2 end proc 

Input 

coord: The coordinates of the vector space V, it contains N symbols. 

f[i]: The components of the function f. 

> coord:=[x,y,z,v];
 

coord := [x, y, z, v] 

> f[1]:=(x,y,z,v)->y^2*z*v;
f[2]:=(x,y,z,v)->x^3+z^2*v^2;
f[3]:=(x,y,z,v)->x*y^2*z^4;
f[4]:=(x,y,z,v)->x^2*y^2*z;
 

f[1] := proc (x, y, z, v) options operator, arrow; y^2*z*v end proc 

f[2] := proc (x, y, z, v) options operator, arrow; x^3+z^2*v^2 end proc 

f[3] := proc (x, y, z, v) options operator, arrow; x*y^2*z^4 end proc 

f[4] := proc (x, y, z, v) options operator, arrow; x^2*y^2*z end proc 

The integral of the exterior derivative of the function f on the manifold G: 

 

Tensorial form of the function f is tens.
The components of the exterior derivative of the function
f are in exttens. 

> L:=[seq(1..N,i=1..M-1)]:
tensorcreate:=array(antisymmetric, op(L)):
listtype:=[seq(-1,i=1..M-1)]:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then tensorcreate[op(zz)]:=f[op(zz)](op(coord)): end if:
end do:
tens:= create(listtype,eval(tensorcreate)):
exttens:=exterior_diff(tens,coord):
 

One can check the components of exttens. 

> get_compts(exttens):
 

The vectorial measure of the manifold G is in vectormeasure. 

> for j from 1 to M do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](p[i])(op(parcoord)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=1 then vectormeasure:=vv[1]: else vectormeasure:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M do
 vectormeasure:=exterior_prod(vectormeasure,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasure. 

> get_compts(vectormeasure):
 

The product of the exterior derivative of the function and the vectorial measure of the manifold is in summ1. 

> helye:={op([seq( coord[i]=p[i](op(parcoord)) ,i=1..N)])}:
summ1:=0:
for zz in permute(N,M) do
 wperm:=0:
 for i from 1 to M-1 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-1: end if:
 end do:
 if wperm=0 then
 summ1:=summ1+subs(helye,get_compts(exttens)[op(zz)])*get_compts(vectormeasure)[op(zz)]:      end if:
end do:
 

One can check the first integrand summ1. 

> summ1:=expand(summ1):
 

Integrating summ1 over the parameter space, this is StLeft. 

> StLeft:=int(int(int(summ1,phi=0..2*Pi),theta=0..Pi),r=0..R);
 

StLeft := 3/4*Pi^2*R^4 

Integral of the function f on the boundary of the manifold G: 

 

The vectorial measure of the boundary of the manifold G is in vectormeasureb. 

> for j from 1 to M-1 do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](pb[i])(op(parcoordb)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=2 then vectormeasureb:=vv[1]: else vectormeasureb:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M-1 do
   vectormeasureb:=exterior_prod(vectormeasureb,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasureb. 

> get_compts(vectormeasureb):
 

The product of the function f and the vectorial measure of the boundary of the manifold G is in summ2. 

> helye:={op([seq( coord[i]=pb[i](op(parcoordb)) ,i=1..N)])}:
summ2:=0:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then       summ2:=summ2+subs(helye,f[op(zz)](op(coord)))*get_compts(vectormeasureb)[op(zz)]:
 end if:
end do:
 

One can check the second integrand summ2. 

> summ2:=expand(summ2):
 

Integrating summ2 over the parameter space, this is StRight. 

> StRight:=int(int(summ2,phi=0..2*Pi),theta=0..Pi);
 

StRight := 3/4*Pi^2*R^4 

The left hand side of Stokes' equation (StLeft) is equal to the right hand side (StRight). 

> simplify(StLeft-StRight);
 

0 

>
 

Stokes' Theorem 

In a 4 dimensional vector space for a 3 dimensional manifold 

 

 

Image 

> restart;
 

> with(tensor):
with(linalg):
with(combinat):
 

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

Warning, the assigned name fibonacci now has a global binding
 

Warning, the protected name Chi has been redefined and unprotected
 

Input 

N: Dimension of the vector space V.
M
: Dimension of the manifold G. 

> N:=4;
M:=3;
 

N := 4 

M := 3 

Input 

parcord: List, which contains the name of the coordinates of the manifold G, it contains M symbols. 

p[i]: Parametrization of the manifold G, the index i runs from 1 to N, and p[i] is a function of M variables. 

> parcoord:=[r,theta,phi];
 

parcoord := [r, theta, phi] 

> p[1]:=(r,theta,phi)->r*sin(theta)*cos(phi);
p[2]:=(r,theta,phi)->r*sin(theta)*sin(phi);
p[3]:=(r,theta,phi)->r*cos(theta);
p[4]:=(r,theta,phi)->r*cos(theta)^2;
 

p[1] := proc (r, theta, phi) options operator, arrow; r*sin(theta)*cos(phi) end proc 

p[2] := proc (r, theta, phi) options operator, arrow; r*sin(theta)*sin(phi) end proc 

p[3] := proc (r, theta, phi) options operator, arrow; r*cos(theta) end proc 

p[4] := proc (r, theta, phi) options operator, arrow; r*cos(theta)^2 end proc 

Input
parcordb
: List, which contains the name of the coordinates of the manifold G, it contains M-1 symbols.
pb[i]
: Parametrization of the manifold G, the index i runs from 1 to N, and pb[i] is a function of M-1 variables. 

> parcoordb:=[theta,phi];
 

parcoordb := [theta, phi] 

> pb[1]:=(theta,phi)->R*sin(theta)*cos(phi);
pb[2]:=(theta,phi)->R*sin(theta)*sin(phi);
pb[3]:=(theta,phi)->R*cos(theta);
pb[4]:=(theta,phi)->R*cos(theta)^2;
 

pb[1] := proc (theta, phi) options operator, arrow; R*sin(theta)*cos(phi) end proc 

pb[2] := proc (theta, phi) options operator, arrow; R*sin(theta)*sin(phi) end proc 

pb[3] := proc (theta, phi) options operator, arrow; R*cos(theta) end proc 

pb[4] := proc (theta, phi) options operator, arrow; R*cos(theta)^2 end proc 

Input 

coord: The coordinates of the vector space V, it contains N symbols.
f[i,j]
: The components of the function f, i<j. 

> coord:=[x,y,z,v];
 

coord := [x, y, z, v] 

> f[1,2]:=(x,y,z,v)->y^2*z*v;
f[1,3]:=(x,y,z,v)->x^3+z^2*v^2;
f[1,4]:=(x,y,z,v)->x*y^2*z^4;
f[2,3]:=(x,y,z,v)->x^2*y^2*z;
f[2,4]:=(x,y,z,v)->x^3-2*z^2*v;
f[3,4]:=(x,y,z,v)->x^4*y^2*z^2;
 

f[1, 2] := proc (x, y, z, v) options operator, arrow; y^2*z*v end proc 

f[1, 3] := proc (x, y, z, v) options operator, arrow; x^3+z^2*v^2 end proc 

f[1, 4] := proc (x, y, z, v) options operator, arrow; x*y^2*z^4 end proc 

f[2, 3] := proc (x, y, z, v) options operator, arrow; x^2*y^2*z end proc 

f[2, 4] := proc (x, y, z, v) options operator, arrow; x^3-2*z^2*v end proc 

f[3, 4] := proc (x, y, z, v) options operator, arrow; x^4*y^2*z^2 end proc 

The integral of the exterior derivative of the function f on the manifold G: 

 

Tensorial form of the function f is tens.
The components of the exterior derivative of the function
f are in exttens. 

> L:=[seq(1..N,i=1..M-1)]:
tensorcreate:=array(antisymmetric, op(L)):
listtype:=[seq(-1,i=1..M-1)]:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then tensorcreate[op(zz)]:=f[op(zz)](op(coord)): end if:
end do:
tens:= create(listtype,eval(tensorcreate)):
exttens:=exterior_diff(tens,coord):
 

One can check the components of exttens. 

> get_compts(exttens):
 

The vectorial measure of the manifold G is in vectormeasure. 

> for j from 1 to M do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](p[i])(op(parcoord)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=1 then vectormeasure:=vv[1]: else vectormeasure:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M do
 vectormeasure:=exterior_prod(vectormeasure,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasure. 

> get_compts(vectormeasure):
 

The product of the exterior derivative of the function and the vectorial measure of the manifold is in summ1. 

> helye:={op([seq( coord[i]=p[i](op(parcoord)) ,i=1..N)])}:
summ1:=0:
for zz in permute(N,M) do
 wperm:=0:
 for i from 1 to M-1 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-1: end if:
 end do:
 if wperm=0 then
 summ1:=summ1+subs(helye,get_compts(exttens)[op(zz)])*get_compts(vectormeasure)[op(zz)]:      end if:
end do:
 

One can check the first integrand summ1. 

> summ1:=expand(summ1):
 

Integrating summ1 over the parameter space, this is StLeft. 

> StLeft:=int(int(int(summ1,phi=0..2*Pi),theta=0..Pi),r=0..R);
 

StLeft := 4/35*Pi*R^6 

Integral of the function f on the boundary of the manifold G: 

 

The vectorial measure of the boundary of the manifold G is in vectormeasureb. 

> for j from 1 to M-1 do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](pb[i])(op(parcoordb)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=2 then vectormeasureb:=vv[1]: else vectormeasureb:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M-1 do
   vectormeasureb:=exterior_prod(vectormeasureb,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasureb. 

> get_compts(vectormeasureb):
 

The product of the function f and the vectorial measure of the boundary of the manifold G is in summ2. 

> helye:={op([seq( coord[i]=pb[i](op(parcoordb)) ,i=1..N)])}:
summ2:=0:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then       summ2:=summ2+subs(helye,f[op(zz)](op(coord)))*get_compts(vectormeasureb)[op(zz)]:
 end if:
end do:
 

One can check the second integrand summ2. 

> summ2:=expand(summ2):
 

Integrating summ2 over the parameter space, this is StRight. 

> StRight:=int(int(summ2,phi=0..2*Pi),theta=0..Pi);
 

StRight := 4/35*Pi*R^6 

The left hand side of Stokes' equation (StLeft) is equal to the right hand side (StRight). 

> simplify(StLeft-StRight);
 

0 

>
 

Stokes' Theorem 

In a 4 dimensional vector space for a 4 dimensional manifold 

 

 

Image 

> restart;
 

> with(tensor):
with(linalg):
with(combinat):
 

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

Warning, the assigned name fibonacci now has a global binding
 

Warning, the protected name Chi has been redefined and unprotected
 

Input 

N: Dimension of the vector space V.
M
: Dimension of the manifold G. 

> N:=4;
M:=4;
 

N := 4 

M := 4 

Input 

parcord: List, which contains the name of the coordinates of the manifold G, it contains M symbols. 

p[i]: Parametrization of the manifold G, the index i runs from 1 to N, and p[i] is a function of M variables. 

> parcoord:=[r,a,b,c];
 

parcoord := [r, a, b, c] 

> p[1]:=(r,a,b,c)->r*sin(a)*sin(b)*sin(c);
p[2]:=(r,a,b,c)->r*sin(a)*sin(b)*cos(c);
p[3]:=(r,a,b,c)->r*sin(a)*cos(b);
p[4]:=(r,a,b,c)->r*cos(a);
 

p[1] := proc (r, a, b, c) options operator, arrow; r*sin(a)*sin(b)*sin(c) end proc 

p[2] := proc (r, a, b, c) options operator, arrow; r*sin(a)*sin(b)*cos(c) end proc 

p[3] := proc (r, a, b, c) options operator, arrow; r*sin(a)*cos(b) end proc 

p[4] := proc (r, a, b, c) options operator, arrow; r*cos(a) end proc 

Input
parcordb
: List, which contains the name of the coordinates of the manifold G, it contains M-1 symbols.
pb[i]
: Parametrization of the manifold G, the index i runs from 1 to N, and pb[i] is a function of M-1 variables. 

> parcoordb:=[a,b,c];
 

parcoordb := [a, b, c] 

> pb[1]:=(a,b,c)->R*sin(a)*sin(b)*sin(c);
pb[2]:=(a,b,c)->R*sin(a)*sin(b)*cos(c);
pb[3]:=(a,b,c)->R*sin(a)*cos(b);
pb[4]:=(a,b,c)->R*cos(a);
 

pb[1] := proc (a, b, c) options operator, arrow; R*sin(a)*sin(b)*sin(c) end proc 

pb[2] := proc (a, b, c) options operator, arrow; R*sin(a)*sin(b)*cos(c) end proc 

pb[3] := proc (a, b, c) options operator, arrow; R*sin(a)*cos(b) end proc 

pb[4] := proc (a, b, c) options operator, arrow; R*cos(a) end proc 

Input 

coord: The coordinates of the vector space V, it contains N symbols.
f[i,j,k]
: The components of the function f, i<j<k. 

> coord:=[x,y,z,v];
 

coord := [x, y, z, v] 

> f[1,2,3]:=(x,y,z,v)->alpha*z^2;
f[1,2,4]:=(x,y,z,v)->beta*(x+y+z+v);
f[1,3,4]:=(x,y,z,v)->gamma*(x^3+y^3+z^3+v^3);
f[2,3,4]:=(x,y,z,v)->delta*(x^5+z^5);
 

f[1, 2, 3] := proc (x, y, z, v) options operator, arrow; alpha*z^2 end proc 

f[1, 2, 4] := proc (x, y, z, v) options operator, arrow; beta*(x+y+z+v) end proc 

f[1, 3, 4] := proc (x, y, z, v) options operator, arrow; gamma*(x^3+y^3+z^3+v^3) end proc 

f[2, 3, 4] := proc (x, y, z, v) options operator, arrow; delta*(x^5+z^5) end proc 

The integral of the exterior derivative of the function f on the manifold G: 

 

Tensorial form of the function f is tens.
The components of the exterior derivative of the function
f are in exttens. 

> L:=[seq(1..N,i=1..M-1)]:
tensorcreate:=array(antisymmetric, op(L)):
listtype:=[seq(-1,i=1..M-1)]:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then tensorcreate[op(zz)]:=f[op(zz)](op(coord)): end if:
end do:
tens:= create(listtype,eval(tensorcreate)):
exttens:=exterior_diff(tens,coord):
 

One can check the components of exttens. 

> get_compts(exttens):
 

The vectorial measure of the manifold G is in vectormeasure. 

> for j from 1 to M do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](p[i])(op(parcoord)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=1 then vectormeasure:=vv[1]: else vectormeasure:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M do
 vectormeasure:=exterior_prod(vectormeasure,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasure. 

> get_compts(vectormeasure):
 

The product of the exterior derivative of the function and the vectorial measure of the manifold is in summ1. 

> helye:={op([seq( coord[i]=p[i](op(parcoord)) ,i=1..N)])}:
summ1:=0:
for zz in permute(N,M) do
 wperm:=0:
 for i from 1 to M-1 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-1: end if:
 end do:
 if wperm=0 then
 summ1:=summ1+subs(helye,get_compts(exttens)[op(zz)])*get_compts(vectormeasure)[op(zz)]:      end if:
end do:
 

One can check the first integrand summ1. 

> summ1:=expand(summ1):
 

Integrating summ1 over the parameter space, this is StLeft. 

> StLeft:=int(int(int(int(summ1,c=0..2*Pi),b=0..Pi),a=0..Pi),r=0..R);
 

StLeft := 1/2*Pi^2*beta*R^4-1/4*Pi^2*gamma*R^6+5/32*Pi^2*delta*R^8 

Integral of the function f on the boundary of the manifold G: 

 

The vectorial measure of the boundary of the manifold G is in vectormeasureb. 

> for j from 1 to M-1 do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](pb[i])(op(parcoordb)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=2 then vectormeasureb:=vv[1]: else vectormeasureb:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M-1 do
   vectormeasureb:=exterior_prod(vectormeasureb,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasureb. 

> get_compts(vectormeasureb):
 

The product of the function f and the vectorial measure of the boundary of the manifold G is in summ2. 

> helye:={op([seq( coord[i]=pb[i](op(parcoordb)) ,i=1..N)])}:
summ2:=0:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then       summ2:=summ2+subs(helye,f[op(zz)](op(coord)))*get_compts(vectormeasureb)[op(zz)]:
 end if:
end do:
 

One can check the second integrand summ2. 

> summ2:=expand(summ2):
 

Integrating summ2 over the parameter space, this is StRight. 

> StRight:=int(int(int(summ2,c=0..2*Pi),b=0..Pi),a=0..Pi);
 

StRight := 1/2*Pi^2*beta*R^4-1/4*Pi^2*gamma*R^6+5/32*Pi^2*delta*R^8 

The left hand side of Stokes' equation (StLeft) is equal to the right hand side (StRight). 

> simplify(StLeft-StRight);
 

0 

>
 

Stokes' Theorem 

In a 6 dimensional vector space for a 4 dimensional manifold 

 

In this case we consider a 4 dimensional manifold in a 6 dimensional Euclidean space, and a function f, detailed below. 

> restart;
 

> with(tensor):
with(linalg):
with(combinat):
 

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

Warning, the assigned name fibonacci now has a global binding
 

Warning, the protected name Chi has been redefined and unprotected
 

Input 

N: Dimension of the vector space V.
M
: Dimension of the manifold G. 

> N:=6;
M:=4;
 

N := 6 

M := 4 

Input 

parcord: List, which contains the name of the coordinates of the manifold G, it contains M symbols. 

p[i]: Parametrization of the manifold G, the index i runs from 1 to N, and p[i] is a function of M variables. 

> parcoord:=[r,a,b,c];
 

parcoord := [r, a, b, c] 

> p[1]:=(r,a,b,c)->r*sin(a)*sin(b)*sin(c);
p[2]:=(r,a,b,c)->r*sin(a)*sin(b)*cos(c);
p[3]:=(r,a,b,c)->r*sin(a)*cos(b);
p[4]:=(r,a,b,c)->r*cos(a);
p[5]:=(r,a,b,c)->r^2*cos(2*c);
p[6]:=(r,a,b,c)->r^4;
 

p[1] := proc (r, a, b, c) options operator, arrow; r*sin(a)*sin(b)*sin(c) end proc 

p[2] := proc (r, a, b, c) options operator, arrow; r*sin(a)*sin(b)*cos(c) end proc 

p[3] := proc (r, a, b, c) options operator, arrow; r*sin(a)*cos(b) end proc 

p[4] := proc (r, a, b, c) options operator, arrow; r*cos(a) end proc 

p[5] := proc (r, a, b, c) options operator, arrow; r^2*cos(2*c) end proc 

p[6] := proc (r, a, b, c) options operator, arrow; r^4 end proc 

Input
parcordb
: List, which contains the name of the coordinates of the manifold G, it contains M-1 symbols.
pb[i]
: Parametrization of the manifold G, the index i runs from 1 to N, and pb[i] is a function of M-1 variables. 

> parcoordb:=[a,b,c];
 

parcoordb := [a, b, c] 

> pb[1]:=(a,b,c)->R*sin(a)*sin(b)*sin(c);
pb[2]:=(a,b,c)->R*sin(a)*sin(b)*cos(c);
pb[3]:=(a,b,c)->R*sin(a)*cos(b);
pb[4]:=(a,b,c)->R*cos(a);
pb[5]:=(a,b,c)->R^2*cos(2*c);
pb[6]:=(a,b,c)->R^4;
 

pb[1] := proc (a, b, c) options operator, arrow; R*sin(a)*sin(b)*sin(c) end proc 

pb[2] := proc (a, b, c) options operator, arrow; R*sin(a)*sin(b)*cos(c) end proc 

pb[3] := proc (a, b, c) options operator, arrow; R*sin(a)*cos(b) end proc 

pb[4] := proc (a, b, c) options operator, arrow; R*cos(a) end proc 

pb[5] := proc (a, b, c) options operator, arrow; R^2*cos(2*c) end proc 

pb[6] := proc (a, b, c) options operator, arrow; R^4 end proc 

Input 

coord: The coordinates of the vector space V, it contains N symbols. 

f[i,j,k]:  The components of the function f, i<j<k. 

> coord:=[x,y,z,u,v,w];
 

coord := [x, y, z, u, v, w] 

> f[1,2,3]:=(x,y,z,u,v,w)->alpha*(x^3+y^3+z^3+u^3+v^3+w^3);
f[1,2,4]:=(x,y,z,u,v,w)->u^5+w^3+v^3;
f[1,2,5]:=(x,y,z,u,v,w)->x*y^2*z^4;
f[1,2,6]:=(x,y,z,u,v,w)->w^2*y^2*z;
f[1,3,4]:=(x,y,z,u,v,w)->y^2*u*v;
f[1,3,5]:=(x,y,z,u,v,w)->u^3+z^2*v^2;
f[1,3,6]:=(x,y,z,u,v,w)->y^2*z^4;
f[1,4,5]:=(x,y,z,u,v,w)->w^2*z;
f[1,4,6]:=(x,y,z,u,v,w)->w*u*v^4;
f[1,5,6]:=(x,y,z,u,v,w)->x^2*y^2*z;
f[2,3,4]:=(x,y,z,u,v,w)->u^2*w*v;
f[2,3,5]:=(x,y,z,u,v,w)->4*x^2*v^2;
f[2,3,6]:=(x,y,z,u,v,w)->w^2*y^4;
f[2,4,5]:=(x,y,z,u,v,w)->u^2*v^2*x*z;
f[2,4,6]:=(x,y,z,u,v,w)->x^5+y^5+z^5+u^5+v^5+w^5;
f[2,5,6]:=(x,y,z,u,v,w)->x^2*y^2*z^2*u^2;
f[3,4,5]:=(x,y,z,u,v,w)->x^2*y^2*z*v;
f[3,4,6]:=(x,y,z,u,v,w)->x*y^2*z^4*u^2*w^2;
f[3,5,6]:=(x,y,z,u,v,w)->x^2*u^2;
f[4,5,6]:=(x,y,z,u,v,w)->w^2*u^2*x*z;
 

f[1, 2, 3] := proc (x, y, z, u, v, w) options operator, arrow; alpha*(x^3+y^3+z^3+u^3+v^3+w^3) end proc 

f[1, 2, 4] := proc (x, y, z, u, v, w) options operator, arrow; u^5+w^3+v^3 end proc 

f[1, 2, 5] := proc (x, y, z, u, v, w) options operator, arrow; x*y^2*z^4 end proc 

f[1, 2, 6] := proc (x, y, z, u, v, w) options operator, arrow; w^2*y^2*z end proc 

f[1, 3, 4] := proc (x, y, z, u, v, w) options operator, arrow; y^2*u*v end proc 

f[1, 3, 5] := proc (x, y, z, u, v, w) options operator, arrow; u^3+z^2*v^2 end proc 

f[1, 3, 6] := proc (x, y, z, u, v, w) options operator, arrow; y^2*z^4 end proc 

f[1, 4, 5] := proc (x, y, z, u, v, w) options operator, arrow; w^2*z end proc 

f[1, 4, 6] := proc (x, y, z, u, v, w) options operator, arrow; w*u*v^4 end proc 

f[1, 5, 6] := proc (x, y, z, u, v, w) options operator, arrow; x^2*y^2*z end proc 

f[2, 3, 4] := proc (x, y, z, u, v, w) options operator, arrow; u^2*w*v end proc 

f[2, 3, 5] := proc (x, y, z, u, v, w) options operator, arrow; 4*x^2*v^2 end proc 

f[2, 3, 6] := proc (x, y, z, u, v, w) options operator, arrow; w^2*y^4 end proc 

f[2, 4, 5] := proc (x, y, z, u, v, w) options operator, arrow; u^2*v^2*x*z end proc 

f[2, 4, 6] := proc (x, y, z, u, v, w) options operator, arrow; x^5+y^5+z^5+u^5+v^5+w^5 end proc 

f[2, 5, 6] := proc (x, y, z, u, v, w) options operator, arrow; x^2*y^2*z^2*u^2 end proc 

f[3, 4, 5] := proc (x, y, z, u, v, w) options operator, arrow; x^2*y^2*z*v end proc 

f[3, 4, 6] := proc (x, y, z, u, v, w) options operator, arrow; x*y^2*z^4*u^2*w^2 end proc 

f[3, 5, 6] := proc (x, y, z, u, v, w) options operator, arrow; x^2*u^2 end proc 

f[4, 5, 6] := proc (x, y, z, u, v, w) options operator, arrow; w^2*u^2*x*z end proc 

The integral of the exterior derivative of the function f on the manifold G: 

 

Tensorial form of the function f is tens.
The components of the exterior derivative of the function
f are in exttens. 

> L:=[seq(1..N,i=1..M-1)]:
tensorcreate:=array(antisymmetric, op(L)):
listtype:=[seq(-1,i=1..M-1)]:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then tensorcreate[op(zz)]:=f[op(zz)](op(coord)): end if:
end do:
tens:= create(listtype,eval(tensorcreate)):
exttens:=exterior_diff(tens,coord):
 

One can check the components of exttens. 

> get_compts(exttens):
 

The vectorial measure of the manifold G is in vectormeasure. 

> for j from 1 to M do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](p[i])(op(parcoord)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=1 then vectormeasure:=vv[1]: else vectormeasure:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M do
 vectormeasure:=exterior_prod(vectormeasure,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasure. 

> get_compts(vectormeasure):
 

The product of the exterior derivative of the function and the vectorial measure of the manifold is in summ1. 

> helye:={op([seq( coord[i]=p[i](op(parcoord)) ,i=1..N)])}:
summ1:=0:
for zz in permute(N,M) do
 wperm:=0:
 for i from 1 to M-1 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-1: end if:
 end do:
 if wperm=0 then       summ1:=summ1+subs(helye,get_compts(exttens)[op(zz)])*get_compts(vectormeasure)[op(zz)]:
 end if:
end do:
 

One can check the first integrand summ1. 

> summ1:=expand(summ1):
 

Integrating summ1 over the parameter space, this is StLeft. 

> StLeft:=int(int(int(int(summ1,c=0..2*Pi),b=0..Pi),a=0..Pi),r=0..R);
 

StLeft := -1/4*Pi^2*alpha*R^6-1/96*Pi^2*R^12 

 

Integral of the function f on the boundary of the manifold G: 

 

The vectorial measure of the boundary of the manifold G is in vectormeasureb. 

> for j from 1 to M-1 do
 vparcderiv:=array(1..N):
 for i from 1 to N do
   vparcderiv[i]:=D[j](pb[i])(op(parcoordb)):
 end do;
 vv[j]:= create([-1],eval(vparcderiv));
end do:
if M=2 then vectormeasureb:=vv[1]: else vectormeasureb:=exterior_prod(vv[1],vv[2]): end if:
if M>2 then
 for j from 3 to M-1 do
   vectormeasureb:=exterior_prod(vectormeasureb,vv[j]):  
 end do:
end if:
 

One can check the components of vectormeasureb. 

> get_compts(vectormeasureb):
 

The product of the function f and the vectorial measure of the boundary of the manifold G is in summ2. 

> helye:={op([seq( coord[i]=pb[i](op(parcoordb)) ,i=1..N)])}:
summ2:=0:
for zz in permute(N,M-1) do
 wperm:=0:
 for i from 1 to M-2 do
   if zz[i]>zz[i+1] then wperm:=1: i:=M-2: end if:
 end do:
 if wperm=0 then       summ2:=summ2+subs(helye,f[op(zz)](op(coord)))*get_compts(vectormeasureb)[op(zz)]:
 end if:
end do:
 

One can check the second integrand summ2. 

> summ2:=expand(summ2):
 

Integrating summ2 over the parameter space, this is StRight. 

> StRight:=int(int(int(summ2,c=0..2*Pi),b=0..Pi),a=0..Pi);
 

StRight := -1/4*Pi^2*alpha*R^6-1/96*Pi^2*R^12 

The left hand side of Stokes' equation (StLeft) is equal to the right hand side (StRight). 

> simplify(StLeft-StRight);
 

0 

>
 

 

Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities. 

 

Image