# echelon_form not giving reduced echelon form

According to the document(emphasis mine):

echelon_form(algorithm='default', cutoff=0, **kwds)


Return the echelon form of self.

OUTPUT:

The reduced row echelon form of self, as an immutable matrix.

Here is what I was doing:

sage: A = Matrix([[1,0,3,1,2],[-1,3,0,-1,1],[2,1,7,2,5],[4,2,14,0,6]])
sage: A.echelon_form()

[1 0 3 1 2]
[0 1 1 0 1]
[0 0 0 4 4]
[0 0 0 0 0]


While the result is in row echelon form, it's not in reduced row echelon form. What I expect is something like this:

[1 0 3 0 1]
[0 1 1 0 1]
[0 0 0 1 1]
[0 0 0 0 0]


Also, if this is merely a documentation bug, how can I get the reduced row echelon form of a matrix?

edit retag close merge delete

1
( 2016-11-30 10:01:57 -0500 )edit

Sort by ยป oldest newest most voted

sage: A.parent()
Full MatrixSpace of 4 by 5 dense matrices over Integer Ring


so it's a matrix over the integers. There "echelon form" means "Hermite normal form", which is what you got (the transition matrix is an integer matrix with an inverse that is also an integer matrix in that case. That's why the row [0 0 0 4 4] doesn't get scaled)

If you're interested in reduced row echelon form over the rationals, you can get that:

sage: B=A.change_ring(QQ)
sage: B.echelon_form()
[1 0 3 0 1]
[0 1 1 0 1]
[0 0 0 1 1]
[0 0 0 0 0]

more

1

On the Stackoverflow one though the question is whether the "Hermite normal form" or whatever actually should be called a reduced form or not. Perhaps that is a subtle doc bug, even given our usual answer where the base ring matters? I just don't know whether there is a standard terminology in the non-field case for "reduced".

( 2016-11-30 10:05:15 -0500 )edit