N-th non-zero coefficient of a polynomial
MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
nthcoeff(p, n) returns the
non-zero coefficient of the polynomial
nthcoeff returns the
non-zero coefficient with respect to the lexicographical ordering.
A zero polynomial has no terms:
A polynomial expression
f is first converted
to a polynomial with the variables given by
If no variables are given, they are searched for in
details of the conversion.
FAIL is returned if
be converted to a polynomial.
We give some self explaining examples:
p := poly(100*x^100 + 49*x^49 + 7*x^7, [x]): nthcoeff(p, 1), nthcoeff(p, 2), nthcoeff(p, 3)
nthcoeff(poly(0, [x]), 1)
We demonstrate the evaluation strategy of
p := poly(3*x^3 + 6*x^2*y^2 + 2, [x]): y := 4: nthcoeff(p, 2)
Evaluation is enforced by
delete p, y:
A positive integer
Element of the coefficient domain of the polynomial. An expression
is returned if a polynomial expression is given as input.
n is larger than the actual number