2
$\begingroup$

I was trying the following code to obtain the Gaussian elimination matrix. (the Echelon form, not the reduce echelon form). Since Mathematica does not have a build in function for it, but I used this code from this post https://community.wolfram.com/groups/-/m/t/475750

I know that Gaussian elimination phase is not unique. Two people can get different output. However, one should still be able to obtain one output from the other, using some allowed row operations, correct?

The output I get from the above code, I am not able to transform to the output I get by hand, also checked with Maple. The output of Maple's Gaussian elimination, I can transform to the one I got by hand.

So I am not sure what is going on. Here is the code is used as is from the above link, I just changed the matrix to the one I am using

(mat = {{2, -1, 3}, {3, 1, -2}, {2, -2, 1}}) // MatrixForm
{lu, p, c} = LUDecomposition[mat]
u = Normal[lu*SparseArray[{i_, j_} /; j >= i -> 1, Dimensions[mat]]]
MatrixForm[u]

enter image description here

The second Matrix above is the Gaussian elimination. I will now show Maple's output (which agrees with mine, after transformation)

restart
A:=Matrix([[2,-1,3],[3,1,-2],[2,-2,1]]);
LinearAlgebra:-GaussianElimination(A)

enter image description here

The second matrix above is the Gaussian elimination. We see the first row is the same. Multiplying the last row given by Mathematica by 2/5 gives the last row from Maple's result. So far so good.

But the second row is the problem. Multiplying the second row given by Mathematica by -5/2 gives 0,5/2,5 and not as Maple shows which is 0,5/2,-13/2. The last entry is not the same.

There should be a way to transform Maple's result to Mathematica's and vis verse, using the allowed row operations. Correct?

I do not see how to do this.

Is Mathematica's Gaussian elimination result given from the above code correct? If so, what legal row operations can be used to transform it to Maple's output (which I know is correct, as it agrees with what I obtained by hand). I also verified Maple's result using code posted in find-elementary-matrices-that-produce-rref

Version 12.3

$\endgroup$
4
  • 1
    $\begingroup$ Are you allowing for pivoting? I think you need to look at applying the transformation to mat[[p]] $\endgroup$
    – mikado
    Jun 8, 2021 at 19:41
  • $\begingroup$ Not a solution to your problem, but UpperTriangularize[lu] is a slightly more convenient way to get the upper triangluar matrix. $\endgroup$ Jun 8, 2021 at 20:48
  • 3
    $\begingroup$ Any multiple of row 3 can be added to row 2 without changing correctness of row 2. $\endgroup$ Jun 9, 2021 at 0:07
  • $\begingroup$ @DanielLichtblau thank you. That was the trick. It is hard to find the needed transformation by looking at the output. $\endgroup$
    – Nasser
    Jun 10, 2021 at 4:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.