Re: Re: Error in CrossProduct at spherical coordinates Version_2.2

*To*: mathgroup at smc.vnet.net*Subject*: [mg14416] Re: Re: Error in CrossProduct at spherical coordinates Version_2.2*From*: David Withoff <withoff>*Date*: Sun, 18 Oct 1998 15:10:18 -0400*Sender*: owner-wri-mathgroup at wolfram.com

> I was at first a little puzzled by David's comment's, now I am a lot > puzzled. Here is my problem. > > It appears that David's comment implies that the "r"-component of a vector > is its length; so that if we have something like {0,1,0} in spherical > coordinates that this is a zero length vector. However, the {r,theta,phi} > coordinate system in spherical coordinates is a legitimate orthogonal set, > thus we can say that the velocity of a particle in a circular orbit is in > the "theta"-direction, i.e. {0,v,0}. > > So, when I wish to represent such a vector emanating from some point not at > the origin, do I, in fact, need to think in terms of the parallel vector > that starts at the origin? So that my simple vector {0,v,0} above becomes > {v,complicated,complicated} ? > > Kevin Here are two attempts at clarification: 1) There are two unrelated things that are described as "the r-component of a vector." (Please excuse my pedantry in the following. I am sure that you already know all of this, but my guess is that the problem can be cleared up by going through it.) If you think back to elementary vector analysis, using vectors to specify points in space, with nothing said about vector fields, a vector from the origin of the space to the point with cartesian coordinates x,y,z could be specified by a list of three numbers, {x,y,z}. If spherical coordinates r,theta,phi are used for that point in space, then the same vector can be specified by the list {r,theta,phi}. The r in this list can be described as "the r-component of the vector." In answer to your first question, this is the "length" (magnitude) of the vector. If this component is zero, the vector is zero. The other two components are just direction angles. A second meaning of "the r-component of a vector" comes up in describing vector fields. If points in space are specified using spherical coordinates, it is customary to introduce a set of three unit vectors at each point in space, with one unit vector pointing in the direction of increasing r, one pointing in the direction of increasing theta, and one pointing in the direction of increasing phi. The vectors of the vector field are then specified by giving their components with respect to those three unit vectors. Within this coordinate system, "the r-component of the vector" is not the magnitude of the vector. It is the component of the vector field in the direction of increasing r at that particular point. This has obvious implications for computing cross products. If the vectors are specified by giving "spherical components" -- the magnitude of each vector, and the two direction angles for each vector -- then the cross product is computed using a rather complicated formula, which is hardly ever used in practice. If the vectors are specified by giving components in the directions of three orthogonal unit vectors (this is what I have called "cartesian components"), then there is a very simple formula for the cross product. It doesn't matter that those unit vectors happen to be oriented to align with the coordinatization of points in space. All that matters is that the components used for the describing the field vectors are the components in three orthogonal directions. 2) Suppose that, perhaps for pedantic reasons, you really did want to compute a cross product using the "spherical components" (the magnitude, and the two direction angles) for each vector. Here is how that can be done in Mathematica. For example, suppose the two vectors are the field vectors A = {Ar, Atheta, Aphi} and B = {Br, Btheta, Bphi} at a point in space specified by the spherical coordinates r, theta, phi, where Ar is the component of the A field in the direction of increasing r, Atheta is the component of the A field in the direction of increasing theta, and so forth. This is just the familiar way of describing a vector field when the points in space are specified using spherical coordinates. To keep the example simple, suppose that the vector field components are such that A = {1,0,0} and B = {0,1,0}. Then, in Cartesian coordinates: In[1]:= A = {1,0,0}; B = {0,1,0}; In[2]:= << Calculus`VectorAnalysis` In[3]:= CrossProduct[A, B] Out[3]= {0, 0, 1} Now do the same calculation by converting to the spherical components (the magnitude and the two direction angles) for these vectors, applying the cross product formula in spherical coordinates, and then converting back to "cartesian components" (components in three orthogonal directions): In[4]:= Asph = CoordinatesFromCartesian[A, Spherical] Pi Out[4]= {1, --, 0} 2 In[5]:= Bsph = CoordinatesFromCartesian[B, Spherical] Pi Pi Out[5]= {1, --, --} 2 2 In[6]:= result = CrossProduct[Asph, Bsph, Spherical] Out[6]= {1, 0, 0} In[7]:= CoordinatesToCartesian[result, Spherical] Out[7]= {0, 0, 1} The components in Out[7] are the same as the components in Out[3]. As mentioned in my previous message, computing cross products from the spherical components of the vectors is almost never done in practice. When people talk about computing cross products in spherical coordinates what is invariably meant is that the components of the vectors are given in the directions of the three orthogonal unit vectors that are aligned with a spherical coordinatization of space. The fact that the Calculus`VectorAnalysis` package allows you to compute cross products of vectors that are actually specified by giving their spherical components is a feature that is included in the package primarily just for completeness. I have never wanted to do this in practice, except out of curiousity. This feature is also the most common source of misunderstanding involving this package. So far no one has figured out a good way to avoid it. Perhaps it would be useful to have a warning message "Are you really really absolutely positively sure that you want to do this?", or something to that effect, whenever the spherical cross product formula is used. Dave Withoff Wolfram Research