Exercise 1

Verify that curl(gradf)=0 and div(curlv)=0 in cylindrical and spherical coordinates by testing the following scalar and vector functions. (In fact, the identities are still true for all orthogonal curvilinear coordinates.
u1=r^3 z^4 sin(theta)
F={z^2,2,r}
u2=z^3 r
G={cos(theta),-sin(theta),0}
u3=rsin(phi)
H={sin(phi), 0, cos(theta)}

Let's do cylindrical first.


  Clear[x,y,z,r,theta,z]


  x[r_,t_,z_]:=r Cos[t]
  y[r_,t_,z_]:=r Sin[t]
  z[r_,t_,z_]:=z


  x[r,theta,z]
  y[r,theta,z]
  z[r,theta,z]


  Clear[a,b,c]
  {a,b,c}=Simplify[scalefactors[x,y,z][r,theta,z]]


  Clear[u1,u2,u3,F,G]


  u1[r_,t_,z_]:=r^3 z^4 Sin[t]
  u2[r_,t_,z_]:=z^3 r
  F[r_,t_,z_]:={z^2,2,r}
  G[r_,t_,z_]:={Cos[t],-Sin[t],0}


  newdiv[newcurl[F]][r,theta,z]


  newcurl[newgrad[u1]][r,theta,z]


  newcurl[newgrad[u2]][r,theta,z]


  newdiv[newcurl[F]][r,theta,z]


  

Up to Exercises