I have a symbolic matrix whose entries I would like to simplify for display. Minimal working example (in the sage
REPL):
a,b=var('a,b'); m=matrix(SR,2,[[(a*b-a)/a,0],[0,1]]).simplify_rational()
works fine and upon calling m
produces
[b - 1 0]
[ 0 1]
as expected. On the other hand, running
a,b=var('a,b'); m=matrix(SR,2,[[(a*b-a)/a,0],[0,1]]).simplify_rational(algorithm='simple')
as per the documentation produces
TypeError Traceback (most recent call last) <ipython-input-30-3edf7642200d> in <module>() ----> 1 a,b=var('a,b'); m=matrix(SR,Integer(2),[[(a*b-a)/a,Integer(0)],[Integer(0),Integer(1)]]).simplify_rational(algorithm='simple')
TypeError: simplify_rational() takes no keyword argument
If I apply the method to a single expression it works fine:
((a*b-a)/a).simplify_rational(algorithm='simple')
gives back b-1
.