How to get sage to keep the same form as an expression from sympy?
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?
Is the following (purely) algebraic framework ok?