Re: Wrong behavior of CrossProduct

*To*: mathgroup at smc.vnet.net*Subject*: [mg7976] Re: [mg7958] Wrong behavior of CrossProduct*From*: Sergio Rojas <sergio at scisun.sci.ccny.cuny.edu>*Date*: Wed, 30 Jul 1997 02:37:46 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Hello: How Mathematica implement the Cross Product of two vectors? As far as I know the basic definition of the Cross Product between two vectors in ANY ORTHOGONAL coordinated system is as follows: (a1,a2,a3)X(b1,b2,b3) = (a2*b3 - a3*b2, a3*b1 - a1*b3, a1*b2 - a2*b1) In physics this is usually illustrated by taking any three UNIT vectors (u[1],u[2],u[3]) with the orthogonal property: u[i].u[j] = Delta[i,j] where Delta[i_, j_] := If[i==j, 1, 0] u[1]xu[2] = u[3] ; u[2]xu[3] = u[1] ; u[3]xu[1] = u[2] u[2]xu[1] = -u[3] ; u[3]xu[2] = -u[1] ; u[1]xu[3] = -u[3] u[1]xu[1] = 0 ; u[2]xu[2] = 0 ; u[3]xu[3] = 0 Then, the above result follows by expanding: (a[1]*u[1] + a[2]*u[2] + a[3]*u[3])x(b[1]*u[1] + b[2]*u[2] + b[3]*u[3]) and using the orthogonal property of the unit vectors. In my example, a = ( 0, 0,1) ; b = (a1,a2,0) axb = ( a2, -a1, 0 ) . This should be true in ANY ORTHOGONAL coordinated system. However, the meaning of each symbol need to be adjusted accordingly. Please, let me know what I am missing if the above is not true. Rojas E-mail: sergio at scisun.sci.ccny.cuny.edu On Fri, 25 Jul 1997, David Withoff wrote: > > (* 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]:= 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 *) > > I think that the result from CrossProduct[U,V] is correct. > ArcTan[-(a1 Sin[a2]), a1 Cos[a2]] is not equivalent to -ArcTan[Cot[a2]]. > One way to see that is to insert numerical values for a1 and a2 and > observe that the results are not the same. > > In[1]:= ArcTan[-(a1 Sin[a2]), a1 Cos[a2]] /. {a1 -> 1, a2 -> 1.3} > > Out[1]= 2.8708 > > In[2]:= -ArcTan[Cot[a2]] /. {a1 -> 1, a2 -> 1.3} > > Out[2]= -0.270796 > > In this example: > > > 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 > > U is a zero vector (r is 0), so it seems that the result {0, 0, 0} for > CrossProduct[U,V] is correct. > > Dave Withoff > Wolfram Research >