Stokes TheoremThe following example will confirm Stoke's Theorem. First the line integral will be calculated with the LineInt command in MAPLE, then we will confirm the calculation with Stoke's Theorem for the function LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbWlHRiQ2I1EhRictRiM2J0YrLUYjNigtRiw2JlEiekYnLyUlc2l6ZUdRIzE2RicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LlEiPUYnRjYvRj1RJ25vcm1hbEYnLyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0ZHLyUpc3RyZXRjaHlHRkcvJSpzeW1tZXRyaWNHRkcvJShsYXJnZW9wR0ZHLyUubW92YWJsZWxpbWl0c0dGRy8lJ2FjY2VudEdGRy8lJ2xzcGFjZUdRLDAuMjc3Nzc3OGVtRicvJSdyc3BhY2VHRlYtRiM2Ki1JI21uR0YkNiVRIjRGJ0Y2RkMtRkA2LlEoJm1pbnVzO0YnRjZGQ0ZFRkhGSkZMRk5GUEZSL0ZVUSwwLjIyMjIyMjJlbUYnL0ZYRl1vLUYjNiUtSSVtc3VwR0YkNiUtRiw2JlEieEYnRjZGOUY8LUZmbjYlUSIyRidGNkZDLyUxc3VwZXJzY3JpcHRzaGlmdEdRIjBGJ0Y2RkNGaW4tRiM2JS1GYm82JS1GLDYmUSJ5RidGNkY5RjxGZ29Gam9GNkZDRitGNkZDRitGNkZDRitGNkZDRitGNkZD and vector field LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkobWZlbmNlZEdGJDYnLUYjNiktSSNtaUdGJDYjUSFGJy1GIzYnLUkjbW5HRiQ2JVEiMkYnLyUlc2l6ZUdRIzE2RicvJSxtYXRodmFyaWFudEdRJ25vcm1hbEYnLUkjbW9HRiQ2LVExJkludmlzaWJsZVRpbWVzO0YnRj0vJSZmZW5jZUdRJmZhbHNlRicvJSpzZXBhcmF0b3JHRkYvJSlzdHJldGNoeUdGRi8lKnN5bW1ldHJpY0dGRi8lKGxhcmdlb3BHRkYvJS5tb3ZhYmxlbGltaXRzR0ZGLyUnYWNjZW50R0ZGLyUnbHNwYWNlR1EmMC4wZW1GJy8lJ3JzcGFjZUdGVS1GMTYmUSJ5RidGOi8lJ2l0YWxpY0dRJXRydWVGJy9GPlEnaXRhbGljRidGOkY9LUZBNi5RIixGJ0Y6Rj1GRC9GSEZnbkZJRktGTUZPRlFGUy9GV1EsMC4zMzMzMzMzZW1GJy1GIzYpRjAtRiM2J0Y2RkAtRjE2JlEiekYnRjpGZW5GaG5GOkY9RmpuLUYjNidGNkZALUYxNiZRInhGJ0Y6RmVuRmhuRjpGPUYwRjpGPUYwRjpGPUY6Rj0vJSVvcGVuR1EzJkxlZnRBbmdsZUJyYWNrZXQ7RicvJSZjbG9zZUdRNCZSaWdodEFuZ2xlQnJhY2tldDtGJy1GQTYvUSIuRidGOi8lMGZvbnRfc3R5bGVfbmFtZUdRJVRleHRGJ0Y9RkRGR0ZJRktGTUZPRlFGU0ZWRj0=restart:with(plots):with(linalg):with(LinearAlgebra):with(VectorCalculus):with(Student[VectorCalculus]):SetCoordinates(cartesian[x,y,z]);z:=4-x^2-y^2;C:=<2*cos(theta),2*sin(theta),0>;a:=plot3d(z,x=-5..5,y=-5..5);b:=plot3d([C],theta=0..2*Pi,r=0..1,thickness=4);Here is a picture of what is going on. We have a 3D surface whose base is the path traversed in a direction so the surface is always on the left.display(a,b,axes=boxed, scaling=constrained,view=[-3..3,-3..3,0..5]);V:=<2*y,2*z,2*x>;VF:=VectorField(V);LineInt(VF,Path(C,theta=0..2*Pi), output=plot);c:=LineInt(VF,Path(C,theta=0..2*Pi), output=plot);display(a,b,c,axes=boxed, scaling=constrained,view=[-3..3,-3..3,0..5]);LineInt(VF,Path(C,theta=0..2*Pi), output=value);Now we will compute the line integral using Stoke's Theorem.restart:with(linalg):with(LinearAlgebra):with(VectorCalculus):SetCoordinates(cartesian[x,y,z]);V:=<2*y,2*z,2*x>;VF:=VectorField(V);f:=(x,y,z)->16-x^2-y^2-z;gradient:=Gradient(f(x,y,z));We can use a MAPLE command to calculate the curl. Note that to use this command, the argument must be a vector field. That was done above with the MAPLE command VectorField.Cu:=Curl(VF);Integrand:=DotProduct(Cu,gradient);Since the region we will be integrating over is a disk, it will be easier to compute the integral in polar coordinates.integrand:=subs(x=r*cos(theta),y=r*sin(theta), Integrand);Int(Int(integrand*r,r=0..2),theta=0..2*Pi)=int(int(integrand*r,r=0..2),theta=0..2*Pi);If we had not switched to polar, we could still calculate it with the following commands.Int(Int(Integrand,y=-sqrt(4-x^2)..sqrt(4-x^2)),x=-2..2)=int(int(Integrand,y=-sqrt(4-x^2)..sqrt(4-x^2)),x=-2..2);Notice that we got the same value, but the opposite sign. If we look at our curl, notice it is pointing inwards towards our surface, but Stoke's theorem requires that it has an outward orientation. This is a simple fix. There are two normal vectors at each point, we just need to choose the one pointing outwards. This can be done by changing the sign on our curl. Let's do that and redo our calculations.Cun:=-Cu;Integrandn:=DotProduct(Cun,gradient);Int(Int(Integrandn,y=-sqrt(4-x^2)..sqrt(4-x^2)),x=-2..2)=int(int(Integrandn,y=-sqrt(4-x^2)..sqrt(4-x^2)),x=-2..2);Now let's do it via a parameterized curve.restart:with(linalg):with(LinearAlgebra):with(VectorCalculus):SetCoordinates(cartesian[x,y,z]);with(plots):r:=<sqrt(4-v)*cos(u),sqrt(4-v)*sin(u),v>;V:=<2*y,2*z,2*x>;VF:=VectorField(V);a:=plot3d([r],u=0..2*Pi,v=0..4);b:=plot3d([2*cos(theta),2*sin(theta),0],theta=0..2*Pi,s=0..1,thickness=4);display(a,b,axes=boxed, scaling=constrained,view=[-3..3,-3..3,0..5]);rdv:=diff(r,v);rdu:=diff(r,u);cross:=CrossProduct(rdv,rdu);Cu:=Curl(VF);Integrand:=innerprod(Cu,cross);Int(Int(Integrand,v=0..4),u=0..2*Pi)=int(int(Integrand,v=0..4),u=0..2*Pi);Same issue as above. Notice that we got the same value, but the opposite sign. If we look at our curl, notice it is pointing inwards towards our surface, but Stoke's theorem requires that it has an outward orientation. This is a simple fix. There are two normal vectors at each point, we just need to choose the one pointing outwards. This can be done by changing the sign on our curl. Let's do that and redo our calculations.Cun:=-Cu;Integrandn:=innerprod(Cun,cross);Int(Int(Integrandn,v=0..4),u=0..2*Pi)=int(int(Integrandn,v=0..4),u=0..2*Pi);What if we did not know the vector field, but we know the curl? Let's say we are given that the curl is LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbWlHRiQ2I1EhRictRiM2JS1JKG1mZW5jZWRHRiQ2Jy1GIzYpRistRiM2Jy1GLDYmUSJ4RicvJSVzaXplR1EjMTZGJy8lJ2l0YWxpY0dRJXRydWVGJy8lLG1hdGh2YXJpYW50R1EnaXRhbGljRictSSNtb0dGJDYtUTEmSW52aXNpYmxlVGltZXM7RicvRkJRJ25vcm1hbEYnLyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0ZMLyUpc3RyZXRjaHlHRkwvJSpzeW1tZXRyaWNHRkwvJShsYXJnZW9wR0ZMLyUubW92YWJsZWxpbWl0c0dGTC8lJ2FjY2VudEdGTC8lJ2xzcGFjZUdRJjAuMGVtRicvJSdyc3BhY2VHRmVuLUYsNiZRInlGJ0Y7Rj5GQUY7RkgtRkU2LlEiLEYnRjtGSEZKL0ZORkBGT0ZRRlNGVUZXRlkvRmduUSwwLjMzMzMzMzNlbUYnLUYjNihGKy1GIzYnLUkjbW5HRiQ2JVEiMkYnRjtGSEZERmhuRjtGSEZbby1GZm82JVEiM0YnRjtGSEY7RkhGK0Y7RkhGO0ZILyUlb3BlbkdRMyZMZWZ0QW5nbGVCcmFja2V0O0YnLyUmY2xvc2VHUTQmUmlnaHRBbmdsZUJyYWNrZXQ7RidGO0ZIRitGO0ZI and the surface is a sphere of radius 3.restart:with(linalg):with(LinearAlgebra):with(VectorCalculus):SetCoordinates(cartesian[x,y,z]);with(plots):CuF:=<x*y,2*y,3>;S:=<3*sin(u)*cos(v),3*sin(u)*sin(v),3*cos(u)>;Sdu:=diff(S,u);Sdv:=diff(S,v);cross:=CrossProduct(Sdu,Sdv);n:=simplify(cross);Notice that this normal vector is pointing away from the sphere and thus has a positive orientation. The path in this case is around the circle in the xy plane with a radius of 3. CuFp:=subs(x=S[1],y=S[2],z=S[3],CuF);Integrand:=DotProduct(CuFp,n);Int(Int(Integrand,v=0..2*Pi),u=0..Pi/2)=int(int(Integrand,v=0..2*Pi),u=0..Pi/2);JSFHJSFHJSFH