In this lab you will explore how Mathematica can be used to work with divergence and curl.
First some setup so we can do the vector stuff:
Needs["Calculus`VectorAnalysis`"]This loads the routines for divergence (Div) and curl (Curl) among other things.
Here's a problem from the book (number 6 on page 1027): Use the Divergence theorem to evaluate
if and S: boundary of cube , , . Here's how we solve it:
F={x^2 z, -y, xyz} divF = Div[F] Integrate[Integrate[Integrate[divF,{x,0,a}],{y,0,a}],{z,0,a}]which should give an answer of .
Here's a problem from the book (number 8 on page 1033): Verify Stokes Theorem where and S: , . First the surfaces integral
F={z-y,x-z,x-y} curlF = Curl[F] S=z+x^2+y^2-4; n=Grad[S] curlFdotn=Simplify[curlF.n/.{z->4-x^2-y^2}] Integrate[Integrate[curlFdotn,{x,-Sqrt[4-y^2],Sqrt[4-y^2]}],{y,-2,2}]Now the line integral
r={2 Cos[t],2 Sin[t],0} dr=D[r,t] Fdotdr=F.dr/.{x->2 Cos[t],y->2 Sin[t],z->0} Integrate[Fdotdr,{t,0,2 Pi}]