components: Polynomial components

componentsR Documentation

Polynomial components

Description

Compute quantities/expressions related to a multivariate polynomial.

Usage

## S3 method for class '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, unit = FALSE)

exponents(x, reduced = FALSE)

## S3 method for class 'mpoly'
coef(object, ...)

normalize_coefficients(p, norm = function(x) sqrt(sum(x^2)))

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

unit

for monomials(), should the monomials have coefficient 1?

reduced

if TRUE, don't include zero degrees

object

mpoly object to pass to coef()

...

In coef(), additional arguments passed to print.mpoly() for the names of the resulting vector

p

an object of class mpoly or mpolyList

norm

a norm (function) to normalize the coefficients of a polynomial, defaults to the Euclidean norm

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"))
p[2]
p[-2]
p[2:3]

LT(p)
LC(p)
LM(p)

multideg(p)
totaldeg(p)
monomials(p)
monomials(p, unit = TRUE)
coef(p)

exponents(p)
exponents(p, reduce = TRUE)
lapply(exponents(p), is.integer)

homogeneous_components(p)

(p <- mp("(x + y)^2"))
normalize_coefficients(p)
norm <- function(v) sqrt(sum(v^2))
norm(coef( normalize_coefficients(p) ))

abs_norm <- function(x) sum(abs(x))
normalize_coefficients(p, norm = abs_norm)

p <- mp(c("x", "2 y"))
normalize_coefficients(p)

# normalize_coefficients on the zero polynomial returns the zero polynomial
normalize_coefficients(mp("0"))



dkahle/mpoly documentation built on July 27, 2023, 11:44 p.m.