RE: Re: Wrong behavior of CrossProduct
- To: mathgroup at smc.vnet.net
- Subject: [mg8018] RE: [mg7976] Re: [mg7958] Wrong behavior of CrossProduct
- From: "Richard W. Finley, M. D." <trfin at umsmed.edu>
- Date: Sat, 2 Aug 1997 22:32:29 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Hi all,
There is a problem here in confusing vector components and parameters =
that define those components. We are used to working in orthogonal =
Cartesian systems where they are equal so it is not a problem until we =
switch to a non-Cartesian orthogonal system. The easiest way to see =
this is with the example of cylindrical coordinates where the parameters =
are {r, phi, z} and look at the cross product of unit vectors along the =
y-axis and z-axis...their cross product obviously gives the unit vector =
along the x-axis. This means that
U = {1, Pi/2, 0} **the y-axis unit vector* and
V = { 0, 0, 1} **the z-axis unit vector*
should give U X V = { 1, 0, 0 } **the x-axis unit vector...i.e. r = =
1, phi = 0, z = 0 *
And NOT the result { Pi/2, -1, 0 } as suggested by the explanation given =
below..{a2, -a1, 0 }
This is simply a confusion of the parameters with components of the =
vector.
Hope that helps...
RF
-----Original Message-----
From: Sergio Rojas [SMTP:sergio at scisun.sci.ccny.cuny.edu]
Subject: [mg7976] Re: [mg7958] Wrong behavior of CrossProduct
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
>