CoCoA:LinSol
LinSol
find a solution to a linear system
Description
This function finds a solution to the inhomogeneous system of
equations represented by M and L.
Specifically, it returns a list, X, of length n with entries in Z or Q, such that M*Transposed(Mat(X)) = Transposed(Mat([L])), if such X exists; otherwise, it returns the empty list. Once a solution is found, all solutions may be found using the function <ttref>LinKer</ttref>.
NOTE: <ttref>LinSol</ttref> can solve several inhomogeneous systems at once. If L
has the form <formula>[L_1,...,L_k]</formula> where each <formula>L_i</formula> is a list of length m with
entries in Z or Q, then LinSol(M,L) returns a list <formula>[X_1,...,X_k]</formula> where <formula>X_i</formula> is a solution to the system of linear equations represented by M and <formula>L_i</formula>.
Example
M := Mat([[3,1,4],[1,5,9],[2,6,5]]); L := [123,456,789]; LinSol(M,L); [199/5, 742/5, -181/5] ------------------------------- M*Transposed(Mat([It])); Mat([ [123], [456], [789] ]) ------------------------------- LinSol(M,[L,[1,2,3]]); [[199/5, 742/5, -181/5], [4/15, 7/15, -1/15]] -------------------------------
Syntax
LinSol(M:MAT,L:LIST):LIST where M is an m x n matrix over Z or Q, and L is a list of length m with entries in Z or Q (or a list of such lists).
<type>matrix</type>