Vector products: Difference between revisions
Content added Content deleted
m (made Wikipedia references more uniform.) |
(→JS ES6: Tidied and extended test.) |
||
Line 1,884: | Line 1,884: | ||
console.log(unlines( |
console.log(unlines( |
||
zipWith( |
zipWith(k => f => k + show( |
||
fapp(f)([a, b, c]) |
|||
))(['a . b', 'a x b', 'a . (b x c)', 'a x (b x c)'])( |
|||
⚫ | |||
⚫ | |||
[dotProduct, crossProduct, scalarTriple, vectorTriple] |
[dotProduct, crossProduct, scalarTriple, vectorTriple] |
||
) |
) |
||
.concat([ |
|||
⚫ | |||
⚫ | |||
), |
|||
⚫ | |||
scalarTriple(a)(b)(d) |
|||
⚫ | |||
⚫ | |||
)); |
)); |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}; |
}; |
||
Line 1,974: | Line 1,975: | ||
a . (b x c) = 6 |
a . (b x c) = 6 |
||
a x (b x c) = [-267,204,-3] |
a x (b x c) = [-267,204,-3] |
||
a . d => Dot product not defined - vectors differ in dimension |
a . d => Dot product not defined - vectors differ in dimension. |
||
a . (b x d) => crossProduct is defined only for 3d vectors.</pre> |
|||
=={{header|jq}}== |
=={{header|jq}}== |