Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix: Expression with square not sorted correctly#20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
levirs565 wants to merge1 commit intocortex-js:main
base:main
Choose a base branch
Loading
fromlevirs565:fix-sorting

Conversation

@levirs565
Copy link

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.

ExpresssionCanocical Form Before this PRCanocical Form After this PRStatus
x^2+x^3+xx^{3}+x+x^2x^{3}+x^2+xAfter this PR expression sorted correctly
x^2+x^3+\sin(x)x^{3}+x^2+\sin(x)x^{3}+x^2+\sin(x)Sorted correctly.
\sin(x)+x^2+x^3x^{3}+\sin(x)+x^2x^{3}+x^2+\sin(x)This expression's cannocial form must equal with above expression's canonical form

Some test's expected result have been changed. You can see changed test in this table.

ExpresssionCanocical Form Before this PRCanocical Form After this PR
x^2y^3+x^3y^2+xy^4+x^4y+x^2y^2x^{4}y+xy^{4}+x^{3}y^2+x^2y^{3}+x^2y^2x^{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:

ExpresssionCanocical Form Before this PRCanocical Form After this PRStatus
x^2y^3+x^3y^2+xy^4+x^4y+x^2y^2x^{4}y+xy^{4}+x^{3}y^2+x^2y^{3}+x^2y^2x^{4}y+x^{3}y^2+x^2y^{3}+xy^{4}+x^2y^2Different
(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}Different
(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}`Equal

Also, this change fix some sorting result when there are square in expression and sin function.

@arnog
Copy link
Member

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.

PanopticaRising and phcreery reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@levirs565@arnog

[8]ページ先頭

©2009-2025 Movatter.jp