nicolewhite / algebra.js

Build, display, and solve algebraic equations.
http://algebra.js.org
MIT License
1.34k stars 111 forks source link

Brackets stripped, even when simplify is false #89

Open markspolakovs opened 6 years ago

markspolakovs commented 6 years ago

I'm working on a learning game, and I want to use Algebra.js to teach power rules (eg. (x^2)^3 becomes x^6).

The challenge I'm running into is that Algebra.js strips out brackets from the parsed expression, and then applies powers simply as repeated multiplication.

Example: new algebra.Expression().add(algebra.parse("(x^2)"), false).pow(3, false).toString()

Expected: > "(x^2)^3 "

Actual: > "x^2x^2x^2