Description:
There seems to be a problem with mathjs not recognizing which terms it can combine into one during the simplify operation. This may be a problem with the math.string() not with math.simplify(). The test seems to fail when elements of a polynomial are not ordered by their degree and also have the same coefficients.
Version: mathjs 5.2.0 (production)
Reproduction Steps:
- Go here http://mathnotepad.com/
- Enter the following
string(simplify("5 + (5 * x) - (3 * x) + 2"))
- You will see the inccorect output
Output: "5 * (x + 1) - 3 * x + 2" but Expected: "2 x + 7"
OR
Download and Run Jest Test Suit "math.simplify.test.js" by following the ReadMe included
code.zip
Note that thesame input without equation parentheses results in thesame output:
"string(simplify("5 + 5 * x - 3 * x + 2"))" --> "5 * (x + 1) - 3 * x + 2"
However changing the elements to being sorted by degrees results in the correct output
"string(simplify("5 + 2 + 5 * x - 3 * x"))" --> "2 x + 7"
Severity: 3 (1-crash 4-trivial)
Priority 3 (1-blocking 4-few people care)
Enviroment:
Node.js (8.12.0 LTS)
OR
Latest (10/24/2018) Chrome Browser at http://mathnotepad.com/
Results Report:

Description:
There seems to be a problem with mathjs not recognizing which terms it can combine into one during the simplify operation. This may be a problem with the math.string() not with math.simplify(). The test seems to fail when elements of a polynomial are not ordered by their degree and also have the same coefficients.
Version: mathjs 5.2.0 (production)
Reproduction Steps:
string(simplify("5 + (5 * x) - (3 * x) + 2"))Output:
"5 * (x + 1) - 3 * x + 2"but Expected:"2 x + 7"OR
Download and Run Jest Test Suit "math.simplify.test.js" by following the ReadMe included
code.zip
Note that thesame input without equation parentheses results in thesame output:
"string(simplify("5 + 5 * x - 3 * x + 2"))"-->"5 * (x + 1) - 3 * x + 2"However changing the elements to being sorted by degrees results in the correct output
"string(simplify("5 + 2 + 5 * x - 3 * x"))"-->"2 x + 7"Severity: 3 (1-crash 4-trivial)
Priority 3 (1-blocking 4-few people care)
Enviroment:
Node.js (8.12.0 LTS)
OR
Latest (10/24/2018) Chrome Browser at http://mathnotepad.com/
Results Report:
