JavaScript / TypeScript API

nerdamer/structures

Matrices, vectors, sets, collections, dictionaries, and related operations.

Import from nerdamer/structures. For the functions you write inside nerdamer('...'), see the function reference.
18 exports

Functions

append(x: ParserEntity, value: ParserEntity): ParserEntityFunction

Returns a new vector with value added as its last element. The vector itself isn't changed. A symbolic first argument keeps the call, so it can be evaluated once the vector is known.

cross(a: Vector, b: Vector): VectorFunction

Computes the cross product of two vectors in 0, 1, 3, or 7 dimensions. The three-dimensional result is the familiar cross product; the seven-dimensional result follows the fixed octonion convention documented on Vector.cross. The 7D multiplication table is not uniquely determined by dimension alone. Zero- and one-dimensional results are zero vectors. Other dimensions are unsupported. Two symbolic Expressions are instead left as an unevaluated cross(a, b) call, because their dimensions are not known.

determinant(M: Matrix): ExpressionFunction

Computes the determinant without mutating the supplied Matrix.

difference(a: ParserEntity, b: ParserEntity): ParserEntityFunction

Returns the set of values in the first set but not in the second.

dot(a: ParserEntity, b: ParserEntity): ExpressionFunction

Computes the dot product of two Vectors or preserves two symbolic operands.

imatrix(x: Expression): Expression | MatrixFunction

Creates an identity matrix of integer size.

intersection(...sets: ParserEntity[]): ParserEntityFunction

Returns the set of values in every one of the given sets.

intersects(a: ParserEntity, b: ParserEntity): ParserEntityFunction

Returns 1 when the two sets have a value in common and 0 when they don't.

invert(M: Matrix): MatrixFunction

Returns the inverse without modifying the supplied Matrix.

isSubset(a: ParserEntity, b: ParserEntity): ParserEntityFunction

Returns 1 when every value of the first set is in the second and 0 otherwise.

nullspace(M: Matrix, prime?: string | number | Expression): VectorFunction

Returns the nullspace basis as a Vector of basis vectors.

union(...sets: ParserEntity[]): ParserEntityFunction

Returns the set of values in any of the given sets.

Classes

Type