4 ms·
SymPy is pretty great, but some of its basic operations (e.g. subs() and evalf(), which substitute numeric values for symbolic variable names) can be exceedingl
by symbolicanon 7y ago
SymPy is pretty great, but some of its basic operations (e.g. subs() and evalf(), which substitute numeric values for symbolic variable names) can be exceedingly slow. There are workarounds like autowrap, which generates C code to do this orders of magnitude faster. There are also reimplementation efforts in C++ like symengine to address the performance issues.
- krastanov 7y ago`subs` and `evalf` is simply not the right tool for float/double precision arithmetics. `subs` in particular is a general tool for symbolic substitutions, and it is not fair to expect it to be fast for numerics (although improvements would always be great). `evalf` provides high precision arithmetics (your RAM is the limit), so again, it is inherently slower than float math. One can argue that this should be documented better or that the tool should be able to guess the intent of the user, but otherwise I would say of course `subs` and `evalf` are slow when you use them for float math.