
coeff - returns the coefficients of a polynomial

Calling sequence:
coeff(poly [ [ , expr_2 ]  , integer ])
coeff(expr [ , indets ]  [ [ , expr_2 ]  , integer ])
indets  ---> [ expr_1 ...]

Parameter:
poly                    --  polynomial
expr, expr_1, expr_2    --  expressions
integer                 --  non-negative integer

Overloading:

1

Summary:

coeff returns the coefficients of a polynomial. There are three different forms
of the call of coeff:

 o  coeff(p) returns a sequence with all coefficients of the polynomial p.
    The coefficients are ordered according to the lexicographical ordering of
    the terms.

  o  coeff(p,x,n) returns the coefficient of the term with the factor x^n,
     where p is understood as a univariate polynomial in the variable x (x
     must naturally be a variable of the polynomial p). If a polynomial has
     more than one variable then the result is a polynomial in the remaining

     variables.

  o  coeff(p,n) also returns the coefficient of the terms with the factor x^n.
     Here, x is the "main variable\ (i.e. x is the first element in the list of
     the variables of the polynomial).

The first argument of coeff is allowed to be a polynomial or an expression
and optionally a listof indeterminates.  An expression is converted into a
polynomial in the specified indeterminates (see function poly). coeff returns
FAIL if the expression cannot be converted into a polynomial.

If the first argument of coeff is a multivariate polynomial and the result a
single coefficient then this coefficient -- as described above -- is a polynomial
in the remaining variables.  If the first argument is an expression then the
result is returned as an expression. coeff is a kernel function.

>>  coeff(3*x^3+x^2*y^2+2, [x,y]);

      3, 1, 2

>>  p := poly(3*x^3+x^2*y^2+2, [x,y]): coeff(p, y, 2);

      poly(x^2, [x])

>>  coeff(3*x^3+x^2*y^2+2, [x,y], y, 0);

      3*x^3 + 2

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

      0

>>  coeff(3*x^3+x^2*y^2+2, [x,y], 2);

      y^2

See also:  lcoeff , nterms , nthcoeff , poly, tcoeff

