Skip to content
Symi Docs
WASM / JavaScript

Signatures in the WASM / JavaScript view are TypeScript. Where the JavaScript facade wraps an operation its form is listed first; the other calling forms are the raw wasm-bindgen exports.

On this page

Linear algebra

Matrix arithmetic and linear algebra operations are exact symbolic operations.

Arithmetic#

Python additionally overloads +, -, and * over these named methods. * is the matrix product when both operands are matrices and scales every entry when either operand is an expression-like scalar, on either side: A * 2, 2 * A, and x * A are all scalar_multiply. A matrix displays its entries: repr(A) in Python and toString() in JavaScript are its summary, such as Matrix([[1, x], [0, 1]]), eliding beyond eight rows or columns and stating the full shape when it does.

add#

Matrix method

add(other: Matrix): Matrix

Entrywise sum of two matrices of the same shape.

Calling forms

Raw WebAssembly: Matrix method: Matrix.add

add(other: Matrix): Matrix

subtract#

Raw WebAssembly: Matrix method

subtract(other: Matrix): Matrix

Entrywise difference of two matrices of the same shape.

multiply#

Matrix product; inner dimensions must agree.

Matrix method

multiply(other: Matrix): Matrix

Matrix product; inner dimensions must agree.

Calling forms

Raw WebAssembly: Matrix method: Matrix.multiply

multiply(other: Matrix): Matrix

scalar_multiply#

Not exposed by the WASM / JavaScript bindings. Available as Matrix.scalar_multiply in Python, UniffiMatrix.scalarMultiply in Kotlin, UniffiMatrix.scalarMultiply in Swift, api::Matrix::scalar_multiply in Rust.

Matrix assumptions#

Matrix predicates are available as methods on Matrix, as constructors on an explicit Context, and as default-context module functions in Python and WASM. Native Rust uses the corresponding Session methods. Query methods return True/False/None (or the native TruthValue), preserving unknown when the exact symbolic engine cannot decide.

matrix_shape#

Raw WebAssembly: Default context

matrixShape(
    subject: Matrix,
    rows: number,
    columns: number,
): AssumptionProposition
Calling forms

Explicit context: Context.matrixShape

matrixShape(value: Matrix, rows: number, columns: number): AssumptionProposition

Raw WebAssembly: Explicit context: Context.matrixShape

matrixShape(
    subject: Matrix,
    rows: number,
    columns: number,
): AssumptionProposition

SymiFacade method: SymiFacade.matrixShape

matrixShape(value: Matrix, rows: number, columns: number): AssumptionProposition

Assert or query an exact positive row and column count.

square_matrix#

Raw WebAssembly: Default context

squareMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.squareMatrix

squareMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.squareMatrix

squareMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.squareMatrix

squareMatrix(value: Matrix): AssumptionProposition

Assert or query that the matrix has equal row and column counts.

zero_matrix#

Assert or query that all entries are zero.

identity_matrix#

Assert or query the identity-matrix structure.

diagonal_matrix#

Assert or query diagonal structure.

upper_triangular_matrix#

Raw WebAssembly: Default context

upperTriangularMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.upperTriangularMatrix

upperTriangularMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.upperTriangularMatrix

upperTriangularMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.upperTriangularMatrix

upperTriangularMatrix(value: Matrix): AssumptionProposition

Assert or query upper-triangular structure.

lower_triangular_matrix#

Raw WebAssembly: Default context

lowerTriangularMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.lowerTriangularMatrix

lowerTriangularMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.lowerTriangularMatrix

lowerTriangularMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.lowerTriangularMatrix

lowerTriangularMatrix(value: Matrix): AssumptionProposition

Assert or query lower-triangular structure.

symmetric_matrix#

Raw WebAssembly: Default context

symmetricMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.symmetricMatrix

symmetricMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.symmetricMatrix

symmetricMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.symmetricMatrix

symmetricMatrix(value: Matrix): AssumptionProposition

Assert or query equality with the transpose.

hermitian_matrix#

