Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One problem might be that you aren't working over the fraction field. Are you sure you want Hermite form and not a different echelon? Note that this is even partly documented - if you add the line M = M.change_ring(R.fraction_field()) as suggested in http://doc.sagemath.org/html/en/reference/matrices/sage/matrix/matrix2.html (search for "hermite_form") it still does the same thing.

On the other hand, M.echelon_form() does what you (apparently) want.

R.<x> = QQ[];

@interact
def _(form=['Hermite','Echelon']):
    M = matrix(2,2, [x,x, 0,x]);
    M = M.change_ring(R.fraction_field())
    if form=='Hermite':
        show(M.hermite_form())
    else:
        show(M.echelon_form())

I don't know enough about the Hermite form to say more, but this is often what the issue is for other users in a similar situation. If this is wrong, then this is probably a bug, as opposed to inadequate documentation.