Vector products: Difference between revisions
Added Quackery.
No edit summary |
(Added Quackery.) |
||
Line 4,386:
;Note:
The popular [http://numpy.scipy.org/ numpy] package has functions for dot and cross products.
=={{header|Quackery}}==
<lang Quackery> [ 0 unrot witheach
[ over i^ peek *
rot + swap ]
drop ] is dotproduct ( [ [ --> n )
[ join
dup 1 peek over 5 peek *
swap
dup 2 peek over 4 peek *
swap dip -
dup 2 peek over 3 peek *
swap
dup 0 peek over 5 peek *
swap dip -
dup 0 peek over 4 peek *
swap
dup 1 peek swap 3 peek *
- join join ] is crossproduct ( [ [ --> [ )
[ crossproduct dotproduct ] is scalartriple ( [ [ [ --> n )
[ crossproduct crossproduct ] is vectortriple ( [ [ [ --> [ )
[ ' [ 3 4 5 ] ] is a ( --> [ )
[ ' [ 4 3 5 ] ] is b ( --> [ )
[ ' [ -5 -12 -13 ] ] is c ( --> [ )
a b dotproduct echo cr
a b crossproduct echo cr
a b c scalartriple echo cr
a b c vectortriple echo cr</lang>
{{out}}
<pre>49
[ 5 5 -7 ]
6
[ -267 204 -3 ]
</pre>
=={{header|R}}==
|