nterms -- the number of terms of
a polynomial
Introductionnterms(p) returns the number of terms of
the polynomial p.
Call(s)nterms(p)
nterms(f <, vars>)
Parametersp |
- | a polynomial of type
DOM_POLY |
f |
- | a polynomial expression |
vars |
- | a list of indeterminates of the polynomial: typically, identifiers or indexed identifiers |
Returnsa nonnegative number. FAIL is returned if the input cannot be
converted to a polynomial.
p
Related
Functionscoeff, degree, degreevec, ground, lcoeff, ldegree, lmonomial, lterm, nthcoeff, nthmonomial, nthterm, poly, poly2list, tcoeff
Detailsf 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.
Example
1We 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
Example
2The 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: