The Unit Normal in Spherical and Cylindrical Coordinates
It is possible to calculate the unit normal to a surface in coordinates other than Cartesian coordinates. For example, suppose we are given a surface
in cylindrical coordinates. Then by calculating the gradient in cylindrical coordinates and plotting in cylindrical coordinates, we can find the unit normal and plot a field of vectors.
As above, however, we concentrate on functions so that the plots of the normal fields can be easily produced. In particular, let us explore the graph of
in cylindrical coordinates in the following example.
Example:
The surface
is defined in cylindrical coordiantes. Let's find the unit surface normal in cylindrical coordinates and plot the resulting field of vectors on the surface. First, let us define
and
.
> | r:='r':z:='z':theta:='theta': #Clear the Variables f:=z*sec(theta); U:=f-r; |
> |
Now let's compute the gradient in cylindrical coordinates. Maple allows us to see what the gradient in cylindrical coordinates looks like in general. First, we change the coordinate system to cylindrical, and then we execute the
Gradient()
command with no arguments. The result is the gradient applied to an unknown
Scalar Field (SF),
which it denotes by
. The bars over the basis vectors are to indicate that the gradient produces a
field
of vectors--i.e., one for each point on the surface--and is therefore a
Vector Field.
> | SetCoordinates(cylindrical[r,theta,z]); Gradient_in_Cylindrical:=Gradient(); BasisFormat(false): Gradient_in_Cylindrical:=Gradient(); BasisFormat(true): |
> |
Now let's apply this to U :
> | grad_U:=Gradient(U,cylindrical[r,theta,z]); |
> |
Next, let us normalize the gradient to obtain the unit surface normal
> | n:=grad_U/sqrt(simplify(grad_U . grad_U)); |
> |
Now let's graph the surface--in cylindrical coordinates--and the resulting vector field.
> | #Enter plot data zmin:=1: zmax:=4: thetamin:=0: thetamax:=.8: thetagrid:=5: #Determines how many arrows are used zgrid:=5: #Compute unit normal and stepsizes n:=MapToBasis(n,cartesian[x,y,z]): #Convert back to Cartesian thetamin:=evalf(thetamin,10):thetamax:=evalf(thetamax,10):zmin:=evalf(zmin,10):zmax:=evalf(zmax,10): thetadelt:=evalf(abs(thetamax-thetamin)/thetagrid,10): #8X8 grid zdelt:=evalf(abs(zmax-zmin)/zgrid,10): #Commands to create normal field on surface p1:=plot3d(f,theta=thetamin..thetamax,z=zmin..zmax,coords=cylindrical): iii:=0: ppp:='ppp': for thetanow from thetamin to thetamax by thetadelt do for znow from zmin to zmax by zdelt do iii:=iii+1: rnow:=evalf(subs(theta=thetanow,z=znow,f),10): curr_pt:=[rnow*cos(thetanow),rnow*sin(thetanow),znow]: curr_vec:=subs(x=rnow*cos(thetanow),y=rnow*sin(thetanow),z=znow,n): ppp[iii]:=plots[arrow](curr_pt,curr_vec,color=green): end do: end do: ppp:=convert(ppp,'list'): p2:=display(seq(ppp[iii],iii=1..nops(ppp)),insequence=false): display(p1,p2,scaling=constrained); |
Let's look at another example, but this time in spherical coordinates. That is, suppose we are given a surface
in cylindrical coordinates. Then by calculating the gradient in cylindrical coordinates and plotting in cylindrical coordinates, we can find the unit normal and plot a field of vectors.
As above, however, we concentrate on functions so that the plots of the normal fields can be easily produced. In particular, let us explore the graph of
in cylindrical coordinates in the following example.
Example:
The surface
is defined in cylindrical coordiantes. Let's find the unit surface normal in cylindrical coordinates and plot the resulting field of vectors on the surface. First, let us define
and
.
> | f:=sin(phi)*sin(theta); U:=rho-f; |
> |
Now let's compute the gradient in cylindrical coordinates. Maple allows us to see what the gradient in cylindrical coordinates looks like in general. First, we change the coordinate system to cylindrical, and then we execute the
Gradient()
command with no arguments. The result is the gradient applied to an unknown
Scalar Field (SF),
which it denotes by
. The bars over the basis vectors are to indicate that the gradient produces a
field
of vectors--i.e., one for each point on the surface--and is therefore a
Vector Field.
> | SetCoordinates(spherical[rho,theta,phi]); Gradient_in_Cylindrical:=Gradient(); BasisFormat(false): Gradient_in_Cylindrical:=Gradient(); BasisFormat(true): |
> |
Now let's apply this to U :
> | grad_U:=Gradient(U,spherical[rho,theta,phi]); |
> |
Next, let us normalize the gradient to obtain the unit surface normal
> | n:=grad_U/sqrt(simplify(grad_U . grad_U)); |
> |
Now let's graph the surface--in cylindrical coordinates--and the resulting vector field.
> | #Enter plot data thetamin:=0.1: thetamax:=Pi: phimin:=0.1: phimax:=Pi: thetagrid:=5: #Determines how many arrows are drawn phigrid:=5: #Compute unit normal and stepsizes n:=MapToBasis(n,cartesian[x,y,z]): thetamin:=evalf(thetamin,10):thetamax:=evalf(thetamax,10):phimin:=evalf(phimin,10):phimax:=evalf(phimax,10): thetadelt:=evalf(abs(thetamax-thetamin)/thetagrid,10): phidelt:=evalf(abs(phimax-phimin)/phigrid,10): #Commands to create normal field on surface p1:=plot3d(f,theta=thetamin..thetamax,phi=phimin..phimax,coords=spherical): iii:=0: ppp:='ppp': for thetanow from thetamin to thetamax by thetadelt do for phinow from phimin to phimax by phidelt do iii:=iii+1: rhonow:=evalf(subs(theta=thetanow,phi=phinow,f),10): xnow:= rhonow*sin(phinow)*cos(thetanow): ynow:= rhonow*sin(phinow)*sin(thetanow): znow:= rhonow*cos(phinow): curr_pt:=[xnow,ynow,znow]: curr_vec:=subs(x=xnow,y=ynow,z=znow,n)/2: ppp[iii]:=plots[arrow](curr_pt,curr_vec,color=green): end do: end do: ppp:=convert(ppp,'list'): p2:=display(seq(ppp[iii],iii=1..nops(ppp)),insequence=false): display(p1,p2,scaling=constrained,axes=normal); |
> |
> |