What is R's crossproduct function? -


i feel stupid asking, intent of r's crossprod function respect vector inputs? wanted calculate cross-product of 2 vectors in euclidean space , mistakenly tried using crossprod .
1 definition of vector cross-product n = |a|*|b|*sin(theta) theta angle between 2 vectors. (the direction of n perpendicular a-b plane). way calculate n = ax*by - ay*bx .
base::crossprod not calculation, , in fact produces vector dot-product of 2 inputs sum(ax*bx, ay*by).

so, can write own vectorxprod(a,b) function, can't figure out crossprod doing in general.

see r - compute cross product of vectors (physics)

according function in r: crossprod (x,y) = t(x)%*% y faster implementation expression itself. function of 2 matrices, , if have 2 vectors corresponds dot product.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -