Vector products: Difference between revisions

Content added Content deleted
Line 1,238: Line 1,238:
An alternative definition for cross (based on finding the determinant of a 3 by 3 matrix where one row is unit vectors) could be:
An alternative definition for cross (based on finding the determinant of a 3 by 3 matrix where one row is unit vectors) could be:
<lang j>cross=: [: > [: -&.>/ .(*&.>) (<"1=i.3) , ,:&:(<"0)</lang>
<lang j>cross=: [: > [: -&.>/ .(*&.>) (<"1=i.3) , ,:&:(<"0)</lang>

Implementation:
With an implementation of cross product, the rest of the task becomes trivial:

<lang j>a=: 3 4 5
<lang j>a=: 3 4 5
b=: 4 3 5
b=: 4 3 5