Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Well, this was implemented by Wilfried Huss in order to improve our handling of sums. But, as the code for ._sage_() says:

This currently does not implement a parser for the Mathematica output language, therefore only very simple expressions will convert successfully.

The current thing just result = str(result).lower().replace('[', '(').replace(']', ')') parses the output and tries to 'Sageify' things like Sin[x] to sin(x).

So it sounds like a case of "implement it"! I'm sorry there isn't a better answer.

On the plus side, parsing lists like this probably isn't too bad, compared to other output types. If the thing you get doesn't live in SR, then one could probably very easily just do str(result).replace('{','[') or something like that. Does that seem plausible? I know very little about Mathematica's type systems.