convert.mpoly: Convert Between mpoly and List Representations of...

convert.mpolyR Documentation

Convert Between mpoly and List Representations of Multivariate Polynomials

Description

Converts an mpoly object to a simple list representation, or converts a simple list representation back to an mpoly object.

Usage

convert.mpoly(poly)

Arguments

poly

An mpoly object, or a list containing powers and coefficients that define a multivariate polynomial.

Details

The list representation consists of 2 components:

  • powers: A matrix where each row represents the exponents/powers of X for a single term in the multivariate polynomial.

  • coeff: A numeric vector where each element is the coefficient for the corresponding row/term in powers.

Value

If poly is of class 'mpoly', returns a list with two components (powers and coeff). If poly is a list of this form, returns the corresponding mpoly object.

Author(s)

Kem Phillips kemphillips@comcast.net

References

\insertRef

Phillips2010symmoments

See Also

convert.multipol, evaluate_expected.polynomial, integrate.polynomial

Examples

## Not run: 
library(mpoly)

# Create an mpoly object
t0 <- mpoly::mpoly(list(
  c(coef = 3, x1 = 2),
  c(coef = 2, x1 = 1, x2 = 3),
  c(coef = -4, z = 2),
  c(coef = 1, x1 = 1, x2 = 2, z = 1)
))  

# Convert from mpoly to list representation
t1 <- convert.mpoly(t0)    

# Convert from list representation back to an mpoly object
t2 <- convert.mpoly(t1) 

## End(Not run)


symmoments documentation built on May 27, 2026, 9:06 a.m.