Search code examples
pythonsympysymengine

How can I access SymEngine for use with SymPy?


I'm working on some code and I've noticed that compared to Mathematica, SymPy's simplify command is dreadfully slow. What Mathematica can compute in a split second, SymPy takes forever to compute.

I've read recently online that SymEngine is being (or has been?) implemented into SymPy to make it faster, and that the goal is (was?) to access SymEngine from Python. Is there any way I can somehow make SymPy on my computer use SymEngine?


Solution

  • SymEngine is still under heavy development, but I have sucessfully used some of the functionality they have already implemented. Expect no miracles though, as there are still many parts missing.

    Easiest way to use symengine is to download from github and follow their instructions: symengine If you have ubuntu it's really easy, if not you have to install from source (also easy). I suggest systemwide install, it's certainly easier.

    Once installed you need to install the python wrapper: symengine.py Same project, same team, works very well together.

    Now you are all set to start experimenting with symengine. To use it you need to import symengine, and likely also import sympy as you are likely to use functions not implemented in symengine (yet).