linalg::crossProduct --
cross product of three-dimensional vectors
Introductionlinalg::crossProduct(u, v) computes the
cross product of the three-dimensional vectors u and
v. This is the vector
u x v = [u[1]*v[3] - u[3]*v[2], u[3]*v[1] - u[1]*v[3], u[1]*v[2] - u[2]*v[1]].
Call(s)linalg::crossProduct(u, v)
Parametersu, v |
- | 3-dimensional vectors, i.e., either two 3 x
1 or two 1 x 3 matrices of a domain of category
Cat::Matrix |
Returnsa vector of the same domain type as u.
Related
Functions
Details
Example
1We define two vectors:
>> a := matrix([[1, 2, 3]]); b := matrix([[-1, 0, 1]])
+- -+
| 1, 2, 3 |
+- -+
+- -+
| -1, 0, 1 |
+- -+
The cross product of these two vectors is a vector c which is orthogonal to a and b:
>> c:= linalg::crossProduct(a, b)
+- -+
| 2, -4, 2 |
+- -+
>> linalg::scalarProduct(a, c), linalg::scalarProduct(b, c)
0, 0