Maple hints for doing Homework 12 (week 11)
(Stokes' theorem)
section 10.6 of Prof. Malek-Madani's book Advanced Engineering Mathematics
sm311o_hwk12b.mws,wdj,4-19-98
>
restart;with(plots):
with(linalg):
Warning, new definition for norm
Warning, new definition for trace
Problems #1, 2 : These problems can be done in the same manner as the following one:
Verify Stokes' theorem for F(x,y,z)=(y,x,z) for the triangle with vertices (1,0,0), (0,2,0), (0,0,3).
This means "compute both sides of Stokes' theorem
surface integral of curl(F) over S = line integral of F over C
and check that they are equal".
> F:=(x,y,z)->[x+y,y+z,z+x];
The easiest way to do this in MAPLE is to use the formula
surface integral of F over S = int int_S F(x,y,z)*n d(sigma)
The tetrahedron S is composed over 4 faces: S1 = front (x+y/2+z/3=1), S2 = left side (y=0), S3 = back (x=0), S4 = bottom (z=0). To get a unit normal, take the gradients of these equations and divide by the length. To make them be outward unit normals, we sometimes multiply by -1. The formula for d(sigma) involves the area element factor sqrt(f_x^2+f_y^2+f_z^2)/|f_?|, where f(x,y,z)=c describes the surface and ? is the variable (x,y, or z) along whose axis you projected the surface (eg, ?=z if you projected the surface down onto the xy plane to integrate). We must compute this as well.
>
v:=convert(grad(x+y/2+z/3,[x,y,z]),list);
normal_vector:=(x,y,z)->v/sqrt(dotprod(v,v)):
normal_vector(x,y,z);
area_element_factor:=sqrt(v[1]^2+v[2]^2+v[3]^2)/v[3];
>
curl_F:=(x0,y0,z0)->subs({x=x0,y=y0,z=z0},
curl(F(x,y,z),[x,y,z])):
curl_F(x,y,z);
>
>
The base for the integral over S is {0 < x < 1, 0 < y < 2(1 - x) }. On S, z = 3(1 - x - y/2). We can check this visually in MAPLE by simply plotting the 3d object using these ranges:
NOTE: MAPLE does not plot the xyz axes in the usual right-hand orientation we use but plots the yxz axes instead .
>
Plot1:=plot3d(3*(1-y-x/2),y=0..(1-x/2),x=0..2,axes=normal,style=wireframe,color=grey,title=`The surface S`):
Plot1;
>
S_int:=Int(Int(Dotprod(curl_F(x,y,3*(1-x-y/2)),Normal_vector(x,y,3*(1-x-y/2)))*Area_element_factor,y=0..(2*(1-x))),x=0..1);
int(int(dotprod(curl_F(x,y,3*(1-x-y/2)),normal_vector(x,y,3*(1-x-y/2)))*area_element_factor,y=0..(2*(1-x))),x=0..1);
Now we must compute the line integral of F around the boundary of S. It is composed of 3 parts, whcih we parameterize using the formula
r(t) = (P1-P0)*t + P0
>
P10:=[1,0,0];P11:=[0,2,0];
r1:=t->expand((P11-P10)*t+P10):
r1(t);
>
P20:=[0,2,0];P21:=[0,0,3];
r2:=t->expand((P21-P20)*t+P20):
r2(t);
>
P30:=[0,0,3];P31:=[1,0,0];
r3:=t->expand((P31-P30)*t+P30):
r3(t);
> Plot2:=spacecurve(r1(t),t=0..1,axes=normal,color=red):
> Plot3:=spacecurve(r2(t),t=0..1,axes=normal,color=blue):
> Plot4:=spacecurve(r3(t),t=0..1,axes=normal,color=green):
> display3d([Plot1,Plot2,Plot3,Plot4]);
>
The line integral calculation requires a package to compute line integrals written by Joe Riel,
<jsr@sparc.sandiegoca.ncr.com>.
>
read `c:/Program Files/Maple V Release 5/bin.wnt/pathint5.mtx`;
This command reads in the file pathint5.mtx (for MapleV5) which you must have saved in the directory above or you must edit this path above to show the directory where you have loaded pathint5.mtx. The file pathint5.mtx will open on your screen. You don't need it so you may either minimize it or close it and then continue with the commands below.
>
>
>
Gamma1:=[r1(t),t=0..1];
r:=[x,y,z];
Pathint(dot(F(x,y,z),D(r)),r=Gamma1);
line_int1:=pathint(dot(F(x,y,z),D(r)),r=Gamma1);
>
Gamma2:=[r2(t),t=0..1];
r:=[x,y,z];
Pathint(dot(F(x,y,z),D(r)),r=Gamma2);
line_int2:=pathint(dot(F(x,y,z),D(r)),r=Gamma2);
>
Gamma3:=[r3(t),t=0..1];
r:=[x,y,z];
Pathint(dot(F(x,y,z),D(r)),r=Gamma3);
line_int3:=pathint(dot(F(x,y,z),D(r)),r=Gamma3);
> line_int:=line_int1+line_int2+line_int3;
>
Problem 4 : This is simply showing that Stokes' thrm reduces down to Green's thrm when there is no "z component". It has to be done by hand but here are a few things Mapl can help you with (such as the curl calculation):
>
restart;with(plots):
with(linalg):
Warning, new definition for norm
Warning, new definition for trace
>
r:=t->[f(t),g(t),0]:
r(t);
>
F:=(x,y,z)->[M(x,y),N(x,y),0]:
F(x,y,z);
>
curl_F:=(x0,y0,z0)->subs({x=x0,y=y0,z=z0},
curl(F(x,y,z),[x,y,z])):
curl_F(x,y,z);
>
v:=convert(grad(z,[x,y,z]),list);
normal_vector:=(x,y,z)->v/sqrt(dotprod(v,v)):
normal_vector(x,y,z);
area_element_factor:=sqrt(v[1]^2+v[2]^2+v[3]^2)/v[3];
>