A rectangular two-dimensional matrix of scalar Expression elements.

remarks

Construction validates that all nonempty rows have the same length and converts every entry to an Expression; nested parser aggregates are not matrix elements. Existing Expression entries are retained, so use copy when independent element objects are required. copy, evaluate, and expand return deep independent matrices. Addition, subtraction, and division remain element-wise. times implements scalar scaling, matrix multiplication, and matrix-vector multiplication, while pow implements integer matrix powers. Scalar and matrix products return new Matrices; a matrix-vector product returns a new Vector. each, set, and parser assignment mutate this matrix. each may also be used for observation by returning nothing; use forEach when no transformation is intended. Direct get/set indices are zero-based. The compatibility accessor e and the row/col helpers are one-based. Matrix comparisons are component-wise predicates, not a total or lexicographic ordering; a type or dimension mismatch compares false.

Members

__get__(indices: number[]): ParserEntityMethod

Returns a row at the given zero-based index as a Vector. Used by the parser for bracket indexing, e.g. matrix[0] returns the first row. This enables chained indexing: matrix[0][1] returns the element at row 0, col 1.

throws

core!MathError If either index is out of bounds.

Parameters

NameTypeDescription
indicesnumber[]Zero-based indices (after INDEX_BASE adjustment). Single index [i] returns row i as a Vector. Two indices [i, j] returns the element at row i, col j.

Returns

ParserEntity — A copied row Vector for one index, or the stored Expression for two.

__set__(indices: string | number[], value: ParserEntity): voidMethod

Sets a zero-based cell or replaces an entire row. [i, j] sets the element at row i, col j. [i] requires a Vector whose length matches the matrix column count.

throws

core!UnexpectedDataType If a full-row assignment does not receive a Vector.

throws

core!MathError If an index is out of bounds or a replacement row has the wrong length.

Parameters

NameTypeDescription
indicesstring | number[]Zero-based indices
valueParserEntityThe value to set

Returns

void

abs(): MatrixMethod

No description is available yet.

Returns

Matrix

augment(matrix: Matrix): MatrixMethod

Returns the horizontal augmentation [this | matrix] without mutating either input.

throws

core!MathError If the row counts differ.

Parameters

NameTypeDescription
matrixMatrix—

Returns

Matrix

buildFunction(argsArray?: string[]): (...args: number[]): numberMethod

Compiles this value to a native JavaScript-number function when the parsed result is an Expression. Structured parser results expose this method so values returned by nerdamer(...) have one consistent TypeScript surface, but they cannot be compiled as scalar functions and throw core!UnexpectedDataType when called.

Parameters

NameTypeDescription
argsArraystring[]Optional variable names in positional call order.

Returns

(...args: number[]): number — A JavaScript-number function compiled from the scalar expression.

canMultiplyFromLeft(M: Matrix): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
MMatrix—

Returns

boolean

col(n: number): MatrixMethod

No description is available yet.

Parameters

NameTypeDescription
nnumber—

Returns

Matrix

cols(): numberMethod

No description is available yet.

Returns

number

Matrix(...elements: Vector | NerdamerInput[][]): MatrixConstructor

Creates a matrix from array or Vector rows.

throws

core!MathError If nonempty rows have different lengths.

throws

core!UnexpectedDataType If an entry cannot be converted to an Expression.

Parameters

NameTypeDescription
elementsVector | NerdamerInput[][]Rows containing values convertible to scalar Expressions.

Returns

Matrix

copy(): MatrixMethod

Copies the matrix and every Expression element.

Returns

Matrix

dataType: "MAT"Property

No description is available yet.

determinant(): ExpressionMethod

Computes the determinant by triangular elimination. The determinant of the empty matrix is one.

throws

core!UnsupportedOperationError If the matrix is not square.

Returns

Expression

dimensions(): number[]Method

No description is available yet.

Returns

number[]

div(x: NerdamerInput): MatrixMethod

Divides corresponding entries, or broadcasts a scalar divisor.

throws

core!DimensionError If a Matrix divisor has different dimensions.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Matrix

e(i: number, j: number): ExpressionMethod

Returns a one-based matrix element for compatibility with the legacy accessor.

throws

core!MathError If either index is out of bounds.

Parameters

NameTypeDescription
inumber—
jnumber—

Returns

Expression

each(fn: (e: Expression, i?: string | number, j?: string | number): void | Expression): MatrixMethod

Visits or replaces every element in row-major order. Returning void leaves the current cell unchanged. Callback row and column indices are zero-based.

Parameters

NameTypeDescription
fn(e: Expression, i?: string | number, j?: string | number): void | Expression—

Returns

Matrix

elements: Expression[][]Property

No description is available yet.

