coeff
extract a coefficient of a polynomial
Calling Sequence
Parameters
Description
Thread Safety
Examples
coeff(p, x)
coeff(p, x, n)
coeff(p, x^n)
p
-
polynomial in x
x
variable (expression)
n
(optional) integer
The coeff function extracts the coefficient of x^n in the polynomial p.
If the third argument is omitted, it is determined by looking at the second argument. Thus coeff(p, x^n) is equivalent to coeff(p, x, n) for n <> 0.
The cases of the second argument being a number or a product are disallowed since they do not make sense.
The related functions lcoeff, tcoeff, and coeffs extract the leading coefficient, trailing coefficient and all the coefficients of p in x respectively.
The coeff command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
p≔2⁢x2+3⁢y3−5:
coeff(p, x^n) is equivalent to coeff(p, x, n) for n<>0.
coeff⁡p,x,2
2
coeff⁡p,x2
To find the constant term of the equation, let the exponent of x be zero.
coeff⁡p,x,0
3⁢y3−5
The command coeff works with any variable.
coeff⁡p,y3
3
However, the following form is not allowed:
r≔x2+4⁢x−6⁢x⁢y+9
r≔x2−6⁢x⁢y+4⁢x+9
coeff⁡r,x⁢y
Error, invalid input: coeff received x*y, which is not valid for its 2nd argument, x
A more difficult example: the polynomial does not need to be expanded for coeff(p, x^n) to work.
q≔3⁢a⁢x+12+sin⁡a⁢x2⁢y−y2⁢x+x−a
coeff⁡q,x
−y2+6⁢a+1
expand⁡q
3⁢a⁢x2+6⁢a⁢x+2⁢a+sin⁡a⁢x2⁢y−y2⁢x+x
See Also
coeffs
coeftayl
lcoeff
PolynomialTools[CoefficientVector]
sort
tcoeff
Download Help Document