       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,u,u) with the orthogonal property:

u[i].u[j] = Delta[i,j]  where Delta[i_, j_] := If[i==j, 1, 0]

uxu =  u ; uxu =  u ; uxu =  u
uxu = -u ; uxu = -u ; uxu = -u
uxu =   0   ; uxu =   0   ; uxu =   0

Then, the above result follows by expanding:

(a*u + a*u + a*u)x(b*u + b*u + b*u)

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:= Needs["Calculus`VectorAnalysis`"];
> > In:= SetCoordinates[Cylindrical[r,phi,z]];
> > In:= V = {a1,a2,0};
> > In:= U = {0, 0, 1};
> > In:= CrossProduct[U,V]
> >
> >                 2        2     2        2
> > Out= {Sqrt[a1  Cos[a2]  + a1  Sin[a2] ],
> >
> > >    ArcTan[-(a1 Sin[a2]), a1 Cos[a2]], 0}
> >
> > In:= PowerExpand[Simplify[%]]
> > Out= {a1, ArcTan[-(a1 Sin[a2]), a1 Cos[a2]], 0}
> >
> > In:= ?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 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:= ArcTan[-(a1 Sin[a2]), a1 Cos[a2]] /. {a1 -> 1, a2 -> 1.3}
>
> Out= 2.8708
>
> In:= -ArcTan[Cot[a2]] /. {a1 -> 1, a2 -> 1.3}
>
> Out= -0.270796
>
> In this example:
>
> > In:= Needs["Calculus`VectorAnalysis`"];
> > In:= SetCoordinates[Spherical[r,theta,phi]];
> > In:= V = {a1,a2,0};
> > In:= U = {0, 0, 1};
> > In:=  CrossProduct[U,V]
> > Out= {0, 0, 0}
> > 	         (* Again, wrong result. Same results were obtained on *)
> > In:= \$Version
> > Out= 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
>

```

• Prev by Date: Re: How to select unique elements in a list?
• Next by Date: AW: Questions on fitting and plotting data
• Previous by thread: Re: Wrong behavior of CrossProduct
• Next by thread: Re: Wrong behavior of CrossProduct