4 ms·
Good to know: sympy does not use numpy so you can use pypy instead of python. In my case I got a 7x speedup.
by joak 6y ago
Good to know: sympy does not use numpy so you can use pypy instead of python.
In my case I got a 7x speedup.
- jbay808 6y agoYou 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.
- westurner 6y agoSymEngine https://github.com/symengine/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 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
- ChrisRackauckas 6y agoOne 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/#Building-Non-Allocating-Parallel-Functions-for-Sparse-Matrices-1 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.
- mattip 6y agoNice. Over at #pypy on IRC we would love to hear about the use case since we rarely get to showcase positive results