nterms

Number of terms of a polynomial

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

nterms(p)
nterms(f, <vars>)

Description

nterms(p) returns the number of terms of the polynomial p.

If the first argument 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.

A zero polynomial has no terms: the return value is 0.

Examples

Example 1

We give some self explaining examples:

nterms(x^2*y^2 + x^2 + y + 2, [x, y])

nterms(poly(x^2*y^2 + x^2 + y + 2))

nterms(poly(0, [x]))

Example 2

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])

delete f:

Parameters

p

A polynomial of type DOM_POLY

f

A polynomial expression

vars

A list of indeterminates of the polynomial: typically, identifiers or indexed identifiers

Return Values

Nonnegative number. FAIL is returned if the input cannot be converted to a polynomial.

Overloaded By

p

Was this topic helpful?