
poly - creates polynomials

Calling sequence:
poly(expr [ , [ expr_1 ...] ]   [ , ring ])
poly(pol [ , [ expr_1 ...] ]   [ , ring ])
ring  --->  Expr
ring  --->  IntMod( integer )
ring  --->  domain

Parameter:
expr, expr_1   --  expressions
pol            --  polynomial
integer        --  integer larger than 1
domain         --  domain

Summary:

poly converts an expressionor a polynomial into a polynomial (basic type
DOM_POLY).

 o  poly(e, [x1,...,xn], r) converts the expression e into a polynomial
    with the indeterminates x1,...,xn. The coefficient ringof the polynomial
    is given by r. The expression need not have been previously expanded;
    it is internally expanded by poly.

     If no indeterminate is given then the indeterminates are searched for
     in the first argument, similar to the function indets. If the coefficient
     ring is not given then the ring Expr is used. In this case any MuPAD
     expression is permitted as the coefficient ring.

     poly returns FAIL if the expression cannot be converted into a polynomial.

  o  poly(p, [x1,...,xn], r) converts the polynomial p into a polynomial
     with the indeterminates x1,...,xn. The coefficient ring is once more
     given by r.

     If no indeterminates are given then only the coefficient ring of the
     polynomial is changed. If the coefficient ring is not given then the ring
     of the polynomial p is used.

The order of the indeterminates is given by their position in the list. This is
x1 > x2 > ... xn. If the indeterminates are searched for in an expression then
the order of the indeterminates is random.

The indeterminates need not be identifiers. Any expression can be used as
an indeterminate as long as it is not rational. Thus, sin(x), f(x) or y^1/3
are all possible valid indeterminates.

Apart from any MuPAD expression, remainder classes of integers and domains
are also permitted as coefficient rings.

  o  The identifier Expr means that any expressions can be used as coefficients.

  o  An expression of the form IntMod(n) stands for the remainder class
     ring Z  /nZ  , whereby a symmetrical representation is used.  In this
     expression IntMod is only a dummy and n must be an integer greater
     than 1.

  o  A domain (Typ DOM_DOMAIN) means that only elements of this
     domain are permitted as coefficients.

A polynomial is only then in normal form when its coefficients are in normal
form, i.e. when the 0 is unambiguously represented.

If the coefficient ring is a domain then this domain must contain certain
entries:

  o  The entry zero must contain the element of the domain that represents
     the 0 (the neutral element in respect to addition).

  o  The entry one must contain the element that represents the 1 (the
     neutral element in respect to multiplication).

  o  The method _plus must add two domain elements.

  o  The method negate must negate a domain element (i.e. calculate the
     inverse in respect to addition).

  o  The method _mult must multiply two domain elements.

  o  The method _power must calculate the integer power of a domain element.
     The first argument is the domain element, the second argument is an
     integer.

Furthermore, the following methods can be useful. They are necessary for the
converting of polynomials with poly and by the functions gcd, diff, divide
and norm:

  o  The method diff must differentiate a domain element with respect to
     a variable.

  o  The method gcd must return the greatest common divisor of any number
     of domain elements.

  o  The method intmult must calculate the integer multiple of a domain
     element.

  o  The method divex must divide two domain elements. If division cannot
     be carried out then the method must return FAIL

  o  The method norm must calculate the norm of a domain element and
     return it as a number.

  o  The method convert must convert an expression into a domain element.
     If this is not possible then the method must return FAIL.

  o  The method expr must convert a domain element into an expression.

If the coefficient ring of a polynomial is a domain then convert is used by
poly to convert an expression into a coefficient. If the method convert does
not exist then only domain elements can be used as coefficients.

If a polynomial over a domain is to be converted into a polynomial over the
coefficient ring Expr with poly then the method expr is used to convert the

coefficients into expressions.  If the method expr does not exist then the
domain elements are simply inserted in the expression.

poly is a kernel function.

>>  poly(2*x*(x+1)^2);

      poly(2*x^3 + 4*x^2 + 2*x, [x])

>>  poly((x*(y+1))^2, [x,y]);

      poly(x^2*y^2 + 2*x^2*y + x^2, [x,y])

>>  poly((x*(y+1))^2, [x]);

      poly((y+1)^2 * x^2, [x])

>>  poly(f(x)*(f(x)+x^2));

      poly(f(x)^2 + f(x)*x^2, [f(x),x])

>>  poly(9*x^3+4*x-7, [x], IntMod(7));

      poly(2*x^3 - 3*x, [x], IntMod(7))

>>  p := poly(((a+b)*x-a^2)*x, [x]);
    poly(p, [a,b]);

      poly((a+b)*x^2 - a^2*x, [x]),
      poly(-x*a^2 + x^2*a + x^2*b, [a,b])

>>  p := poly(-4*x+5*y-5, [x,y], IntMod(7));
    poly(p, IntMod(3));

      poly(3*x - 2*y + 2, [x,y], IntMod(7)),
      poly(y - 1, [x,y], IntMod(3))

See also:  coeff , expr, indets , nterms , nthcoeff , nthmonomial , nthterm


