with 6 digits and partial pivoting
In the last three examples we've solved the same system and come up with an infinite number of solutions, no solution, or one solution depending on the number of digits used. This system is very sensitive to round off errors. The technique of partial pivoting can be used to try to minimize the errors due to rounding. We will illustrate that here with Digits set equal to 6.
> Digits:=6;
> ill:=array(1.. 3,1.. 4,[[6,6,3.00001,30.00002],[10,8,4.00003,42.00006],[6,4,2.00002,22.00004]]);
Partial Pivoting
In the first column the 10 in the second row has the largest magnitude so we will switch row 1 and row 2.
Switch row 1 and row 2
> ill1:=linalg[swaprow](ill,1,2);
Multiply row 1 by 1/10
> ill2:=linalg[mulrow](ill1,1,1/ill1[1,1]);
Add to row 2 -6 times row 1
> ill3:=linalg[addrow](ill2,1,2,-ill2[2,1]);
Partial Pivoting
In the remaining two rows the 6/5 in the second column has a larger magnitude than the -4/5. As a result we do not switch rows two and three.
Add to row 3 -6 times row 1
> ill4:=linalg[addrow](ill3,1,3,-ill3[3,1]);
Multiply row 2 by 5/6
> ill5:=linalg[mulrow](ill4,2,1/ill4[2,2]);
Add to row 1 -4/5 times row 2
> ill6:=linalg[addrow](ill5,2,1,-ill5[1,2]);
Add to row 3 4/5 times row 2
> ill7:=linalg[addrow](ill6,2,3,-ill6[3,2]);
Multiply row 3 by 1/ill7[3,3]
> ill8:=linalg[mulrow](ill7,3,1/ill7[3,3]);
Add to row 1 -ill8[1,3] times row 3
> ill9:=linalg[addrow](ill8,3,1,-ill8[1,3]);
Add to row 2 -ill9[2,3] times row 3
> ill10:=linalg[addrow](ill9,3,2,-ill9[2,3]);
Recall that when we did this before with 6 digits and did not use partial pivoting we got "no solution" as our consclusion,
>