'From Mathematica to phyton

I'm very new in Mathematica and python, but I want to transcribe my code in Mathematica to Sympy because the code in python is free, and so I can to share my words of the university, But I don't understand how to begin the following code in python. I hope someone can help me. Thanks.

Define the fields.

FR[x_, y_] = Simplify[y + \[Epsilon] (a01 + a11 x + a21 y + a31 x y + a41 x^2 + a51 y^2 ) ]

GR[x_, y_] = Simplify[-x + \[Epsilon] (b01 + b11 x + b21 y + b31 x y + b41 x^2 + b51 y^2  )]

Change to polar coordinates:

RR = FullSimplify[Collect[Factor[(Cos[\[Theta]] FR[x, y] + Sin[\[Theta]] GR[x, y]) /. {x -> r Cos[\[Theta]], y -> r Sin[\[Theta]]}], r]]

\[CapitalTheta]R = FullSimplify[Factor[((Cos[\[Theta]] GR[x, y] - Sin[\[Theta]] FR[x, y])/
      r) /. {x -> r Cos[\[Theta]], y -> r Sin[\[Theta]]}]]

Take the Taylor series of following expression:

FFR = Simplify[Normal[Series[RR/\[CapitalTheta]R, {\[Epsilon], 0, 1}]]]


Solution 1:[1]

If you look at the latest development version of SymPy, in the class MathematicaParser there is a dictionary mapping the expression nodes from Mathematica to their equivalent in SymPy.

It's not a complete list, but contributions are welcome to expand it.

The development version of SymPy is currently able to parse Mathematica code into a form equivalent to its FullForm, see the unit tests as an example.

Starting from the existing code, it is not too hard to create a Mathematica to SymPy code translator or interpreter. This could make for a nice Google Summer of Code (GSoC) project, if there are good applications.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Francesco Bonazzi