I have this expression:
−23t1+23y1
and would like to rewrite it as follows:
23(−t1+y1)
Using sympy, I can get something close:
import sympy as sp
var('y1 t1')
expr1 = -2/3*t1 + 2/3*y1
sp.factor(sp.sympify(expr1))
This gives:
𝟸*(⎯𝚝𝟷+𝚢𝟷)/𝟹
But when I convert it back to Sage:
sp.factor(sp.sympify(expr1))._sage_()
The result reverts to expr1
.
How can I get the call to _sage_()
not do any rewrites on the sympy expression?