1 | initial version |
This is typical---it is assumed that you can divide and things aren't zero. This happens in other math software systems too. The Maple chapter of the Handbook of Linear Algebra discusses this (p. 72-10) and refers to these two references:
That HLA chapter suggests using LU decomposition to do this, but apparently LU decomposition doesn't work too well for our symbolic matrix.
HOWEVER: You can do this in Sage if you use a different base ring for the matrices:
sage: R.<b1,b2,b3>=QQ[]
sage: A=matrix([[1,1,2,b1],[1,0,1,b2],[2,1,3,b3]])
sage: A.echelon_form()
[ 1 0 1 b2]
[ 0 1 1 b1 - b2]
[ 0 0 0 -b1 - b2 + b3]
Note that rref
still gives the answer you got before since rref
works over the fraction field:
sage: A.rref()
[1 0 1 0]
[0 1 1 0]
[0 0 0 1]
sage: parent(A)
Full MatrixSpace of 3 by 4 dense matrices over Multivariate Polynomial Ring in b1, b2, b3 over Rational Field
sage: parent(A.echelon_form())
Full MatrixSpace of 3 by 4 dense matrices over Multivariate Polynomial Ring in b1, b2, b3 over Rational Field
sage: parent(A.rref())
Full MatrixSpace of 3 by 4 dense matrices over Fraction Field of Multivariate Polynomial Ring in b1, b2, b3 over Rational Field