nterms
-- the number of terms of
a polynomialnterms(
p)
returns the number of terms of
the polynomial p
.
nterms(p)
nterms(f <, vars>)
p |
- | a polynomial of type
DOM_POLY |
f |
- | a polynomial expression |
vars |
- | a list of indeterminates of the polynomial: typically, identifiers or indexed identifiers |
a nonnegative number. FAIL
is returned if the input cannot be
converted to a polynomial.
p
coeff
, degree
, degreevec
, ground
, lcoeff
, ldegree
, lmonomial
, lterm
, nthcoeff
, nthmonomial
, nthterm
, poly
, poly2list
, tcoeff
f
is not element of a polynomial
domain, then nterms
converts the expression to a
polynomial via poly
(f)
. If a list of
indeterminates is specified, then the polynomial poly
(f, vars)
is
considered.nterms
is a function of the system kernel.We give some self explaining examples:
>> nterms(x^2*y^2 + x^2 + y + 2, [x, y])
4
>> nterms(poly(x^2*y^2 + x^2 + y + 2))
4
>> nterms(poly(0, [x]))
0
The following polynomial expression may be regarded as a polynomial in different ways:
>> f := x^2*y^2 + x^2 + y + 2: nterms(f, [x]), nterms(f, [y]), nterms(f, [x, y]), nterms(f, [z])
2, 3, 4, 1
>> delete f: