THE DERIVATION OF THE NABLA OPERATOR AND THE SPATIAL DERIVATIVES OF THE UNIT VECTORS FOR SPHERICAL COORDINATES
Work done by Scott Covan
We will now derive the nabla operator and the spatial derivatives for spherical coordinates. These calculations follow almost identically the calculations made for cylindrical coordinates -- spherical coordinates are simply more difficult to work with because z is not defined in both the rectangular and spherical coordinate systems.
We will begin with calculation of nabla. We need the coordinate definitions, eqns A.6-(19-24),
x = rsin(theta)cos(phi) r=sqrt(x^2 + y^2 + z^2)
y = rsin(theta)sin(phi) theta = arctan(sqrt(x^2 + y^2)/z)
z = rcos(theta) phi = arctan(y/x)
We use the same definition for d/dx that we used before, only with different variables,
d/dx = dr/dx*d/dr + dtheta/dx*d/dtheta + dphi/dx*d/dphi
Also, because there will be so many terms with so many variables, we will define the three main terms of d/dx as a vector. Otherwise, Maple will want to combine terms during simplification, when all three terms can be completely simplified alone.
> restart;
> ddx:=[ddr*diff(sqrt(x^2+y^2+z^2),x),ddtheta*diff(arctan(sqrt(x^2+y^2)/z),x),ddphi*diff(arctan(y/x),x)];
We now substitute our definitions of x,y, and z in terms of r, theta, and phi.
> ddx:=subs(x=r*sin(theta)*cos(phi),y=r*sin(theta)*sin(phi),z=r*cos(theta),ddx);
Just like cylindrical coordinates, Maple won't simplify correctly unless we tell it to use trig simplification procedures.
> ddx:=simplify(ddx,trig);
We now tell Maple to simplify the power terms.
> ddx:=simplify(ddx,power,symbolic);
These terms are simplified completely. We can now combine them as a sum as they should be.
> ddx:=ddx[1]+ddx[2]+ddx[3];
We will now go through the identical procedures to obtain d/dy and d/dz. Unlike cylindrical coordinate calculations, d/dz is now an issue because of the addition of the variable phi.
> ddy:=[ddr*diff(sqrt(x^2+y^2+z^2),y),ddtheta*diff(arctan(sqrt(x^2+y^2)/z),y),ddphi*diff(arctan(y/x),y)];
> ddy:=subs(x=r*sin(theta)*cos(phi),y=r*sin(theta)*sin(phi),z=r*cos(theta),ddy);
> ddy:=simplify(ddy,trig,power,symbolic);
> ddy:=ddy[1]+ddy[2]+ddy[3];
> ddz:=[ddr*diff(sqrt(x^2+y^2+z^2),z),ddtheta*diff(arctan(sqrt(x^2+y^2)/z),z),ddphi*diff(arctan(y/x),z)];
> ddz:=subs(x=r*sin(theta)*cos(phi),y=r*sin(theta)*sin(phi),z=r*cos(theta),ddz);
> ddz:=simplify(ddz,trig,power,symbolic);
> ddz:=ddz[1]+ddz[2]+ddz[3];
These derived d/dx, d/dy, and d/dz's are all identical to A.6-(25-27). We now use simple geometrical arguments, based on the spherical coordinate system definition, to arrive at the definitions for the spherical unit vectors in terms of delx, dely, and delz, eqn A.6-(28-30):
delr = sin(theta)soc(phi)delx + sin(theta)sin(phi)dely + cos(theta)delz
deltheta = cos(theta)cos(phi)delx + cos(theta)sin(phi)dely - sin(theta)delz
delphi = -sin(phi)delx + cos(phi)dely
We now use Maple to solve for delx, dely, and delz.
> eqn1:=delr=cos(phi)*sin(theta)*delx+sin(theta)*sin(phi)*dely+cos(theta)*delz;eqn2:=deltheta=cos(theta)*cos(phi)*delx+cos(theta)*sin(phi)*dely-sin(theta)*delz;eqn3:=delphi=-sin(phi)*delx+cos(phi)*dely;
> e:=solve({eqn1,eqn2,eqn3},{delx,dely,delz});
We use subs so we can use these results in calculations.
> delx:=subs(e,delx);dely:=subs(e,dely);delz:=subs(e,delz);
We can now plug our results into the definition of nabla to obtain our spherical coordinate nabla.
nabla = delx*d/dx + dely*d/dy + delz*d/dz
> nabla:=ddx*delx+ddy*dely+ddz*delz;
> nabla:=simplify(nabla);
> nabla:=expand(nabla);
This is our desired answer, eqn A.7-9. Now, we'll restart again to avoid recursive definitions, and restate our delr, deltheta, and delphi.
> restart;delr:=sin(theta)*cos(phi)*delx+sin(theta)*sin(phi)*dely+cos(theta)*delz;deltheta:=cos(theta)*cos(phi)*delx+cos(theta)*sin(phi)*dely-sin(theta)*delz;delphi:=-sin(phi)*delx+cos(phi)*dely;
> diff(delr,r);diff(delr,theta);diff(delr,phi);
These are the spatial derivatives of delr. Notice that d/dtheta(delr) is equivalent to deltheta and that d/dphi(delr) is equivalent to delphi*sin(theta).
> diff(deltheta,r);diff(deltheta,theta);diff(deltheta,phi);
The spatial derivatives of deltheta. Notice that d/dtheta(deltheta) is equivalent to -delr and that d/dphi(deltheta) is equal to delphi*cos(theta).
> diff(delphi,r);diff(delphi,theta);diff(delphi,phi);
The spatial derivatives of delphi. The d/dphi(delphi) looks simplified, but we need it in terms of delr, deltheta, and delphi. To do this, we manually plug in the delx and dely's that we found before.
> -(cos(phi)*(sin(theta)*cos(phi)*dellr+cos(theta)*cos(phi)*delltheta-sin(phi)*dellphi)+sin(phi)*(sin(theta)*sin(phi)*dellr+cos(theta)*sin(phi)*delltheta+cos(phi)*dellphi));
> simplify(%,trig);
This is the form for d/dphi(delphi) that we need. Now, armed with the spherical nabla operator and the spatial derivatives for spherical coordinates, we can do the vector calculations needed to derive the equation of energy in terms of sherical coordinates.