Skip to content
Calculus_is_fun edited this page Aug 28, 2024 · 18 revisions

Matrix

Constructor

Columns

the number of columns this matrix will have.

indices

The values in the matrix in reading order of LTR. can be Numbers, BigInts, or Rationals. They all get converted to Rationals.

let A = new Matrix(2, [1, 2, 3, 4]);

If indices is the string "identity", creates an identity matrix of given size.

Methods

add

adds argument to this element-wise

let A = new Matrix(2, [1n, 3n, 4n, new Rational(5n, 2n)]);
let B = new Matrix(2, [new Rational(1n, 2n), 1n, 4n, -1n]);
A.add(B);

A=

addRow

toLatex

let A = new Matrix(2, [1, 2, new Rational(2n,3n), 10]);
console.log(A.toLatex()); // "\begin{bmatrix}1&2\\\frac{2}{3}&10\end{bmatrix}"

Clone this wiki locally