A matrix is represented in atlas using the data type mat. As with
vectors, we define a matrix using : as illustrated below, and listing the entries as sets of n-tuples
in order by columns. Note, as for vectors, the : distinguishes the matrix
from an array of integers. For example:
Multiplication by a vector on the left, (resp. on the right) of A,
automatically converts the product into the product of A by column
(resp. row) vector. The transpose of A is obtained using
^A:
atlas has two commands related to the inverse: The first one, invert(A) gives
a pair (B,d) Where B is an integral multiple, d of the inverse of
A. If A is invertible over the integers then B is the
inverse of A and d=1:
The second command inverse(A) is not in the initial software
commands. It is defined in the supplementary file basic.at. This
command calculates the inverse of a matrix over the integers.
Recall that to tell atlas where to find the .at files, you need to launch your software using the command ./atlas--path=atlas-scripts. If you have not done this yet, you can quit the software and launch it again with this command.
You can then input the file basic.at and continue.
Now we can see if we can calculate the inverse of these matrices over the integers
Now lets use a new matrix and try to solve a linear equation. We use
the function solve, that has as input, a matrix and a vector; and as output,
and array of vectors:
Recall that we use $ to refer to the previous value. The type of
the output is not a vec, but rather an array of vecs. In this
case, only one vec.
Note that the general solution of this matrix equation is a one
dimensional vector space. atlas just chooses a single integer
solution of the equation. To find all the solutions you need to find the kernel.
If we try to solve an equation with no solutions we would get the empty array:
atlas>solve(A,[0,0,1])Value:[]atlas>
Now we can check our answer. We can do that by identifying the 0th
entry of our array as the vector solution of the linear equation. We
call this vector v:
Now let’s calculate the kernel of our singular matrix. We use the function kernel with input a matrix and output another matrix whose columns are a basis of the kernel:
atlas>kernel(A)Value:|2||1||-2|
Note this is a matrix. We can multiply it by A and get 0. However, atlas will not think of it as a vector solution to the matrix equation. In fact, if we call this matrix w, look what happens when we try to multiply v+w by A: