I'm trying to row reduce a matrix with variables in the last column:
s, t = symbols('s t')
S = Matrix(2,3, [2,-1, s, 1, -1/2, t])
So, Matrix([[2, -1, s], [1, -0.500000000000000, t]])
. When row reduced, the second row should be 0 0 t - s/2
, that is, an expression in s
and t
(so the matrix is singular unless s = 2t). But SymPy returns:
Matrix([[1, -1/2, 0], [0, 0, 1]])
This question gets at this same issue but the solution there (passing simplify = True
into the rref
method) doesn't work for me, and I have tried several of the other possible simplify options with no luck. For example, passing simplify = cancel
gives me the same result and passing just cancel
as the first argument gives me the matrix Matrix([[2, 0, s], [1, 0, t]])
.
What simplifying option should be passed, and how should I invoke it?