constant.Rd
Get and set the constant term of a freealg
object
The constant term in a free algebra object is the coefficient of the
empty term. In a freealg
object, the map including
\(\emptyset\longrightarrow v\) implies that \(v\) is
the constant.
If x
is a freealg
object, constant(x)
returns
the value of the constant in the multivariate polynomial; if x
is numeric, it returns a constant freealg
object with value
x
.
Function is.constant()
returns TRUE
if its argument has
no variables and FALSE
otherwise.
Setting the coefficients of the empty freealg
returns the zero
(empty) object.
p <- as.freealg("1+X+Y+xy")
constant(p)
#> [1] 1
constant(p^5)
#> [1] 31
constant(p) <- 1000
p
#> free algebra element algebraically equal to
#> + 1000 + Y + X + xy