Leading coefficient of a polynomial: lcoeff

### 5.27.10 Leading coefficient of a polynomial: lcoeff

The lcoeff command finds the leading coefficient of a polynomial; that is, the coefficient of the monomial of highest degree.

- lcoeff takes one mandatory argument and one optional argument:
  - P, a polynomial given by a symbolic expression or by its list of coefficients.
  - Optionally, x, a variable name (by default x).
- lcoeff(P ⟨ ,x⟩) returns the leading coefficient of P.

#### Examples

- Input:
  lcoeff([2,1,-1,0])
  Output:

  2

- Input:
  lcoeff(3*x^2+5*x,x)
  Output:

  3

- Input:
  lcoeff(3*x^2+5*x*y^2,y)
  Output:

  5 x