NAME: matrix.py
REVISION: v1.11
DESCRIPTION:
The module defines a matrix class (Matrix) with some common methods and
a (3,1)-vector class (Vector) with special vector methods.
A matrix instance of dimension (m,n) consists of an integer value m (rows),
an integer value n (columns) and a list of data elements.
AUTHOR: Mario Chemnitz
FUNCTIONALITY:
Terms used in this document:
S-scalar value, X-arbitrary data object, L-list, M-matrix instance,
V-vector instance
The functions defined in this module are:
isMatrix(X) --> 1 ('true' if X is a matrix instance)
isVector(X) --> 1 ('true' if X is a vector instance)
Matrix([Sm,[Sn,[L]]]) --> (defines a matrix instance of dimension (Sm,Sn)
and the content L)
Vector(Sx,Sy,Sz) --> (defines a three-dimensional vector with the
components Sx, Sy and Sz)
Rx(S) --> M ((3,3)-matrix for rotation on the x-axis; angle S (rad))
Ry(S) --> M ((3,3)-matrix for rotation on the y-axis; angle S (rad))
Rz(S) --> M ((3,3)-matrix for rotation on the z-axis; angle S (rad))
E --> M ((3,3)-identity matrix)
ex --> V (base vector in x direction)
ey --> V (base vector in y direction)
ez --> V (base vector in z direction)
The matrix class methods are:
M.set(L) -->(fills M with the data from L)
M1+M2 --> M (addition)
M1-M2 --> M (subtraction)
-M1 --> M (negation)
len(M) --> S (number of elements)
M[i:j] --> X (element from row i and column j; index starts with 0)
M1*M2 --> M (matrix product)
M*V1 --> V (matrix product returning a vector (3,3)*(3,1)=(3,1))
M1*S --> M (multiplication by a scalar value)
M.det() --> S (determinant of a (3,3)-matrix)
The vector class methods are:
V1+V2 --> V (addition)
V1-V2 --> V (subtraction)
-V1 --> V (negation)
V[i] --> X (element number i; index starts with 0)
V1*V2 --> S (scalar product)
V1*S --> V (multiplication by a scalar)
V1.cross(V2) --> V (cross product)
V.length() --> S (vector length)
V.betrag() --> S ( -"- )
V1.normal() --> V (vector of length 1 in direction of V1)
V1.angle(V2) --> S (angle (rad) between V1 and V2)
V1.winkel(V2) --> S ( -"- )