narupatools.physics.matrix

Utility methods for using matrices.

Functions

identity_matrix

Create a 3x3 identity matrix.

kronecker_delta

Evaluates as 1 when parameters i and j are equal and 0 otherwise.

matrix_inverse

Calculate the inverse \(M^{-1}\) of a 3x3 matrix \(M\).

transpose

Calculate the transpose of 3x3 matrices.

zero_matrix

Create a 3x3 matrix with all zero entries.

narupatools.physics.matrix.identity_matrix()numpy.ndarray[Any, numpy.dtype[numpy.float64]]

Create a 3x3 identity matrix.

narupatools.physics.matrix.kronecker_delta(i: int, j: int)float

Evaluates as 1 when parameters i and j are equal and 0 otherwise.

Parameters
  • i – First argument to check.

  • j – Second argument to check.

narupatools.physics.matrix.matrix_inverse(matrix: Union[numpy.ndarray[Any, numpy.dtype[numpy.float64]], Sequence[numpy.ndarray[Any, numpy.dtype[numpy.float64]]], Sequence[Sequence[float]]])numpy.ndarray[Any, numpy.dtype[numpy.float64]]

Calculate the inverse \(M^{-1}\) of a 3x3 matrix \(M\).

The inverse \(M^{-1}\) is the matrix which fufills the identity:

\[M^{-1} M = M M^{-1} = I\]

where \(I\) is the identity matrix.

Parameters

matrix – Matrix \(M^{-1}\) to invert.

Raises

ValueError – Matrix is singular and hence an inverse does not exist.

Returns

Inverse of the matrix \(M\)

narupatools.physics.matrix.transpose(matrix: Union[numpy.ndarray[Any, numpy.dtype[numpy.float64]], Sequence[numpy.ndarray[Any, numpy.dtype[numpy.float64]]], Sequence[Sequence[float]]])numpy.ndarray[Any, numpy.dtype[numpy.float64]]

Calculate the transpose of 3x3 matrices.

narupatools.physics.matrix.zero_matrix()numpy.ndarray[Any, numpy.dtype[numpy.float64]]

Create a 3x3 matrix with all zero entries.