1 | initial version |
If you're happy using the bindings that are available on top-level you can do
sage_eval('exp(x)',locals=globals())
The semantics of sage/python are simply not consistent with assuming that any unbound identifier is a symbolic variable. You could write something yourself, first use python to parse the string, collect all the names occurring and look up if those are bound, and insert bindings for the ones that are not.