|
|
Line 1: |
Line 1: |
|
=="Break" vs. "return" bug== |
|
=="Break" vs. "return" bug== |
|
|
|
|
|
The algorithm has a Bug. |
|
The algorithm has a Bug.<br> |
|
It does NOT do the SWAP. No conditions are checked |
|
|
|
|
|
|
It does NOT work for this example matric |
|
It does NOT do the SWAP. No conditions are checked<br> |
|
|
|
|
⚫ |
Solve the following system of equations. |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
Solution. The corresponding augmented matrix is |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
Create the first leading one by interchanging rows 1 and 2 |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
Now subtract 3 times row 1 from row 2, and subtract 4 times row 1 from row 3. The result is |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
Now subtract row 2 from row 3 to obtain |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
This means that the following reduced system of equations |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
|
|
|
|
|
|
It does NOT work for this example matrix<br> |
⚫ |
is equivalent to the original system. In other words, the two have the same solutions. But this last |
|
|
|
|
⚫ |
system clearly has no solution (the last equation requires that x, y and z satisfy 0x+0y+0z = −3, |
|
|
|
|
⚫ |
and no such numbers exist). Hence the original system has no solution. |
|
|
⚫ |
Solve the following system of equations. <br> |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
Solution. The corresponding augmented matrix is <br> |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
Create the first leading one by interchanging rows 1 and 2 <br> |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
Now subtract 3 times row 1 from row 2, and subtract 4 times row 1 from row 3. The result is <br> |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
Now subtract row 2 from row 3 to obtain <br> |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
This means that the following reduced system of equations <br> |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
|
|
|
⚫ |
is equivalent to the original system. In other words, the two have the same solutions. But this last <br> |
|
|
|
|
⚫ |
system clearly has no solution (the last equation requires that x, y and z satisfy 0x+0y+0z = −3, <br> |
|
|
|
|
⚫ |
and no such numbers exist). Hence the original system has no solution. <br> |
|
|
|
|
|
|
|
|
|
|
|