Shortnote

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 $A$:

$$
A = 
\begin{pmatrix} 
e_{0} & e_{1} & e_{2} & e_{...} & e_{j} \\
e_{j+1} & e_{j+2} & e_{j+3} & e_{...} & e_{j+k} \\ 
e_{...} & e_{...} & e_{...} & e_{...} & e_{...} \\
\end{pmatrix}
$$

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:

  1. Calculates $det(A)$.
  2. Calculates the adjugate of $A$ as $adj(A)$.
  3. Finally calculates $A^{-1}=\frac{adj(A)}{det(A)}$.

The final stage assumes that $det(A)\ne0$ since if $det(A)=0$, then the matrix does not have an inverse.

Index