On Jan 6, 7:46 pm, Robert Bradshaw <[email protected]>
wrote:
> On Jan 6, 2009, at 7:17 PM, thelamecamel wrote:
>
> > Hi,
>
> > I have inherited a numerical simulation program a few thousand lines
> > long, written in Mathematica (and fortran via mathlink) into Sage. I
> > am fed up with Mathematica as a programming language and would like to
> > replace this with python code, to be run in sage.
>
> Welcome! Having a real programming language is I think one of Sage's
> great strengths.
:)
>
>
> > As an intermediate
> > stage I was hoping to drive the mathematica simulations from sage,
> > analyse the results in sage, and gradually rewrite the simulation code
> > in python/sage. I have struck trouble early on:
>
> > It appears that I can send Sage's lists to mathematica:
> > sage: slist = [1,2,3]
> > sage: mathematica(slist)
> > {1, 2, 3}
>
> > But I don't seem to be able to do the reverse:
> > sage: mathematica(slist).sage()
> > ------------------------------------------------------------
> > SyntaxError: invalid syntax (<string>, line 1)
> > Error using SAGE to evaluate '{Integer(1), Integer(2), Integer(3)}'
>
> > How can I get mathematica lists into sage?
>
> Have you tried list(mathematica(slist))? Just a guess, as I don't
> have a copy of mathematica handy to try it with.
>
> - Robert
Unfortunately that doesn't work yet:
----------------------------------------------------------------------
| Sage Version 3.2.3, Release Date: 2009-01-05 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: slist = [1,2,3]
sage: mathematica(slist)
{1, 2, 3}
sage: list(mathematica(slist))
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call
last)
/home/mabshoff/.sage/temp/sage/11670/
_home_mabshoff__sage_init_sage_0.py in <module>()
----> 1
2
3
4
5
/usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/
expect.pyc in __len__(self)
1345
1346 def __len__(self):
-> 1347 raise NotImplementedError
1348
1349 def __reduce__(self):
NotImplementedError:
I have made this http://trac.sagemath.org/sage_trac/ticket/4948
Cheers,
Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---