Macaulay2 » Documentation
Packages » Macaulay2Doc » rings » manipulating polynomials » listForm
next | previous | forward | backward | up | index | toc

# listForm -- convert to list form

- Usage:
    `listForm f`
- Inputs:
  - f, a ring element or a monoid element,
- Outputs:
  - a list, the polynomial or monomial in a form represented by nested lists.

## Description

A monomial is represented by the list of its exponents. A polynomial is represented by lists of pairs (m, c), one for each term, where m is a list of exponents for monomial, and c is the coefficient.

    i1 : R = ZZ/101[x,y,z];

    i2 : listForm (x^2 - 7 + x*y*z^11 + y)

    o2 = {({1, 1, 11}, 1), ({2, 0, 0}, 1), ({0, 1, 0}, 1), ({0, 0, 0}, -7)}

    o2 : List

## Code

    ../../m2/monoids.m2:133:24-138:69: --source code:
    listForm RingElement := f -> (
        R := ring f;
        n := numgens R;
        k := coefficientRing R;
        (cc, mm) := rawPairs(raw k, raw f);
        toList apply(cc, mm, (c, m) -> (exponents(n, m), promote(c, k))))

## See also

- standardForm -- convert to standard form
- content -- the content of a polynomial
- coefficients -- get the monomials and coefficients of a polynomial or matrix
- exponents -- the exponents of a polynomial
- monomials -- matrix of monomials in a ring element or matrix

## Ways to use listForm:

- `listForm(MonoidElement)`
- `listForm(RingElement)`
- listForm(Number) (missing documentation)

## For the programmer

The object listForm is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/doc_ringelement.m2:130:0.