Switch indeterminates in a polynomial

plug(p, indeterminate, value)

Arguments

p

a polynomial

indeterminate

the indeterminate in the polynomial to switch

value

the value/indeterminate to substitute

Value

an mpoly object

Examples

# on an mpoly (p <- mp("(x+y)^3"))
#> x^3 + 3 x^2 y + 3 x y^2 + y^3
plug(p, "x", 5)
#> 75 y + 15 y^2 + y^3 + 125
plug(p, "x", "t")
#> t^3 + 3 t^2 y + 3 t y^2 + y^3
plug(p, "x", "y")
#> 8 y^3
plug(p, "x", mp("2 y"))
#> 27 y^3
plug(p, "x", mp("x + y"))
#> x^3 + 6 x^2 y + 12 x y^2 + 8 y^3
mp("((x+y)+y)^3")
#> x^3 + 6 x^2 y + 12 x y^2 + 8 y^3
# on an mpolyList ps <- mp(c("x+y", "x+1")) plug(ps, "x", 1)
#> y + 1 #> 2