Open levirs565 opened 3 years ago
Thank you for investigating this issue and submitting this PR. The Compute Engine codebase is undergoing a refactor which unfortunately makes merging this PR directly a little bit tricky. However, I will make sure to incorporate your changes and preserve their effect. Again, thanks for your submission, it is very much appreciated.
Expression with square not sorted correctly because square does not get degree 2. You can see the difference before and after this PR in table below.
x^2+x^3+x
x^{3}+x+x^2
x^{3}+x^2+x
x^2+x^3+\sin(x)
x^{3}+x^2+\sin(x)
x^{3}+x^2+\sin(x)
\sin(x)+x^2+x^3
x^{3}+\sin(x)+x^2
x^{3}+x^2+\sin(x)
Some test's expected result have been changed. You can see changed test in this table.
x^2y^3+x^3y^2+xy^4+x^4y+x^2y^2
x^{4}y+xy^{4}+x^{3}y^2+x^2y^{3}+x^2y^2
x^{4}y+x^{3}y^2+x^2y^{3}+xy^{4}+x^2y^2
(b^3b^2)+(a^3a^2)+(b^6)+(a^5b)+(a^5)
a^{5}b+b^{6}+a^{5}+a^2a^{3}+b^2b^{3}
a^{5}b+b^{6}+a^2a^{3}+a^{5}+b^2b^{3}
Why I change the test's expected result?. Canocial form of those expression are inconsistent with other expressions that does not have square. You can see this table:
x^2y^3+x^3y^2+xy^4+x^4y+x^2y^2
x^{4}y+xy^{4}+x^{3}y^2+x^2y^{3}+x^2y^2
x^{4}y+x^{3}y^2+x^2y^{3}+xy^{4}+x^2y^2
(b^3b^2)+(a^3a^2)+(b^6)+(a^5b)+(a^5)
a^{5}b+b^{6}+a^{5}+a^2a^{3}+b^2b^{3}
a^{5}b+b^{6}+a^2a^{3}+a^{5}+b^2b^{3}
(b^3b^3)+(a^3a^3)+(b^6)+(a^5b)+(a^5)
a^{3}a^{3}+a^{5}b+b^{3}b^{3}+b^{6}+a^{5}
a^{3}a^{3}+a^{5}b+b^{3}b^{3}+b^{6}+a^{5
}`Also, this change fix some sorting result when there are square in expression and sin function.