Vector products: Difference between revisions
Content added Content deleted
m (→{{header|Factor}}: whitespace/style tweaks) |
|||
Line 1,024:
=={{header|Factor}}==
Factor has a fantastic <tt>math.vectors</tt> vocabulary, but in the spirit of the task, it is not used.
<lang factor>USING: arrays io locals math prettyprint sequences ;▼
▲USING: arrays io locals math prettyprint sequences ;
: dot-product ( a b -- dp ) [ * ] 2map sum ;
Line 1,055 ⟶ 1,053:
"a . (b x c): " write a b c scalar-triple-product .
"a x (b x c): " write a b c vector-triple-product .
]</lang>▼
▲</lang>
{{out}}
<pre>
|