# constant: The constant term In freealg: The Free Algebra

## Description

Get and set the constant term of a `freealg` object

## Usage

 ```1 2 3 4 5 6 7``` ```## S3 method for class 'freealg' constant(x) ## S3 method for class 'numeric' constant(x) ## S3 replacement method for class 'freealg' constant(x) <- value is.constant(x) ```

## Arguments

 `x` Object of class `freealg` `value` Scalar value for the constant

## Details

The constant term in a free algebra object is the coefficient of the empty term. In a `freealg` object, the map including ```{} -> 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.

## Author(s)

Robin K. S. Hankin

## Examples

 ```1 2 3 4 5 6 7``` ```p <- as.freealg("1+X+Y+xy") constant(p) constant(p^5) constant(p) <- 1000 p ```

freealg documentation built on Nov. 19, 2021, 9:07 a.m.