next up previous contents
Next: Inversion Up: Gauß -Jordan row reduction. Previous: Gauß -Jordan row reduction.

   
Solving a linear system.

Suppose you want to find (x,y) s.t.:

\begin{displaymath}\left\{ \begin{array}{ccccc}
mx &+&y &=&-2 \\
mx &+ &(m-1)y&=&2
\end{array}\right.\end{displaymath}

where m is a parameter. SYST instruction. Type a list containing the linear equations and as last element put the list of unknowns. Here:
{ 'M*X+Y=-2' 'M*X+(M-1)*Y=2' { X Y } }
Then call SYST or SOLGEN. For SYST, you get the solution at level 1, the list of particular cases at level 2 and the original system at level 3. For SOLGEN you get the same results but at level 2, 3 and 4 and the paramatrized solution at level 1.

On the above example, we get at level 1:
:X:'-2/(M-2)' :Y:'4/(M-2)'
At level 2, you get the list of pivots. The result returned by SYST and SOLGEN is incorrect if one of the pivot is 0. Here level 2 is:
{ 'M^2-2*M' '-M+2' -1 'M+-2'}
Using M SOLV, we see that we have to solve for the particular cases m=0 and m=2. The commands SYST and SOLGEN create a variable named SYSTEM to help solving particular cases. To solve for m=2, recall SYSTEM on the stack, type 'M=2' EXEC, and call SYST.

For systems, the SOLGEN program provides another way of writing the solution as an affine space of solutions. Recall the matrix on the stack (simply hit SYSTEM), type:
'M=0' EXEC SOLGEN
you get at level 2:
If { }, { X Y }=:{ X -2 }
(level 1 is the same as the result of SYST). This means that (x,-2) is solution for every x. The If statement shows necessary conditions for the system to have solutions (here no condition, but if we try m=2 instead of m=0 the system has no solution: the If statement is If { '0=-1'} never fulfilled).

Another way to solve the system is the enter the matrix of the system { {M 1 -2} { M 'M-1' 2 } }
and call rref to reduce it. You get at level 1:
{ { 'M^2-2*M' 0 '-2*M' } { 0 'M-2' 4 } }.
This means that:

\begin{displaymath}(m^2-2m)x=-2m, \quad \quad (m-2)y=4.\end{displaymath}

The reduction is correct iff all the coefficients in the list at level 2 are non 0. You should have at level 2:
{ 1 'M-2'}
The second coefficient vanishes if m=2. You have to solve for this particular case again. To do this, you can use the variable named MATRIX (which is created if the argument contains at least one parameter). Recall this matrix and type:
'M=2' EXEC
This replace all occurences of M by 2 in the original matrix. Now type rref again, you get:
{ { 2 1 -2 } { 0 0 4 } }
The last line means that:

0x+0y=4

which is clearly impossible; the system has no solution.


next up previous contents
Next: Inversion Up: Gauß -Jordan row reduction. Previous: Gauß -Jordan row reduction.
Bernard Parisse
1998-07-31