nalzok
nalzok

Reputation: 16127

SageMath - echelon_form not giving 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]

I don't think the output above is 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]

What am I doing wrong? Or is this a bug of Sage?

Upvotes: 1

Views: 744

Answers (1)

kcrisman
kcrisman

Reputation: 4402

Did you read the first part of the documentation you link to?

Note This row reduction does not use division if the matrix is not over a field (e.g., if the matrix is over the integers). If you want to calculate the echelon form using division, then use rref(), which assumes that the matrix entries are in a field (specifically, the field of fractions of the base ring of the matrix).

This is the reduced form, over the base ring in question. Or maybe it isn't if you think reduced means it must be over a field; I'm not an expert in this terminology. Anyway, hopefully this clarifies your question.

Upvotes: 6

Related Questions