Main Content

gegenbauerC

Gegenbauer polynomials

Description

example

gegenbauerC(n,a,x)represents thenth-degreeGegenbauer (ultraspherical) polynomialwith parameteraat the pointx.

Examples

First Four Gegenbauer Polynomials

找到的前四Gegenbauer多项式parameteraand variablex.

syms a x gegenbauerC([0, 1, 2, 3], a, x)
ans = [ 1, 2*a*x, (2*a^2 + 2*a)*x^2 - a,... ((4*a^3)/3 + 4*a^2 + (8*a)/3)*x^3 + (- 2*a^2 - 2*a)*x]

Gegenbauer Polynomials for Numeric and Symbolic Arguments

Depending on its arguments,gegenbauerCreturns floating-point or exact symbolic results.

Find the value of the fifth-degree Gegenbauer polynomial for the parametera = 1/3at these points. Because these numbers are not symbolic objects,gegenbauerCreturns floating-point results.

gegenbauerC(5, 1/3, [1/6, 1/4, 1/3, 1/2, 2/3, 3/4])
ans = 0.1520 0.1911 0.1914 0.0672 -0.1483 -0.2188

Find the value of the fifth-degree Gegenbauer polynomial for the same numbers converted to symbolic objects. For symbolic numbers,gegenbauerCreturns exact symbolic results.

gegenbauerC(5, 1/3, sym([1/6, 1/4, 1/3, 1/2, 2/3, 3/4]))
ans = [ 26929/177147, 4459/23328, 33908/177147, 49/729, -26264/177147, -7/32]

Evaluate Chebyshev Polynomials with Floating-Point Numbers

Floating-point evaluation of Gegenbauer polynomials by direct calls ofgegenbauerCis numerically stable. However, first computing the polynomial using a symbolic variable, and then substituting variable-precision values into this expression can be numerically unstable.

Find the value of the 500th-degree Gegenbauer polynomial for the parameter4at1/3andvpa(1/3). Floating-point evaluation is numerically stable.

gegenbauerC(500, 4, 1/3) gegenbauerC(500, 4, vpa(1/3))
ans = -1.9161e+05 ans = -191609.10250897532784888518393655

Now, find the symbolic polynomialC500 = gegenbauerC(500, 4, x), and substitutex = vpa(1/3)into the result. This approach is numerically unstable.

syms x C500 = gegenbauerC(500, 4, x); subs(C500, x, vpa(1/3))
ans = -8.0178726380235741521208852037291e+35

Approximate the polynomial coefficients by usingvpa, and then substitutex = sym(1/3)into the result. This approach is also numerically unstable.

subs(vpa(C500), x, sym(1/3))
ans = -8.1125412405858470246887213923167e+36

Plot Gegenbauer Polynomials

Plot the first five Gegenbauer polynomials for the parametera = 3.

symsxyfplot(gegenbauerC(0:4,3,x)) axis([-1 1 -10 10]) gridonylabel('G_n^3(x)') title('Gegenbauer polynomials') legend('G_0^3(x)','G_1^3(x)','G_2^3(x)','G_3^3(x)','G_4^3(x)',...'Location','Best')

Figure contains an axes object. The axes object with title Gegenbauer polynomials contains 5 objects of type functionline. These objects represent G_0^3(x), G_1^3(x), G_2^3(x), G_3^3(x), G_4^3(x).

Input Arguments

collapse all

Degree of the polynomial, specified as a nonnegative integer, symbolic variable, expression, or function, or as a vector or matrix of numbers, symbolic numbers, variables, expressions, or functions.

Parameter, specified as a nonnegative integer, symbolic variable, expression, or function, or as a vector or matrix of numbers, symbolic numbers, variables, expressions, or functions.

Evaluation point, specified as a number, symbolic number, variable, expression, or function, or as a vector or matrix of numbers, symbolic numbers, variables, expressions, or functions.

More About

collapse all

Gegenbauer Polynomials

  • Gegenbauer polynomials are defined by this recursion formula.

    G ( 0 , a , x ) = 1 , G ( 1 , a , x ) = 2 a x , G ( n , a , x ) = 2 x ( n + a 1 ) n G ( n 1 , a , x ) n + 2 a 2 n G ( n 2 , a , x )

  • For all reala> -1/2, Gegenbauer polynomials are orthogonal on the interval-1 ≤x≤ 1with respect to the weight function w ( x ) = ( 1 x 2 ) a 1 2 .

    1 1 G ( n , a , x ) G ( m , a , x ) ( 1 x 2 ) a 1 / 2 d x = { 0 if n m π 2 1 2 a Γ ( n + 2 a ) n ! ( n + a ) ( Γ ( a ) ) 2 if n = m .

  • Chebyshev polynomials of the first and second kinds are special cases of the Gegenbauer polynomials.

    T ( n , x ) = { 1 2 lim a 0 n + a a G ( n , a , x ) if n 0 lim a 0 G ( 0 , a , x ) = 1 if n = 0

    U ( n , x ) = G ( n , 1 , x )

  • Legendre polynomials are also a special case of the Gegenbauer polynomials.

    P ( n , x ) = G ( n , 1 2 , x )

Tips

  • gegenbauerCreturns floating-point results for numeric arguments that are not symbolic objects.

  • gegenbauerCacts element-wise on nonscalar inputs.

  • All nonscalar arguments must have the same size. If one or two input arguments are nonscalar, thengegenbauerCexpands the scalars into vectors or matrices of the same size as the nonscalar arguments, with all elements equal to the corresponding scalar.

References

[1] Hochstrasser, U. W. “Orthogonal Polynomials.”手册的数学函数公式,Graphs, and Mathematical Tables.(M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.

[2] Cohl, Howard S., and Connor MacKenzie. “Generalizations and Specializations of Generating Functions for Jacobi, Gegenbauer, Chebyshev and Legendre Polynomials with Definite Integrals.”Journal of Classical Analysis, no. 1 (2013): 17–33. https://doi.org/10.7153/jca-03-02.

Version History

Introduced in R2014b