https://code.jsoftware.com/wiki/Phrases/Matrices#Vector_cross_product
R.E. Boss > -----Oorspronkelijk bericht----- > Van: Programming <[email protected]> > Namens J. Patrick Harrington > Verzonden: zaterdag 8 februari 2020 15:33 > Aan: [email protected] > Onderwerp: Re: [Jprogramming] cross product of two vectors > > Something I've used on big arrays is this: > cross=: ((1: |.[)*(_1: |. ]))-((_1: |.[)*(1:|.])) > > E.g. > v=. 2 1 7 > u=. _3 4 _1 > u cross v > 29 19 _11 > > rand=: ?@# 0: > u=. 1e6 3$rand 3e6 > v=. 1e6 3$rand 3e6 > ts'z=. u cross v' NB. time & space > 0.054138 1.00665e8 > > $z > 1000000 3 > > Give it a try :-) > Patrick > > On Sat, 8 Feb 2020, [email protected] wrote: > > > Dear list, > > > > > > is there a concise way to calculate a cross product of 2 vectors (in > > 3D, of course). > > > > > > Thanks > > Ruda > > ---------------------------------------------------------------------- > > For information about J forums see > http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