eq(M: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
MParserEntity—

Returns

boolean

expand(): MatrixMethod

Expands a copied matrix, leaving this one unchanged.

Returns

Matrix

factor(): MatrixMethod

No description is available yet.

Returns

Matrix

fill(rows: number, cols: number, value: Expression): MatrixMethod

Creates a matrix whose cells are independent copies of value.

Parameters

NameTypeDescription
rowsnumber—
colsnumber—
valueExpression—

Returns

Matrix

forEach(callback: (value: Expression, row: number, col: number): void): voidMethod

Visits every cell without changing the matrix.

Parameters

NameTypeDescription
callback(value: Expression, row: number, col: number): void—

Returns

void

get(row: number, col: number): ExpressionMethod

Returns the stored Expression at a zero-based row and column.

throws

core!MathError If either index is out of bounds.

Parameters

NameTypeDescription
rownumber—
colnumber—

Returns

Expression

gt(M: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
MParserEntity—

Returns

boolean

gte(M: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
MParserEntity—

Returns

boolean

identity(n: number): MatrixMethod

Creates the n by n identity matrix.

Parameters

NameTypeDescription
nnumber—

Returns

Matrix

inspect(): stringMethod

No description is available yet.

Returns

string

inverse(): MatrixMethod

Computes an inverse by augmenting with the identity and eliminating rows.

throws

core!UnsupportedOperationError If the matrix is not square.

throws

core!MathError If the matrix is singular.

Returns

Matrix — A new inverse matrix; this matrix is unchanged.

isEnumerable: booleanProperty

No description is available yet.

isMatrix(obj: unknown): objMethod

No description is available yet.

Parameters

NameTypeDescription
objunknown—

Returns

obj

isSingular(): booleanMethod

No description is available yet.

Returns

boolean

isSquare(): booleanMethod

No description is available yet.

Returns

boolean

lt(M: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
MParserEntity—

Returns

boolean

lte(M: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
MParserEntity—

Returns

boolean

map(callback: (a: Expression, row?: string | number, col?: string | number): Expression): MatrixMethod

Returns a new matrix populated by callback results without mutating this matrix.

Parameters

NameTypeDescription
callback(a: Expression, row?: string | number, col?: string | number): Expression—

Returns

Matrix

minus(x: NerdamerInput): MatrixMethod

Subtracts corresponding entries, or broadcasts a scalar subtrahend.

throws

core!DimensionError If a Matrix operand has different dimensions.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Matrix

multiply(x: Expression): MatrixMethod

Delegates the public multiplication alias to the Matrix-specific times() method.

Parameters

NameTypeDescription
xExpression—

Returns

Matrix

nullspace(prime?: string | number | Expression): Expression[][]Method

Computes a basis for the nullspace using the same reduced row-echelon form as rref.

remarks

Without prime, the basis is computed with exact symbolic Expression arithmetic. When prime is supplied, the existing modular arithmetic path is preserved and basis entries are reduced modulo that value. Each free column contributes one basis vector, ordered by increasing free-column index. A full-column-rank matrix therefore returns an empty basis.

Parameters

NameTypeDescription
primestring | number | ExpressionOptional modulus for finite-field nullspace arithmetic.

Returns

Expression[][] — Basis vectors as independent Expression arrays ordered by matrix column.

plus(x: NerdamerInput): MatrixMethod

Adds corresponding entries, or broadcasts a scalar addend.

throws

core!DimensionError If a Matrix operand has different dimensions.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Matrix

pow(x: NerdamerInput): MatrixMethod

Raises this matrix to an integer power without mutating it. Positive powers use matrix multiplication, zero returns the identity, and negative powers use the matrix inverse. A rectangular matrix is accepted only for the identity power 1; all other matrix powers require a square matrix.

throws

core!UnsupportedOperationError If the exponent is not an integer, or if a nontrivial power is requested for a rectangular matrix.

throws

core!MathError If a negative power requires the inverse of a singular matrix.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Matrix

precision: numberProperty

No description is available yet.

rank(): numberMethod

No description is available yet.

Returns

number

row(n: number): MatrixMethod

No description is available yet.

Parameters

NameTypeDescription
nnumber—

Returns

Matrix

rows(): numberMethod

No description is available yet.

Returns

number

rref(prime?: string | number | Expression): MatrixMethod

Returns reduced row-echelon form without mutating this matrix. When prime is supplied, pivot arithmetic is performed modulo that value. Otherwise pivots and zero rows are determined by exact Expression equality.

Parameters

NameTypeDescription
primestring | number | Expression—

Returns

Matrix

set(row: number, col: number, value: ParserEntity): thisMethod

Sets a zero-based cell after converting value to an Expression.

Parameters

NameTypeDescription
rownumber—
colnumber—
valueParserEntity—

Returns

this

simplify(): MatrixMethod

No description is available yet.

Returns

Matrix

text(): stringMethod

No description is available yet.

Returns

string

times(M: Expression): MatrixMethod

Returns scalar multiplication, the matrix product this * M, or the matrix-vector product this * v.

throws

core!MathError If matrix or vector dimensions are incompatible.

throws

core!UnsupportedOperationError If the operand is not a supported scalar, Matrix, or Vector.

Parameters

NameTypeDescription
MExpression—

Returns

Matrix

toRightTriangular(): MatrixMethod

Returns a row-echelon copy produced by forward elimination and row swaps.

Returns

Matrix

toString(): stringMethod

No description is available yet.

Returns

string

toUpperTriangular(): MatrixMethod

No description is available yet.

Returns

Matrix

trace(): ExpressionMethod

Returns the sum of the main diagonal. The empty matrix has trace zero.

throws

core!MathError If the matrix is not square.

Returns

Expression

transpose(): MatrixMethod

Returns a transposed matrix. Existing elements are normalized by the constructor.

Returns

Matrix

unroll(): VectorMethod

Returns elements as a column-major Vector.

Returns

Vector

zeroMatrix(rows: number, cols: number): MatrixMethod

Creates a matrix filled with symbolic zeros.

Parameters

NameTypeDescription
rowsnumber—
colsnumber—

Returns

Matrix