Using the individual functions we can build a calculator that calculates the determinant of a matrix, the adjugate and the inverse of a matrix.
The calculator primitive contains the two scripts indexed below:
The calculator expects a notecard containing a square matrix of any dimension to be dropped into the main primitive. After that, you can touch the primitive and it will start computing the determinant, adjugate and inverse of the matrix.
The script below computes the inverse of a flattened matrix in a list. The list is a row-by-row flattening of a matrix :
such that we obtain the list m
:
list m = [ e₀, e₁, e₂, ... ];
The method executes three steps in succession based on the Laplace method of calculating matrices:
The final stage assumes that since if , then the matrix does not have an inverse.