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. 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?
These are not the right way to do this, but they seem to give results
for right now, at least until someone fixes this:
sage: a=mathematica([1,2,3])
sage: [a[i] for i in range(1,a.Length()+1)]
[1, 2, 3]
Or
sage: a=mathematica(slist)
sage: a._Expect__sage_list
[1, 2, 3]
Jason
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---