google / mathsteps

Step by step math solutions for everyone

Home Page:https://socratic.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

solveEquation with negative power causes infinite loop

BrandiATMuhkuh opened this issue · comments

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

  • x^-2 + x^-1= x
  • x^-2 + x^-1 + x^0 = x^1 + x^2
  • x^-2 + x^-1 + x^0 = x^2 + x^1
  • x^-1 + x^-2 + x^0 = x^2 + x^1
  • x^0 + x^-1 + x^-2= x^1 + x^2

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:

  • 1 + 1 = x
  • 1 = x - 1
  • 1 + 1 = x
  • 1 = x - 1
  • 1 + 1 = x
  • 1 = x - 1
  • ...

I believe you get my point (infinite loop).

I suspect that solveEquation is stuck in such a case.

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.