-
Notifications
You must be signed in to change notification settings - Fork 0
Matrix
Calculus_is_fun edited this page Aug 28, 2024
·
18 revisions
the number of columns this matrix will have.
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.
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=
adds a scaled copy of one row to another
- source (BigInt): the row to add
- destination (BigInt): the row added to
- scale (BigInt/Rational): a row multiplier before adding (defaults to 1)
let A = new Matrix(3, [1n, 2n, 3n, 2n, 5n, 1n, 2n, 3n, 0n]);
A.addRow(0n, 1n, -2n);
A.addRow(0n, 2n, new Rational(1n, 3n));
A=
appends the colums of argument to the right of this
let A = new Matrix(2, [1n, 2n, 4n, 5n, 7n, 8n]);
let B = new Matrix(1, [3n, 6n, 9n]);
A.augment(B);
A=
the standard matrix product
let A = new Matrix(2, [1n, 1n, 0n, 1n]);
let B = new Matrix(1, [3n, 6n]);
A.product(B);
A=
returns the LaTeX code corresponding to this
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}"
flips the entries of this