This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


The Gegenbauer (ultraspherical) polynomials

MuPAD® notebooks are not recommended. 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.


orthpoly::gegenbauer(n, a, x)


orthpoly::gegenbauer(n,a,x) computes the value of the n-th degree Gegenbauer polynomial with parameter a at the point x.

Evaluation for real floating-point values x from the interval [- 1.0, 1.0] is numerically stable. See Example 2.


Example 1

Polynomial expressions are returned, if identifiers or indexed identifiers are specified:

orthpoly::gegenbauer(2, a, x)

orthpoly::gegenbauer(3, 2, x[1])

Using arithmetical expressions as input, the “values” of these polynomials are returned:

orthpoly::gegenbauer(2, 1, 3+2*I)

orthpoly::gegenbauer(3, 2, exp(x[1] + 2))

“Arithmetical expressions” include numbers:

orthpoly::gegenbauer(2, a, sqrt(2)), 
orthpoly::gegenbauer(3, 0.4, 8 + I),
orthpoly::gegenbauer(1000, -1/3, 0.3)

If the degree of the polynomial is a variable or expression, then orthpoly::gegenbauer returns itself symbolically:

orthpoly::gegenbauer(n, a, x)

Example 2

If a floating-point value is desired, then a direct call such as

orthpoly::gegenbauer(200, 4, 0.3)

is appropriate and yields a correct result. One should not evaluate the symbolic polynomial at a floating-point value, because this may be numerically unstable:

G200 := orthpoly::gegenbauer(200, 4, x):
DIGITS := 10: evalp(G200, x = 0.3)

This result is caused by numerical round-off. Also with increased DIGITS only a few leading digits are correct:

DIGITS := 20: evalp(G200, x = 0.3)

delete DIGITS, G200:



A nonnegative integer or an arithmetical expression representing a nonnegative integer: the degree of the polynomial.


An arithmetical expression.


An indeterminate or an arithmetical expression. An indeterminate is either an identifier (of domain type DOM_IDENT) or an indexed identifier (of type "_index").

Return Values

The value of the Gegenbauer polynomial at point x is returned as an arithmetical expression. If n is an arithmetical expression, then orthpoly::gegenbauer returns itself symbolically.


The Gegenbauer polynomials are given by the recursion formula

with G(0, a, x) = 1, G(1, a, x) = 2 ax.

For fixed real these polynomials are orthogonal on the interval [- 1, 1] with respect to the weight function .

coincides with the Legendre polynomial P(n, x).

G(n, 1, x) coincides with the Chebyshev polynomial U(n, x) of the second kind.

The polynomials G(n, 0, x) are trivial.

See Also

MuPAD Functions

Was this topic helpful?