This subpackage contains classes that deal with geometrical quantities and objects. The geometrical quantities are vectors and tensors, transformations, and quaternions as descriptions of rotations. There are also tensor fields, which were included here (rather than in the subpackage Scientific.Functions) because they are most often used in a geometric context. Finally, there are classes for elementary geometrical objects such as spheres and planes.
Constructor: Tensor([[xx, xy, xz], [yx, yy, yz], [zx, zy, zz]])
Tensors support the usual arithmetic operations (t1, t2: tensors, v: vector, s: scalar):
t1+t2 (addition)
t1-t2 (subtraction)
t1*t2 (tensorial (outer) product)
t1*v (contraction with a vector, same as t1.dot(v.asTensor()))
s*t1, t1*s (multiplication with a scalar)
t1/s (division by a scalar)
The coordinates can be extracted by indexing; a tensor of rank N can be indexed like an array of dimension N.
Tensors are immutable, i.e. their elements cannot be changed.
Tensor elements can be any objects on which the standard arithmetic operations are defined. However, eigenvalue calculation is supported only for float elements.
Methods:Returns an equivalent vector object (only for rank 1).
Returns the contraction with other.
Returns the trace of a rank-2 tensor.
Returns the transposed (index reversed) tensor.
Returns the symmetrical part of a rank-2 tensor.
Returns the asymmetrical part of a rank-2 tensor.
Returns the eigenvalues of a rank-2 tensor in an array.
Returns the eigenvalues of a rank-2 tensor and a tensor representing the rotation matrix to the diagonalized form.
Returns the inverse of a rank-2 tensor.
Constructor:
Vector(x, y, z) (from three coordinates)
Vector(coordinates) (from any sequence containing three coordinates)
Vectors support the usual arithmetic operations (v1, v2: vectors, s: scalar):
v1+v2 (addition)
v1-v2 (subtraction)
v1*v2 (scalar product)
s*v1, v1*s (multiplication with a scalar)
v1/s (division by a scalar)
The three coordinates can be extracted by indexing.
Vectors are immutable, i.e. their elements cannot be changed.
Vector elements can be any objects on which the standard arithmetic operations plus the functions sqrt and arccos are defined.
Methods:Returns the x coordinate.
Returns the y coordinate.
Returns the z coordinate.
Returns the length (norm).
Returns a normalized copy.
Returns the cross product with vector other.
Returns an equivalent tensor object of rank 1.
Returns the dyadic product with vector or tensor other.
Returns the angle to vector other.