ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 14 Feb 2011 17:50:44 +0100Converting from Mathematica outputhttps://ask.sagemath.org/question/7942/converting-from-mathematica-output/Hi!
I am trying to run a Mathematica program from within Sage and would like to convert the output of the program to Sage objects, so that I can keep manipulating them. The output are typically lists. However, I am having trouble with the conversion; see the Sage session below. Does someone know what is wrong or how to do it correctly (my reference is
link:[here](http://www.sagemath.org/doc/reference/sage/interfaces/mathematica.html) ).
Thank you!
Anne
::
sage: m = mathematica
sage: slist = [[1,2,3],1]
sage: mlist = m(slist)
sage: mlist
{{1, 2, 3}, 1}
sage: type(mlist)
<class 'sage.interfaces.mathematica.MathematicaElement'>
sage: mlist.sage()
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/Users/anne/Documents/Mathematica/<ipython console> in <module>()
/Applications/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in sage(self)
1732 Rational Field
1733 """
-> 1734 return self._sage_()
1735
1736 def __repr__(self):
/Applications/sage/local/lib/python2.6/site-packages/sage/interfaces /mathematica.pyc in _sage_(self)
581 return SR(result)
582 except TypeError:
--> 583 raise NotImplementedError, "Unable to parse Mathematica output: %s" % result
584
585 def __str__(self):
NotImplementedError: Unable to parse Mathematica output: {{1, 2, 3}, 1}
Anne SchillingMon, 14 Feb 2011 17:50:44 +0100https://ask.sagemath.org/question/7942/