Compute the characteristic polynomial det(lambda*I - A) of a square matrix using the Faddeev-LeVerrier algorithm. Returns an array of coefficients in ascending order [c_0, c_1, ..., c_n] where c_0 + c_1*lambda + ... + c_n*lambda^n.
Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.
Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved,
Object with keys `precision`, defaulting to config.relTol, and `eigenvectors`, defaulting to true and specifying whether to compute eigenvectors. If just a number, specifies precision.
Returns
{values: Array|Matrix, eigenvectors?: Array<EVobj> — } Object containing an array of eigenvalues and an array of {value: number|BigNumber, vector: Array|Matrix} objects. The eigenvectors property is undefined if eigenvectors were not requested.
Reduce a square matrix A to upper Hessenberg form using Householder reflections. Returns an object { H, Q } where H is upper Hessenberg (zeros below the first subdiagonal) and Q is orthogonal, satisfying A = Q * H * Q^T.
Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.
Syntax
identity(n) | identity(m | n)
Type Signatures
number | BigNumber, number | BigNumber, string, number | BigNumber, number | BigNumber, number | BigNumber, number | BigNumber, string, Array, string, Matrix, string
Parameters
Name
Type
Description
size
...number | Matrix | Array
The size for the matrix
format
string
The Matrix storage format
Returns
Matrix | Array | number — A matrix with ones on the diagonal.
Compute the Jordan normal form J of a square matrix A and a transition matrix P such that A = P * J * inv(P). For simple eigenvalues the result is diagonal; for repeated eigenvalues Jordan blocks with 1s on the superdiagonal are constructed.
Compute the principal matrix logarithm of a square matrix A using eigendecomposition. Returns L such that expm(L) ≈ A. Requires that A has strictly positive real eigenvalues.
Syntax
matrixLog(A)
Type Signatures
Array | Matrix
Parameters
Name
Type
Description
A
Array | Matrix
A square matrix with positive eigenvalues
Returns
Array | Matrix — The principal matrix logarithm of A
Raise a square matrix A to an integer power n. For n > 0 uses binary exponentiation (repeated squaring). For n = 0 returns the identity matrix. For n < 0 returns inv(A)^|n|.
Compute an orthonormal basis for the null space (kernel) of a matrix A using Singular Value Decomposition. Returns an array of basis vectors corresponding to near-zero singular values.
Syntax
nullSpace(A) | nullSpace(A | tol)
Type Signatures
Array | Matrix, Array | Matrix, number
Parameters
Name
Type
Description
A
Array | Matrix
A two-dimensional matrix (m x n)
tol
number
Optional tolerance for near-zero singular values.
Returns
Array[] | Matrix[] — Array of basis vectors (each a plain Array or Matrix
Compute the polar decomposition A = U * P of a square matrix A, where U is an orthogonal (unitary) matrix and P is a symmetric positive semidefinite matrix. Computed via SVD: A = U_svd * diag(S) * V^T, then U = U_svd * V^T and P = V * diag(S) * V^T.
Returns a 2-D rotation matrix (2x2) for a given angle (in radians).
Syntax
rotate(w | theta) | rotate(w
Type Signatures
Array , number | BigNumber | Complex | Unit, Matrix , number | BigNumber | Complex | Unit, Array, number | BigNumber | Complex | Unit, Array | Matrix, Matrix, number | BigNumber | Complex | Unit, Array | Matrix
Parameters
Name
Type
Description
w
Array | Matrix
Vector to rotate
theta
number | BigNumber | Complex | Unit
Rotation angle
v
Array | Matrix
Rotation axis
Returns
Array | Matrix — Multiplication of the rotation matrix and w
Returns a 2-D rotation matrix (2x2) for a given angle (in radians).
Syntax
rotationMatrix(theta) | rotationMatrix(theta | v)
Type Signatures
number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit, string, number | BigNumber | Complex | Unit, Array, number | BigNumber | Complex | Unit, Matrix, number | BigNumber | Complex | Unit, Array, string, number | BigNumber | Complex | Unit, Matrix, string
Compute the Reduced Row Echelon Form (RREF) of a matrix using Gauss-Jordan elimination with partial pivoting. Each pivot element is scaled to 1, and all other entries in the pivot column are eliminated.
Compute the Singular Value Decomposition A = U * diag(S) * V^T, returning an object { U, S, V } where U and V are orthogonal matrices and S is a vector of non-negative singular values in descending order.