I have this expression:
$$-\frac{2}{3} t_{1} + \frac{2}{3} y_{1}$$
and would like to rewrite it as follows:
$$\frac{2}{3} (-t_1 + y_1)$$
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?