Raw WebAssembly: Default context

hermitianMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.hermitianMatrix

hermitianMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.hermitianMatrix

hermitianMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.hermitianMatrix

hermitianMatrix(value: Matrix): AssumptionProposition

Assert or query equality with the conjugate transpose.

orthogonal_matrix#

Raw WebAssembly: Default context

orthogonalMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.orthogonalMatrix

orthogonalMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.orthogonalMatrix

orthogonalMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.orthogonalMatrix

orthogonalMatrix(value: Matrix): AssumptionProposition

Assert or query the real orthogonality condition.

unitary_matrix#

Raw WebAssembly: Default context

unitaryMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.unitaryMatrix

unitaryMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.unitaryMatrix

unitaryMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.unitaryMatrix

unitaryMatrix(value: Matrix): AssumptionProposition

Assert or query the unitary condition.

normal_matrix#

Raw WebAssembly: Default context

normalMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.normalMatrix

normalMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.normalMatrix

normalMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.normalMatrix

normalMatrix(value: Matrix): AssumptionProposition

Assert or query commutation with the conjugate transpose.

full_rank_matrix#

Raw WebAssembly: Default context

fullRankMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.fullRankMatrix

fullRankMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.fullRankMatrix

fullRankMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.fullRankMatrix

fullRankMatrix(value: Matrix): AssumptionProposition

Assert or query full rank.

invertible_matrix#

Raw WebAssembly: Default context

invertibleMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.invertibleMatrix

invertibleMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.invertibleMatrix

invertibleMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.invertibleMatrix

invertibleMatrix(value: Matrix): AssumptionProposition

Assert or query square invertibility.

singular_matrix#

Raw WebAssembly: Default context

singularMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.singularMatrix

singularMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.singularMatrix

singularMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.singularMatrix

singularMatrix(value: Matrix): AssumptionProposition

Assert or query square singularity.

integer_entries#

Raw WebAssembly: Default context

