sympy / sympy

A computer algebra system written in pure Python
https://sympy.org/
Other
13k stars 4.44k forks source link

apart() is very slow #13022

Open arihantparsoya opened 7 years ago

arihantparsoya commented 7 years ago

apart(1/(x**2*(a + b*x)**10), x) takes minutes to compute. Is it possible to optimize the function?

Mathematica: screen shot 2017-07-22 at 11 20 36

jksuom commented 7 years ago

Optimization might be possible. apart builds a system of linear equations and currently calls solve for its solution. solve works by inverting the coefficient matrix, which takes a long time for bigger matrices. (It uses inv_quick that is intended for sparse or small matrices. ) It would probably be worth investigating if apart could apply directly some matrix method for solving the system.

certik commented 7 years ago

I wonder if SymEngine can help here. We don't have apart implemented, so I created an issue for it there (https://github.com/symengine/symengine/issues/1324).

In general, I think SymEngine might help with lots of stuff in Rubi eventually. But this could be the start.