Is there any way I can reuse what I have in sage? I know about the existence of SymPy, but I don't know if that's useful, because even while sympy has some code for, e.g, dealing with symmetric functions, it is probably not the same as the sage one, and still forces me rewrite a large amount of code.
I don't even know if this can actually be done, but it would be really useful.
Thanks in advance.
R has a package to use Python in its path,
So yes, you can make sure that Sage's Python comes first,
and then you need to do
from sage.all import *
to load all Sage classes.
Be aware, however, that the Sage preprocessor won’t be “automatically available” ; you’ll have to preprocess your code in order to get what you mean. Compare :
## In Sage sage: (2/3).parent() Rational Field
## In Sage's Python >>> from sage.all import * >>> (2/3).parent() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'float' object has no attribute 'parent'
“Preprocessing” by hand allows you to get what you mean…,
>>> QQ(2/3).parent() Rational Field
or by using the
preparse Sage function :
>>> eval(preparse("2/3")).parent() Rational Field
this and the pages it points to for further information. This would also alleviate the platforms inconsistency problem...