Stokes’ Theorem Examples

Direct Computation of Integral of Curl F ·(OverHat[n]) on the Hemisphere (x^2) + (y^2) + (z^2) = 1, z ≥ 0 where F = (xyz)(OverHat[ i]) + x (OverHat[j]) + (e^xy) cos(z) (OverHat[k :])

Cartesian Coordinates

z[x_,y_]:=Sqrt[1-x^2-y^2];

Integrate[(x^2*Exp[x*y]*Cos[z[x,y]]/z[x,y])- (y^2*Exp[x*y]*Cos[z[x,y]]/z[x,y]) + x*y^2/z[x,y] + 1 - x*z[x,y],{y,-Sqrt[1-x^2],Sqrt[1-x^2]},{x,-1,1}]

Try Polar Coordinates:

x[r_,theta_]:=r*Cos[theta]; y[r_,theta_]:=r*Sin[theta]; z[r_,theta_]:=Sqrt[1-r^2];

Integrate[(((x[r,theta]^2*Exp[x[r,theta]*y[r,theta]]*Cos[z[r,theta]])/z[r,theta])- ((y[r,theta]^2*Exp[x[r,theta]*y[r,theta]]*Cos[z[r,theta]])/z[r,theta]) + x[r,theta]*y[r,theta]^2/z[r,theta] + 1 - x[r,theta]*z[r,theta])*r,{r,0,1},{theta,0,2*Pi}]

Numerical Integration:

x[r_,theta_]:=r*Cos[theta]; y[r_,theta_]:=r*Sin[theta]; z[r_,theta_]:=Sqrt[1-r^2];

NIntegrate[(((x[r,theta]^2*Exp[x[r,theta]*y[r,theta]]*Cos[z[r,theta]])/z[r,theta])- ((y[r,theta]^2*Exp[x[r,theta]*y[r,theta]]*Cos[z[r,theta]])/z[r,theta]) + x[r,theta]*y[r,theta]^2/z[r,theta] + 1 - x[r,theta]*z[r,theta])*r,{r,0,1},{theta,0,2*Pi}]

Direct Computation of Path Integral of (y+sin(x)) dx + ((z^2) + cos(y)) dy + (x^3) dz along x(t) = sint, y(t) = cos(t), z(t) = sin(2t) for t = 0 to t = 2π :

x[t_]:=Sin[t]; y[t_]:=Cos[t]; z[t_]:=Sin[2*t];

dx[t_]:=Cos[t]; dy[t_]:=-Sin[t]; dz[t_]:=2*Cos[2*t];


Integrate[(y[t]+Sin[x[t]])*dx[t] + (z[t]^2 + Cos[y[t]])*dy[t] + x[t]^3*dz[t],{t,0,2*Pi}]