google / mathsteps

Step by step math solutions for everyone
https://socratic.org
Apache License 2.0
2.12k stars 274 forks source link

solveEquation with negative power causes infinite loop #228

Open BrandiATMuhkuh opened 6 years ago

BrandiATMuhkuh commented 6 years ago

It turns out that the following equation x^-2 + x^-1 = x causes a Math error: Potential infinite loop for equation: error. However, when I change the equation to 1/x^2 + 1/x^1 = x I don't get the error (FYI: 1/x^2 + 1/x^1 == x^-2 + x^-1).

here are some more trials where I ran into the same problem

I ran solveEquation with the debug flag, and it seems like the solver does not remember if it has already reached a step and loops forever.

Here is an illustration to tell you what I mean with that: We are mathematically allowed to do the follow:

I believe you get my point (infinite loop).

I suspect that solveEquation is stuck in such a case.

evykassirer commented 6 years ago

Hi! Thanks for reporting this :) Definitely not the behaviour we'd like haha - I know there are a few known ways things infinitely loop that are tricky to fix, but am not sure if this is one of those known issues.

I'm currently working on a conference that's happening in a few weeks and don't have bandwidth to look into this, but I encourage you to dig into the code and find more info about the issue or even a fix. I'd be happy to look into it in mid January as well.