Previous Page Next Page Contents

linalg::crossProduct -- cross product of three-dimensional vectors

Introduction

linalg::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)

Parameters

u, v - 3-dimensional vectors, i.e., either two 3 x 1 or two 1 x 3 matrices of a domain of category Cat::Matrix

Returns

a vector of the same domain type as u.

Related Functions

linalg::scalarProduct

Details

Example 1

We 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




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000