algebra.js icon indicating copy to clipboard operation
algebra.js copied to clipboard

Brackets stripped, even when simplify is false

Open markspolakovs opened this issue 7 years ago • 0 comments

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

markspolakovs avatar Mar 21 '18 08:03 markspolakovs