Probably the easiest is to transfer your Mathematica code to Fortran or C 
using built-in and third-party facilities within mathematica, and then call 
this C/Fortran from python.

Mathics is under GPL license, incompatible with Sympy?

here is a relevant SAGE discussion with some partial solutions:
https://groups.google.com/forum/#!topic/sage-devel/JLg-fJ4dJns

and also scala parser:

https://github.com/mattpap/mathematica-parser

On Thursday, October 9, 2014 2:27:21 AM UTC-5, Francesco Bonazzi wrote:
>
> Mathics somewhat translates Mathematica to SymPy.
>
> https://github.com/poeschko/mathics
>
> http://www.mathics.org/
>
> I tried to play with Mathics' code a while ago, unfortunately there is 
> very little documentation. In any case, Mathics has a parser for 
> Mathematica's code, it builds its own AST object mapping, and calls SymPy 
> to perform the algorithmic evaluation. You could try to use it and put a 
> debugging breakpoint on the SymPy calls, but that's still hard to do.
>
> Mathics has also a Mathematica compatible pattern matcher.
>
> Technically, I think that if we add assumptions-awareness and specificity 
> sorting to the patterns containing wild cards, and default/optional 
> wildcards, SymPy's patterns would become much more similar to those of 
> Mathematica (except for excessive matches like inverse functions and 
> powers).
>
> On Thursday, October 9, 2014 6:15:22 AM UTC+2, Richard Fateman wrote:
>>
>> There are at least 2 open source parsers for Mathematica code.
>>
>> The trivial stuff  -- parsing x Sin[x]  into    x*sin(x) equivalent could 
>> be
>> done by following directions in any intro to compilers book.
>>
>> The rest of the stuff, which requires pattern matching, simplification, 
>> and
>> a whole collection of specific commands all sitting inside the Mathematica
>> rule-based evaluation mechanism ...  well you won't get that by 
>> translating
>> naively into python.
>>
>> It's like saying you can translate Lisp into C.  Sure.   But if you want 
>> to
>> execute it, you need a whole bunch of stuff, like a garbage collector,
>> arbitrary-precision integers,  etc etc etc   that you don't get by 
>> translating
>> (+ a b)     into a+b.
>>
>>
>>
>> On Wednesday, October 8, 2014 7:16:02 PM UTC-7, [email protected] wrote:
>>>
>>> you can try this expression for a test 
>>> (-6x^2-x-7)(2x^3+3x^2-2x-5)
>>>
>>> 在 2012年5月2日星期三UTC+8上午12时19分18秒,Aaron Meurer写道:
>>>>
>>>> This probably is doable, but we would need an actual parser in SymPy, 
>>>> which is the difficult part.  If we had that, adding rules for 
>>>> Mathematica functions would ideally not be hard.  See 
>>>> https://github.com/sympy/sympy/wiki/parsing for some ideas on parsing. 
>>>>
>>>> More realistically, in 
>>>> http://code.google.com/p/sympy/issues/detail?id=161, it is suggested 
>>>> that for Maxima, Sage can be used.  So I'm wondering if Sage, or maybe 
>>>> some other project has a parser for Mathematica that can put it in a 
>>>> form that SymPy can read, or at least on close. 
>>>> http://code.google.com/p/sympy/issues/detail?id=2864 is also related 
>>>> to this. 
>>>>
>>>> Can you give an example of a Mathematica expression that you want to 
>>>> parse? 
>>>>
>>>> Aaron Meurer 
>>>>
>>>> On Tue, May 1, 2012 at 9:00 AM, [email protected] 
>>>> <[email protected]> wrote: 
>>>> > I doubt that any automated translation will produce quality code. The 
>>>> > style of Mathematica code is much more functional than the object 
>>>> > oriented python style. What you get from automatic translation will 
>>>> > not be human-readable (it will be python but very obfuscated). 
>>>> > 
>>>> > So I am very pessimistic. However if you have any success with this 
>>>> it 
>>>> > will be great for sympy. 
>>>> > 
>>>> > -- 
>>>> > You received this message because you are subscribed to the Google 
>>>> Groups "sympy" group. 
>>>> > 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/sympy?hl=en. 
>>>> > 
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/85b47c59-5675-46e9-aeb1-dd472a9f4f1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to