up previous next
LinAlg.Solve

Solves a system of linear equations.
Syntax
          
LinAlg.Solve(M:MAT, B:MAT, BACKEND:STRING):MAT
LinAlg.Solve(M:MAT, B:MAT, BACKEND:STRING, METHOD:STRING):MAT

          

Description
Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use it/them.

Let M and B be matrices defined over the ring of integers, a finite field or the field of rationals. This function tries to solve the linear equation system M*X = B by using the ApCoCoAServer supported by the IML or LinBox library (depending on the value of parameter BACKEND). Possible values for BACKEND are IML and LINBOX. If BACKEND is set to LINBOX, a fourth optional parameter METHOD may be specified. Please refer to LinBox.Solve for further details about this parameter.

The return value will be a solution vector of the linear equation system or an empty matrix if no solution has been found. The following parameter is optional.

Example
Use ZZ/(19)[x];
M := BringIn(Mat([[1,3,4], [0,2,1]]));
B := BringIn(Mat([[1], [2]]));
LinAlg.Solve(M, B, "IML");

-------------------------------
Mat([
  [-2 % 19],
  [1 % 19],
  [0 % 19]
])
-------------------------------


Example
Use QQ[x];
M := Mat([ [1,3,4], [0,2,1], [1,3,4] ]);
B := Mat([ [1], [2], [0] ]);
LinAlg.Solve(M, B, "IML");

-------------------------------
Mat([
  [ ]
])
-------------------------------


See Also