[back] [prev] [next] [index] [root]

 


MatSolve

Solves a linear equation.

Syntax:

L := MatSolve (A, b);
L := MatSolve(A, b, N);

list
  L  
matrix
  A  
matrix
  b  
integer
  N  
a module

Description:

Given matrix A and vector b, the MatSolve function finds the vector x which satisfies the matrix equation A cdot x = b. The MatSolve function returns a list whose first entry is x. The second of L is the null space of A. \smallskip If Acdot x = b has no solution, then FALSE is returned. If the module N is given, solutions modulo N are returned.


Example:


kash> M := Mat(Z,[[1,0],[0,1]]);
[1 0]
[0 1]
kash> b := Mat(Z,[[1],[2]]);
[1]
[2]
kash> MatSolve(M, b);
[ [1]
    [2], Matrix with 2 rows and 0 columns ]
kash> M := Mat(Z,[[1,0,1],[0,1,1]]);
[1 0 1]
[0 1 1]
kash> MatSolve(M, b);
> [ [1]
    [2]
    [0], [ 1]
    [ 1]
    [-1] ]


<- back[back] [prev] [next] [index] [root]