Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument varorder is not obeyed in mp() #17

Open
dkahle opened this issue Mar 18, 2019 · 2 comments
Open

Argument varorder is not obeyed in mp() #17

dkahle opened this issue Mar 18, 2019 · 2 comments
Assignees
Labels

Comments

@dkahle
Copy link
Owner

dkahle commented Mar 18, 2019

varorder internally calls reorder.mpoly(), but this is not the expected behavior. varorder, in mpoly(), sets intrinsic variable order, i.e. the order of the variables in then term, not the order of the terms themselves.

library("mpoly")

mp("x y + y x^2")
#> x y  +  x^2 y

mp("x y + y x^2", varorder = c("y", "x"))
#> x^2 y  +  x y

Created on 2019-03-18 by the reprex package (v0.2.1)

@dkahle dkahle added the bug label Mar 18, 2019
@dkahle dkahle self-assigned this Mar 18, 2019
@dkahle
Copy link
Owner Author

dkahle commented Mar 19, 2019

More:

library("mpoly")

str(mp(c("x y^2", "3 y^3 x^2"), varorder = c("x", "y")))
#> List of 2
#>  $ :List of 1
#>   ..$ : Named num [1:3] 1 2 1
#>   .. ..- attr(*, "names")= chr [1:3] "x" "y" "coef"
#>   ..- attr(*, "class")= chr "mpoly"
#>  $ :List of 1
#>   ..$ : Named num [1:3] 3 2 3
#>   .. ..- attr(*, "names")= chr [1:3] "y" "x" "coef"
#>   ..- attr(*, "class")= chr "mpoly"
#>  - attr(*, "class")= chr "mpolyList"

Created on 2019-03-19 by the reprex package (v0.2.1)

@dkahle
Copy link
Owner Author

dkahle commented Mar 21, 2019

This seems to be due to it not being respected through arithmetic:

library("mpoly")

ms1 <- mp( c("x", 'y') )
ms2 <- mp( c("y", '2 x^2') )
ms1 + ms2
#> x  +  y
#> 2 x^2  +  y

Created on 2019-03-20 by the reprex package (v0.2.1)

dkahle added a commit that referenced this issue Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant