1 | initial version |
I know it's not what you mean, but you can use strings:
sage: ex = "2*x+2*x"
sage: ex
'2*x+2*x'
sage: var('x')
sage: sage_eval(ex, locals = globals())
4*x
But for example you don't get the correct latex representation of ex when you do latex(ex), it's just typed as a string.