Vector products: Difference between revisions
Content added Content deleted
(→{{header|AWK}}: vector products) |
(adding r) |
||
Line 1,719: | Line 1,719: | ||
;Note: |
;Note: |
||
The popular [http://numpy.scipy.org/ numpy] package has functions for dot and cross products. |
The popular [http://numpy.scipy.org/ numpy] package has functions for dot and cross products. |
||
=={{header|R}}== |
|||
<lang r>a <- c( 3.0, 4.0, 5.0) |
|||
b <- c( 4.0, 3.0, 5.0) |
|||
cross <- function(a, b) |
|||
c(a[2]*b[3] - a[3]*b[2], |
|||
a[3]*b[1] - a[1]*b[3], |
|||
a[1]*b[2] - a[2]*b[1]) |
|||
cross(a, b) |
|||
# [1] 5 5 -7</lang> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |