up previous next
LinSolve

find a solution to a linear system

Syntax
LinSolve(M: MAT, RHS: MAT): MAT

Description
This function finds a solution X to the matrix equation M*X = RHS . If more than one solution exists, it returns just one of them. If no solution exists then it produces a 0-by-0 matrix. To find all solutions, compute the kernel of M using the function LinKerBasis .

NOTE: an easy way of converting a list into a column matrix (for the second argument) is to use the function ColMat .

Example
/**/  M := mat([[3,1,4],[1,5,9],[2,6,5]]);
/**/  L := [123,456,789];
/**/  LinSolve(M, ColMat(L));
mat([
  [199/5],
  [742/5],
  [-181/5]
])

/**/  M*It;
mat([
  [123],
  [456],
  [789]
])
-------------------------------

See Also