jiggzson / nerdamer

a symbolic math expression evaluator for javascript
http://www.nerdamer.com
MIT License
517 stars 82 forks source link

Simplify failing to simplify ratio of quadratics. #565

Closed thunderkid closed 3 years ago

thunderkid commented 4 years ago

Hi, Excellent library. Thank you! I'm finding that simplify is failing on this:

nerdamer('simplify((- x + x^2 + 1)/(x - x^2 - 1))').toString()

Instead of -1 it is giving ( - 1 - x ^ 2 + x ) ^ ( - 1 ) * ( - x + x ^ 2 + 1 ).

However, it works fine if you replace x^2 -> y. So

nerdamer('simplify((- x + y + 1)/(x - y - 1))').toString()

gives -1 as you'd expect.