What are some alternatives to Python library SymPy implemented in Julia?
There is a wrapper:
Is there no native Julia equivalent?
There are, but I donâ€™t know if they are equivalent. E.g.:
Symata.jl
actually relies a lot on sympy for its rewriting and Reduce.jl
is a wrapper around REDUCE
, which is mainly written in Lisp. The closest in pure Julia would most likely be ModelingToolkit.jl, which mainly focuses on rewriting and calculating symbolic derivatives and builds on SymbolicUtils.jl, so it should already be quite fast. That said, itâ€™s still far from feature complete compared to sympy, so I definitely wouldnâ€™t call it a sympy equivalent yet.
I always had an impression that SymPy is so popular in Python world only because Python doesnâ€™t support symbols and expressions as firstclass citizens. Julia does. And since symbolic programming is builtin into the language, people tend to create packages for more specific tasks. For example, there are libraries for expression rewriting and simplification (1, 2), calculus (3), Einstein notation (4) and many others. You may get better suggestions if you have such specific tasks in mind.
Iâ€™d like to solve the exercises in the book Doing Math with Python using Julia instead of Python.
In my class I also have students doing some of the symbolic calculations programmatically rather than on paper. I use SymPy.jl
, which I actually like using quite a bit more than the underlying Python package. Itâ€™s less verbose, and some of the operations do end up being performed by generic algorithms on the Julia side. The Python installation is managed behind the scenes when you add SymPy
, so the dependency on Python shouldnâ€™t be a problem in practice.
Very few languages have a library like SymPy. I think really just Lisp and Python (OK, maybe Java; I donâ€™t know that much about SymJa). The amount of work it takes to built and maintain such a library is enormous, and the payoff is modest compared to lots of other highinvestment packages that have been written in pure Julia.
I just renamed this topic from â€śJulia equivalent of SymPy?â€ť to â€śJulia alternatives to SymPy?â€ť which I think better expresses what Iâ€™m looking for, but may invalidate some of the comments.
Symata.jl depends on sympy (the Python library, not the Julia wrapper). Much of the lowerlevel stuff in Symata is in Julia, the higherlevel stuff, like calculus, calls sympy.
Hello dear bro Because of your useful post, I discovered and Iâ€™m using ModelingToolkit.jl
But please, can you help me with two things??
Iâ€™m working with Symbolic Matrices with small and big expressions

There is things like this:
How can I convert those â€śConstantâ€ť values to simply numeric and keeping the Array Expression, for example this:
[th2 0 ; 5 th1*5]

Can you tell me how to simplify this??
sin(0) * sin(th2) + 1 * cos(th1) * cos(0) * sin(1.5707963267948966) + 1 * cos(1.5707963267948966) * cos(th1) * cos(th2) * sin(0) * cos(1.5707963267948966) + sin(1.5707963267948966)
To this:
1  cos(th1)
The commandModelingToolkit.simplify.
doesnâ€™t work
1.5707963267948966 = pi/2
Thanks in advance
Hi, Modeling Tolkit has no way of simplifying that (except doing it by hand via manual substitution) because
1.5707963267948966 = pi/2
is not true from mathematical (symbolic) point of view. 1. 5707963267948966 is floating point number that is finite, so it canâ€™t represent pi/2 for the purposes of symbolic simplification. Keeping pi//2
as fraction in symbolic form could help but Iâ€™m not sure whether Modelling Toolkit has this kind of rule for trigonometric simplification, but it can surely be added in