Is there a package converting mathematica output expressions to Julia ?

I know from an other answer in the forum that there is the corresponding ToMatLab(Is it possible to export the equations from Mathematica to MATLAB?)

  • 2
    $\begingroup$ If you do not mind an extra step, you could parse to Matlab, then Matlab to Julia $\endgroup$
    – I.M.
    Commented May 6 at 16:47
  • $\begingroup$ @I.M. yes that is true but i was wondering if there was a direct way $\endgroup$
    – JTT
    Commented May 6 at 18:38

1 Answer 1


Another option is using Python as bridge.

open python and type

Python 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy.parsing.mathematica import parse_mathematica
>>> e=parse_mathematica("Sin[x]^2 Tan[y]")
>>> e

It is easy now to convert Python to Julia. There are even online convertors.

It is also possible to call Python from Julia directly using

using PyCall
sympy = pyimport("sympy")  #

So you can do this all from Julia also.

Now to convert Python to julia, using online conversion tool such as this gives

  sin(x)^2 * tan(y)

enter image description here

I am not too familiar with Julia. There might be now builtin tools inside Julia itself to convert Python expressions to Julia that you can use so do not have use online tool.

But the idea is this

  • 1
    $\begingroup$ is it possible to do this without an online conversion tool ? $\endgroup$
    – JTT
    Commented May 7 at 7:46
  • 1
    $\begingroup$ @JTT I am not too familiar with current Julia ecosystem. but googling around shows github.com/JuliaCN/Py2Jl which is Python To Julia Transpiler that you could look at. You could also ask at Julia forum if there something else. I see number of questions about conversion of Python code to julia. I am sure the online tool is using some Julia package to do this. But I do not know for sure. $\endgroup$
    – Nasser
    Commented May 7 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.