Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Good to know: sympy does not use numpy so you can use pypy instead of python.

In my case I got a 7x speedup.



You can however use sympy to convert symbolic expressions to numeric numpy functions, using the "lambdify" feature. It's awesome because it lets you symbolically generate and manipulate a numerical program.


SymEngine https://github.com/symengine/symengine

> SymEngine is a standalone fast C++ symbolic manipulation library. Optional thin wrappers allow usage of the library from other languages, e.g.:

> [...] Python wrappers allow easy usage from Python and integration with SymPy and Sage (the symengine.py repository)

https://en.wikipedia.org/wiki/SymPy > Related Projects:

> SymEngine: a rewriting of SymPy's core in C++, in order to increase its performance. Work is currently in progress to make SymEngine the underlying engine of Sage too


One of the difficulties we ran into here though was that "lambdify" was built for simplicity and not for speed. You can see this in how it doesn't support things like lamdification on sparse matrix types. A lot of our applications started with SymPy/SymEngine under the hood, but when push came to shove we had to write a pre Julia symbolic engine (ModelingToolkit) so we could more easily generate fast multithreaded sparse non-allocating functions from symbolic equations (https://mtk.sciml.ai/dev/tutorials/symbolic_functions/#Build...). SymPy is great though, it's just if you try using it on a million equations, oof haha.


Nice. Over at #pypy on IRC we would love to hear about the use case since we rarely get to showcase positive results




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: