What am I doing wrong?
> crossprod(1:3,4:6)
[,1]
[1,] 32
According to this website:http://onlinemschool.com/math/assistance/vector/multiply1/
It should give:
{-3; 6; -3}
See also What is R's crossproduct function?
What am I doing wrong?
> crossprod(1:3,4:6)
[,1]
[1,] 32
According to this website:http://onlinemschool.com/math/assistance/vector/multiply1/
It should give:
{-3; 6; -3}
See also What is R's crossproduct function?
crossprod does the following:
t(1:3) %*% 4:6
Therefore it is a 1x3 vector times a 3x1 vector --> a scalar
Here is a generalized cross product:
For your example:
This works for any dimension:
See https://en.wikipedia.org/wiki/Cross_product
crossprod computes a Matrix Product. To perform a Cross Product, either write your function, or:
if the first line above does not work, try this: