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 ).
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}