Wrong behavior of CrossProduct
- To: mathgroup at smc.vnet.net
- Subject: [mg7958] Wrong behavior of CrossProduct
- From: sergio at scisun.sci.ccny.cuny.edu (Sergio Rojas)
- Date: Fri, 25 Jul 1997 02:40:32 -0400
- Organization: City College Of New York - Science
- Sender: owner-wri-mathgroup at wolfram.com
(* Hello fellows:
After playing a little bit with the Mathematica construction for the cross
product of two vectors, implemented by the function CrossProduct of the
package VectorAnalysis, I strongly believe that CrossProduct do not
work properly on Mathematica ... *)
In[1]:= $Version
Out[1]= DEC OSF/1 Alpha 2.2 (September 9, 1994)
In[2]:= Needs["Calculus`VectorAnalysis`"];
In[3]:= V = {a1,a2,0};
In[4]:= U = {0, 0, 1};
In[5]:= CrossProduct[U,V]
Out[5]= {-a2, a1, 0}
(* This result is correct *)
In[6]:= CoordinateSystem
Out[6]= Cartesian
(************ Quit and start again ************)
In[1]:= Needs["Calculus`VectorAnalysis`"];
In[2]:= SetCoordinates[Cylindrical[r,phi,z]];
In[3]:= V = {a1,a2,0};
In[4]:= U = {0, 0, 1};
In[5]:= CrossProduct[U,V]
2 2 2 2
Out[5]= {Sqrt[a1 Cos[a2] + a1 Sin[a2] ],
> ArcTan[-(a1 Sin[a2]), a1 Cos[a2]], 0}
In[6]:= PowerExpand[Simplify[%]]
Out[6]= {a1, ArcTan[-(a1 Sin[a2]), a1 Cos[a2]], 0}
In[7]:= ?ArcTan
ArcTan[z] gives the inverse tangent of z. ArcTan[x, y] gives the inverse
tangent of y/x where x and y are real, taking into account which quadrant
the point (x, y) is in.
(* Using Mathematica definition for ArcTan[x, y], Out[6] can be
rewritten as {a1,-ArcTan[Cot[a2]],0}. This answer is obviously
wrong as far as the Cross Product of V and U concern *)
In[7]:= CoordinateSystem
Out[7]= Cylindrical
(************ Quit and start again ************)
In[1]:= Needs["Calculus`VectorAnalysis`"];
In[2]:= SetCoordinates[Spherical[r,theta,phi]];
In[3]:= V = {a1,a2,0};
In[4]:= U = {0, 0, 1};
In[5]:= CrossProduct[U,V]
Out[5]= {0, 0, 0}
(* Again, wrong result. Same results were obtained on *)
In[1]:= $Version
Out[1]= SPARC 2.2 (December 15, 1993)
Rojas
E-mail: sergio at scisun.sci.ccny.cuny.edu