Go to the first, previous, next, last section, table of contents.

### `det`,`invmat`

`det(mat[,mod])`
  :: Determinant of mat.
`invmat(mat)`
  :: Inverse matrix of mat.

return
  `det`: expression, `invmat`: list
mat
  matrix
mod
  prime

- `det` computes the determinant of matrix mat. `invmat` computes the inverse matrix of matrix mat. `invmat` returns a list `[num,den]`, where `num` is a matrix and `num/den` represents the inverse matrix.
- The computation is done over GF(mod) if mod is specitied.
- The fraction free Gaussian algorithm is employed. For matrices with multi-variate polynomial entries, minor expansion algorithm sometimes is more efficient than the fraction free Gaussian algorithm.

    [91] A=newmat(5,5)$
    [92] V=[x,y,z,u,v];
    [x,y,z,u,v]
    [93] for(I=0;I<5;I++)for(J=0,B=A[I],W=V[I];J<5;J++)B[J]=W^J;
    [94] A;
    [ 1 x x^2 x^3 x^4 ]
    [ 1 y y^2 y^3 y^4 ]
    [ 1 z z^2 z^3 z^4 ]
    [ 1 u u^2 u^3 u^4 ]
    [ 1 v v^2 v^3 v^4 ]
    [95] fctr(det(A));
    [[1,1],[u-v,1],[-z+v,1],[-z+u,1],[-y+u,1],[y-v,1],[-y+z,1],[-x+u,1],[-x+z,1],
    [-x+v,1],[-x+y,1]]
    [96] A = newmat(3,3)$
    [97] for(I=0;I<3;I++)for(J=0,B=A[I],W=V[I];J<3;J++)B[J]=W^J;
    [98] A;
    [ 1 x x^2 ]
    [ 1 y y^2 ]
    [ 1 z z^2 ]
    [99] invmat(A);
    [[ -z*y^2+z^2*y z*x^2-z^2*x -y*x^2+y^2*x ]
    [ y^2-z^2 -x^2+z^2 x^2-y^2 ]
    [ -y+z x-z -x+y ],(-y+z)*x^2+(y^2-z^2)*x-z*y^2+z^2*y]
    [100] A*B[0];
    [ (-y+z)*x^2+(y^2-z^2)*x-z*y^2+z^2*y 0 0 ]
    [ 0 (-y+z)*x^2+(y^2-z^2)*x-z*y^2+z^2*y 0 ]
    [ 0 0 (-y+z)*x^2+(y^2-z^2)*x-z*y^2+z^2*y ]
    [101] map(red,A*B[0]/B[1]);
    [ 1 0 0 ]
    [ 0 1 0 ]
    [ 0 0 1 ]

`References`
  section `newmat`.

Go to the first, previous, next, last section, table of contents.