Algebrite icon indicating copy to clipboard operation
Algebrite copied to clipboard

Simplify call significantly slower for "x^(-6)+1" than for "x^(-6)"

Open conipoi opened this issue 5 years ago • 3 comments

I'm looking into integrating Algebrite into my javascript web app for comparing math expressions that a user inputs in a text field with the correct solutions.

While testing I'm experiencing that sometimes Algebrite.simplify slows down significantly even though I'm just adding a "+1".

Calling Algebrite.simplify("x^(-6)+1") takes ~15-24sec to calculate while Algebrite.simplify("x^(-6)") takes roughly 20ms.

Can you fix this issue or at least explain why this is happening?

When running this on your demo website or in the console, I'm getting results almost instantly. I'm using a minified version of the algebrite.bundle-for-browser.js.

Thanks in advance!

conipoi avatar Oct 22 '19 14:10 conipoi

probably trying to factor it. TBC. leaving this open for further checks.

davidedc avatar Oct 22 '19 14:10 davidedc

Thanks for the quick reply! But that should still affect both the speed in the console and the browser? How come it's so different?

conipoi avatar Oct 22 '19 15:10 conipoi

if that's the reason, then yes one expression is much easier to factor than the other see https://www.wolframalpha.com/input/?i=factor%28x%5E%28-6%29%29 vs https://www.wolframalpha.com/input/?i=factor%28x%5E%28-6%29%2B1%29 so that would explain it

davidedc avatar Oct 22 '19 16:10 davidedc