

The size of a matrix can be calculated with the function size. add ( c, 2 ) // Array,, ] // calculate the determinant of a matrix math. multiply ( c, d ) // Matrix,, ] // add a number to a matrix math. factorial ( b ) // Array, // multiply an array with a matrix const c =, ] // Array const d = math. sqrt ( a ) // Matrix, // perform a calculation on an array const b = math.

perform a calculation on a matrix const a = math. Note that in case of numbers as arguments, the output isĭetermined by the option matrix as discussed in section When the input is a Matrix, the output willīe a Matrix. Or matrix containing the dimensions for the matrix. The functions ones, zeros, and identity also accept a single array identity ( 3 ) // Matrix, size, ,, ] math. ones ( 2, 2 ), 5 ) // Matrix, size, , ] // identity creates an identity matrix math. zeros ( 2, 2, 2 ) // Matrix, size, //, ],, ]] // ones creates a matrix filled with ones math. zeros ( 3, 2 ) // Matrix, size, ,, ] math. zeros creates a matrix filled with zeros math. Which can be a string 'Matrix' (default) or 'Array'. Input, the output is determined by the configuration option matrix, In case of mixed input, a Matrix is returned.įor functions where the type of output cannot be determined from the In most cases, the type of matrix output from functions is determined by theįunction input: An Array as input will return an Array, a Matrix as input Matrix manipulation such as subset, size, resize, clone, and more. A Matrix is an object wrappedĪround a regular JavaScript Array, providing utility functions for easy

Interchangeably in all relevant math.js functions. Both regular JavaScriptĪrrays as well as the matrix type implemented by math.js can be used Matrices can beĬreated, manipulated, and used in calculations. You may also find it useful to be able to row reduce a matrix using your calculator or even multiply supports multi dimensional matrices and arrays. The following video will walk you through the steps above. Oh yeah – so what happens if your matrix is singular (or NOT invertible)? In other words, what happens if your matrix doesn’t have an inverse?Īs you can see above, your calculator will TELL YOU. Even with the optional step, it takes me less than 3 minutes to go through. It’s useful too – being able to enter matrices into the calculator lets you add them, multiple them, etc! Nice! If you want to see it all in action, take a look at the video to the right where I go through the steps with a different example. That’s it! It sounds like a lot but it is actually simple to get used to. Then, as before, you can click the right arrow key to see the whole thing. While the inverse is on the screen, if you press, 1: Frac, and then ENTER, you will convert everything in the matrix to fractions. Step 5: (OPTIONAL) Convert Everything to Fractions The next step can help us along if we need it. As you can see, our inverse here is really messy. Since we want to find an inverse, that is the button we will use.Īt this stage, you can press the right arrow key to see the entire matrix. The easiest step yet! All you need to do now, is tell the calculator what to do with matrix A. Here is the matrix we will use for our example: We will talk about what happens when it isn’t invertible a little later on. The matrix picked below is invertible, meaning it does in fact have an inverse. Remember, not every matrix has an inverse.
