Lest you think that I know anything about cross products,
I should let you know that that part of J Phrases was
the work of Ken Iverson.  The alternative definition of the 
complete tensor shown on the dictionary C. page
http://www.jsoftware.com/help/dictionary/dccapdot.htm
was also due to him.  (It uses sparse arrays!)

CT=: 3 : '(C.!.2 p) (<"1 p=. (i.!y) A. i.y)}1$.$~y'

   (CT -: cst)"0 >:i.6
1 1 1 1 1 1



----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Wednesday, August 15, 2007 16:32
Subject: Re: [Jprogramming] a vector product
To: Programming forum <[email protected]>

> Phrases d21 and d22 and their constituents are:
> 
> ip=: +/ .*
> cst=: 
> C.!.2@(#:i.)@:#~            NB. Complete skew tensor
> d21=: cross1=: [ ip [EMAIL PROTECTED]@[ ip ]  NB. Generalized cross-product
> d22=: cross2=: ((_1: |.[)*(1:|.]))-((1: |.[)*(_1: |. ]))
>       NB. Conventional cross product (not valid for dimension greater 
> than 3)
> 
> cross2 can be shortened using the nvv fork which 
> was not available at the time of the original writing
> of J Phrases:
> 
> cross2a=: ((_1 |.[)*(1|.])) - ((1 |.[)*(_1 |. ]))
> 
> Moreover, depending on your tastes, the following may
> be preferred:
> 
> cross2b=: (_1&|[EMAIL PROTECTED] * 1&|[EMAIL PROTECTED]) - (1&|[EMAIL 
> PROTECTED] * _1&|[EMAIL PROTECTED])
> 
> As is commonly the case, a derivation from the general
> case may be more insightful:
> 
> cross1a=: [ ip (cst 3) ip ]
> cross1b=: ip (cst 3)&ip
> 
>    ] x=: _40 + 3 [EMAIL PROTECTED] 100
> 15 _35 15
>    ] y=: _40 + 3 [EMAIL PROTECTED] 100
> 33 18 10
>    x cross1 y
> 620 _345 _1425
>    x cross1a y
> 620 _345 _1425
>    x cross1b y
> 620 _345 _1425
>    
>    x cross2 y
> 620 _345 _1425
>    x cross2a y
> 620 _345 _1425
>    x cross2b y
> 620 _345 _1425
> 
>    cst 3
>  0  0  0
>  0  0  1
>  0 _1  0
> 
>  0  0 _1
>  0  0  0
>  1  0  0
> 
>  0  1  0
> _1  0  0
>  0  0  0
> 
> 
> 
> ----- Original Message -----
> From: Roger Hui <[EMAIL PROTECTED]>
> Date: Wednesday, August 15, 2007 15:56
> Subject: Re: [Jprogramming] a vector product
> To: Programming forum <[email protected]>
> 
> > Please see phrases d21 and d22 in
> > http://www.jsoftware.com/jwiki/JPhrases/ParitySymmetry
> > 
> > 
> > 
> > ----- Original Message -----
> > From: Tracy Harms <[EMAIL PROTECTED]>
> > Date: Wednesday, August 15, 2007 15:33
> > Subject: [Jprogramming] a vector product
> > To: [email protected]
> > 
> > > In "Elementary Matrix Theory", Howard Eves defines a vector 
> > > product, for
> > > three-dimensional (real) Cartesian coordinate use, so: 
> > >  
> > > c = (a2b3 - a3b2, a3b1 - a1b3, a1b2 - a2b1)
> > >  
> > > (Above, all numerals are subscripts denoting vector elements.)
> > >  
> > > I implemented that calculation of c with the following 
> definitions:> >  
> > >    atomsb =: 1 0 { atomsa =: 3 4 A. i.3
> > >    vp =: -/@:((atomsa { [) * atomsb { ])
> > >    
> > > My question is, does this seem as good a way as any to 
> handle 
> > > this? In
> > > particular, is this a case where it is not worth trying to 
> > shoe-
> > > horn the
> > > functions into a dot phrasing?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to