Compute quantities/expressions related to a multivariate polynomial.

# S3 method for mpoly
[(x, ndx)

LT(x, varorder = vars(x), order = "lex")

LC(x, varorder = vars(x), order = "lex")

LM(x, varorder = vars(x), order = "lex")

multideg(x, varorder = vars(x), order = "lex")

totaldeg(x)

monomials(x)

exponents(x, reduced = FALSE)

Arguments

x

an object of class mpoly

ndx

a subsetting index

varorder

the order of the variables

order

a total order used to order the terms

reduced

if TRUE, don't include zero degrees

Value

An object of class mpoly or mpolyList, depending on the context

Examples

(p <- mp("x y^2 + x (x+1) (x+2) x z + 3 x^10"))
#> x y^2 + x^4 z + 3 x^3 z + 2 x^2 z + 3 x^10
p[2]
#> x^4 z
p[-2]
#> x y^2 + 3 x^3 z + 2 x^2 z + 3 x^10
p[2:3]
#> x^4 z + 3 x^3 z
LT(p)
#> 3 x^10
LC(p)
#> [1] 3
LM(p)
#> x^10
multideg(p)
#> x y z #> 10 0 0
totaldeg(p)
#> [1] 10
monomials(p)
#> x y^2 #> x^4 z #> 3 x^3 z #> 2 x^2 z #> 3 x^10
exponents(p)
#> [[1]] #> x y z #> 1 2 0 #> #> [[2]] #> x y z #> 4 0 1 #> #> [[3]] #> x y z #> 3 0 1 #> #> [[4]] #> x y z #> 2 0 1 #> #> [[5]] #> x y z #> 10 0 0 #>
exponents(p, reduce = TRUE)
#> [[1]] #> x y #> 1 2 #> #> [[2]] #> x z #> 4 1 #> #> [[3]] #> x z #> 3 1 #> #> [[4]] #> x z #> 2 1 #> #> [[5]] #> x #> 10 #>
lapply(exponents(p), is.integer)
#> [[1]] #> [1] TRUE #> #> [[2]] #> [1] TRUE #> #> [[3]] #> [1] TRUE #> #> [[4]] #> [1] TRUE #> #> [[5]] #> [1] TRUE #>
#> 2 x^2 z + x y^2 #> 3 x^3 z #> x^4 z #> 3 x^10