integerEntries(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.integerEntries

integerEntries(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.integerEntries

integerEntries(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.integerEntries

integerEntries(value: Matrix): AssumptionProposition

Assert or query integer entries.

real_entries#

Raw WebAssembly: Default context

realEntries(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.realEntries

realEntries(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.realEntries

realEntries(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.realEntries

realEntries(value: Matrix): AssumptionProposition

Assert or query real entries.

complex_entries#

Raw WebAssembly: Default context

complexEntries(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.complexEntries

complexEntries(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.complexEntries

complexEntries(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.complexEntries

complexEntries(value: Matrix): AssumptionProposition

Assert or query finite complex entries.

positive_definite_matrix#

Raw WebAssembly: Default context

positiveDefiniteMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.positiveDefiniteMatrix

positiveDefiniteMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.positiveDefiniteMatrix

positiveDefiniteMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.positiveDefiniteMatrix

positiveDefiniteMatrix(value: Matrix): AssumptionProposition

Assert or query exact positive definiteness.

positive_semidefinite_matrix#

Raw WebAssembly: Default context

positiveSemidefiniteMatrix(subject: Matrix): AssumptionProposition
Calling forms

Explicit context: Context.positiveSemidefiniteMatrix

positiveSemidefiniteMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.positiveSemidefiniteMatrix

positiveSemidefiniteMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.positiveSemidefiniteMatrix

positiveSemidefiniteMatrix(value: Matrix): AssumptionProposition

Assert or query exact positive semidefiniteness.

transpose#

Raw WebAssembly: Matrix method

transpose(): Matrix

The transpose, with rows and columns exchanged.

determinant#

Fraction-free (Berkowitz/Bareiss) determinant of a square matrix.

Matrix method

determinant(): Expression

Fraction-free (Berkowitz/Bareiss) determinant of a square matrix.

Calling forms

Raw WebAssembly: Matrix method: Matrix.determinant

determinant(): Expression

trace#

Matrix method

trace(): Expression

Sum of the diagonal entries of a square matrix.

Calling forms

Raw WebAssembly: Matrix method: Matrix.trace

trace(): Expression

characteristic_polynomial#

Raw WebAssembly: Matrix method

characteristicPolynomial(variable: string): Expression

det⁡(λI−M)\det(\lambda I - M) as a polynomial in the named variable.

minimal_polynomial#

Raw WebAssembly: Matrix method

minimalPolynomial(variable: string): Expression

The monic minimal polynomial over the rationals. The matrix must have rational entries.

eigenvalues#

Eigenvalues with multiplicity, via the characteristic polynomial and the root finder; eigenvalues the root finder cannot close remain as exact first-class polynomial_root values.

Raw WebAssembly: Matrix method

eigenvalues(): Expression[]

Eigenvalues with multiplicity, via the characteristic polynomial and the root finder; eigenvalues the root finder cannot close remain as exact first-class polynomial_root values.

eigenvectors#

For each eigenvalue, a basis of its eigenspace as column matrices. Notes: WASM returns Eigenpair objects with eigenvalue/vectors getters.

Raw WebAssembly: Matrix method

eigenvectors(): Eigenpair[]

For each eigenvalue, a basis of its eigenspace as column matrices. Notes: WASM returns eigenpair objects with eigenvalue/vectors getters.

eigenpair (WASM result class)#

eigenvalue#

Raw WebAssembly: Eigenpair property

readonly eigenvalue: Expression

vectors#

Raw WebAssembly: Eigenpair property

readonly vectors: Matrix[]

A basis of the eigenspace, as column matrices.

inverse#

Inverse via the adjugate; raises on singular input.

Raw WebAssembly: Matrix method

inverse(): Matrix

Inverse via the adjugate; raises on singular input.

rank#

Raw WebAssembly: Matrix method

rank(): number

Rank via Bareiss fraction-free elimination.

row_reduce#

Not exposed by the WASM / JavaScript bindings. Available as Matrix.row_reduce in Python, UniffiMatrix.rowReduce in Kotlin, UniffiMatrix.rowReduce in Swift, api::Matrix::row_reduce in Rust.

Bareiss row-reduced form (fraction-free; pivots remain on the diagonal).

nullspace_basis#

Not exposed by the WASM / JavaScript bindings. Available as Matrix.nullspace_basis in Python, UniffiMatrix.nullspaceBasis in Kotlin, UniffiMatrix.nullspaceBasis in Swift, api::matrix_operations::Matrix::nullspace_basis in Rust.

A basis of the kernel, as column matrices; empty list for full column rank.

adjugate#

The classical adjoint (transpose of the cofactor matrix); satisfies Madj⁡(M)=det⁡(M)IM\operatorname{adj}(M) = \det(M) I.

Raw WebAssembly: Matrix method

adjugate(): Matrix

The classical adjoint (transpose of the cofactor Matrix); satisfies Madj⁡(M)=det⁡(M)IM\operatorname{adj}(M) = \det(M) I.

cofactor_matrix#

Not exposed by the WASM / JavaScript bindings. Available as Matrix.cofactor_matrix in Python, UniffiMatrix.cofactorMatrix in Kotlin, UniffiMatrix.cofactorMatrix in Swift, api::Matrix::cofactor_matrix in Rust.

lower_upper_decomposition#

Not exposed by the WASM / JavaScript bindings. Available as Matrix.lower_upper_decomposition in Python, UniffiMatrix.lowerUpperDecomposition in Kotlin, UniffiMatrix.lowerUpperDecomposition in Swift, api::matrix_operations::Matrix::lower_upper_decomposition in Rust.

Partial-pivoting LU decomposition returned as (permutation, lower, upper) with permutation⁡M=lower⁡ upper⁡\operatorname{permutation} M = \operatorname{lower}\,\operatorname{upper}. The permutation matrix is reconstructed from the pivoting row-swap record. Notes: WASM returns a 3-element array [permutation, lower, upper].

Example#

Exact matrix arithmetic and spectral data.

JavaScript
const matrix = symi.matrix([[1, 2], [3, 4]]);

console.log(matrix.determinant().toString());
console.log(matrix.trace().toString());
console.log(matrix.multiply(matrix).toString());

Additional API#

IntegerCokernelData#

IntegerCokernelData.freeRank#

Raw WebAssembly: IntegerCokernelData property

readonly freeRank: number

Rank of the free part of the cokernel.

IntegerCokernelData.torsionInvariantFactors#

Raw WebAssembly: IntegerCokernelData property

readonly torsionInvariantFactors: Expression[]

The invariant factors of the torsion part of the cokernel.

Matrix#

Type

interface Matrix

Construct a matrix of the given shape from entries in row-major order.

Calling forms

Raw WebAssembly: Matrix constructor: Matrix

new Matrix(rows: number, columns: number, entries: Expression[])

Matrix.cofactorMatrix#

Raw WebAssembly: Matrix method

cofactorMatrix(): Matrix

The matrix of cofactors, whose transpose is the adjugate.

Matrix.execute#

Matrix method

execute(): Matrix

Re-dispatch every unevaluated node (integral, derivative, summation, transform, ODE/recurrence placeholder) in the expression; useful after substitution has changed the inputs.

Calling forms

Raw WebAssembly: Matrix method: Matrix.execute

execute(): Matrix

Matrix.free#

Matrix method

free(): void

Public method placement for free.

Matrix.hasComplexEntries#

Matrix method

hasComplexEntries(): boolean | null

Query whether every entry is finite complex.

Calling forms

Raw WebAssembly: Matrix method: Matrix.hasComplexEntries

hasComplexEntries(): boolean | undefined

Matrix.hasIntegerEntries#

Matrix method

hasIntegerEntries(): boolean | null

Query whether every entry is an integer.

Calling forms

Raw WebAssembly: Matrix method: Matrix.hasIntegerEntries

hasIntegerEntries(): boolean | undefined

Matrix.hasRealEntries#

Matrix method

hasRealEntries(): boolean | null

Query whether every entry is real.

Calling forms

Raw WebAssembly: Matrix method: Matrix.hasRealEntries

hasRealEntries(): boolean | undefined

Matrix.isDiagonalMatrix#

Matrix method

isDiagonalMatrix(): boolean | null

Query whether this matrix is diagonal.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isDiagonalMatrix

isDiagonalMatrix(): boolean | undefined

Matrix.isEquality#

Raw WebAssembly: Matrix method

isEquality(): boolean

Always false: a matrix is never an equal relation node.

Matrix.isFiniteSet#

Raw WebAssembly: Matrix method

isFiniteSet(): boolean

Always false: a matrix is never a finite set.

Matrix.isFullRankMatrix#

Matrix method

isFullRankMatrix(): boolean | null

Query whether this matrix has full rank.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isFullRankMatrix

isFullRankMatrix(): boolean | undefined

Matrix.isHermitianMatrix#

Matrix method

isHermitianMatrix(): boolean | null

Query whether this matrix is Hermitian.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isHermitianMatrix

isHermitianMatrix(): boolean | undefined

Matrix.isIdentityMatrix#

Matrix method

isIdentityMatrix(): boolean | null

Query whether this matrix is the identity matrix.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isIdentityMatrix

isIdentityMatrix(): boolean | undefined

Matrix.isImageSet#

Raw WebAssembly: Matrix method

isImageSet(): boolean

Always false: a matrix is never an image set.

Matrix.isIntegral#

Raw WebAssembly: Matrix method

isIntegral(): boolean

Always false: a matrix is never an unevaluated integral node.

Matrix.isInvertibleMatrix#

Matrix method

isInvertibleMatrix(): boolean | null

Query whether this matrix is invertible.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isInvertibleMatrix

isInvertibleMatrix(): boolean | undefined

Matrix.isMatrix#

Raw WebAssembly: Matrix property

readonly isMatrix: boolean

Always False on expressions and True on matrix objects, so mixed result streams can be discriminated.

Matrix.isNormalMatrix#

Matrix method

isNormalMatrix(): boolean | null

Query whether this matrix is normal.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isNormalMatrix

isNormalMatrix(): boolean | undefined

Matrix.isOrthogonalMatrix#

Matrix method

isOrthogonalMatrix(): boolean | null

Query whether this matrix is orthogonal.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isOrthogonalMatrix

isOrthogonalMatrix(): boolean | undefined

Matrix.isPositive#

Raw WebAssembly: Matrix method

isPositive(): boolean | undefined

Always None: positivity is a property of the entries, not of the matrix.

Matrix.isPositiveDefiniteMatrix#

Matrix method

isPositiveDefiniteMatrix(): boolean | null

Query whether this matrix is positive definite.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isPositiveDefiniteMatrix

isPositiveDefiniteMatrix(): boolean | undefined

Matrix.isPositiveSemidefiniteMatrix#

Matrix method

isPositiveSemidefiniteMatrix(): boolean | null

Query whether this matrix is positive semidefinite.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isPositiveSemidefiniteMatrix

isPositiveSemidefiniteMatrix(): boolean | undefined

Matrix.isReal#

Raw WebAssembly: Matrix method

isReal(): boolean | undefined

Always None: realness is a property of the entries, not of the matrix.

Matrix.isSingularMatrix#

Matrix method

isSingularMatrix(): boolean | null

Query whether this matrix is singular.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isSingularMatrix

isSingularMatrix(): boolean | undefined

Matrix.isSquare#

Matrix method

isSquare(): boolean | null

Query whether this matrix is square.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isSquare

isSquare(): boolean | undefined

Matrix.isSymmetricMatrix#

Matrix method

isSymmetricMatrix(): boolean | null

Query whether this matrix is symmetric.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isSymmetricMatrix

isSymmetricMatrix(): boolean | undefined

Matrix.isUnion#

Raw WebAssembly: Matrix method

isUnion(): boolean

Always false: a matrix is never a union of sets.

Matrix.isUnitaryMatrix#

Matrix method

isUnitaryMatrix(): boolean | null

Query whether this matrix is unitary.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isUnitaryMatrix

isUnitaryMatrix(): boolean | undefined

Matrix.isZeroMatrix#

Matrix method

isZeroMatrix(): boolean | null

Query whether this matrix is the zero matrix.

Calling forms

Raw WebAssembly: Matrix method: Matrix.isZeroMatrix

isZeroMatrix(): boolean | undefined

Matrix.lowerUpperDecomposition#

Raw WebAssembly: Matrix method

lowerUpperDecomposition(): Matrix[]

Partial-pivoting LU decomposition returned as (permutation, lower, upper) with permutation⁡M=lower⁡ upper⁡\operatorname{permutation} M = \operatorname{lower}\,\operatorname{upper}.

Matrix.nullspaceBasis#

Raw WebAssembly: Matrix method

nullspaceBasis(): Matrix[]

A basis of the kernel, as column matrices; empty list for full column rank.

Matrix.rowReduce#

Raw WebAssembly: Matrix method

rowReduce(): Matrix

Bareiss row-reduced form (fraction-free; pivots remain on the diagonal).

Matrix.scalarMultiply#

Raw WebAssembly: Matrix method

scalarMultiply(scalar: Expression): Matrix

Scale every entry by scalar.

Matrix.summary#

Raw WebAssembly: Matrix method

summary(): string

A one-line summary listing the entries row by row, Matrix([[a, b], [c, d]]). A matrix with more than eight rows or columns lists its leading eight of each, marks every elided run with ..., and states its full shape first.

Matrix.toString#

Matrix method

toString(): string

The entries row by row, as Matrix([[a, b], [c, d]]), eliding beyond eight rows or columns: the matrix's one-line summary as a JavaScript string.

Calling forms

Raw WebAssembly: Matrix method: Matrix.toString

toString(): string

Symi documentation · WASM / JavaScript