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.

In[43]:=

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

In[44]:=

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

In[45]:=

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

Out[45]=

  r Cos[theta]

Out[46]=

  r Sin[theta]

Out[47]=

  z

In[48]:=

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

Out[48]=

            2
  {1, Sqrt[r ], 1}

In[49]:=

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

In[50]:=

  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}

In[51]:=

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

Out[51]=

  0

In[52]:=

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

Out[52]=

  {0, 0, 0}

In[53]:=

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

Out[53]=

  {0, 0, 0}

In[54]:=

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

Out[54]=

  0

In[55]:=

  

Up to Exercises