# CHEBYSHEV_POLYNOMIAL Chebyshev Polynomials

CHEBYSHEV_POLYNOMIAL is a C++ library which considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x). Functions are provided to evaluate the polynomials, determine their zeros, produce their polynomial coefficients, produce related quadrature rules, project other functions onto these polynomial bases, and integrate double and triple products of the polynomials.

The Chebyshev polynomial T(n,x), or Chebyshev polynomial of the first kind, may be defined, for 0 <= n, and -1 <= x <= +1 by:

```        cos ( t ) = x
T(n,x) = cos ( n * t )
```
For any value of x, T(n,x) may be evaluated by a three term recurrence:
```        T(0,x) = 1
T(1,x) = x
T(n+1,x) = 2x T(n,x) - T(n-1,x)
```

The Chebyshev polynomial U(n,x), or Chebyshev polynomial of the second kind, may be defined, for 0 <= n, and -1 <= x <= +1 by:

```        cos ( t ) = x
U(n,x) = sin ( ( n + 1 ) t ) / sin ( t )
```
For any value of x, U(n,x) may be evaluated by a three term recurrence:
```        U(0,x) = 1
U(1,x) = 2x
U(n+1,x) = 2x U(n,x) - U(n-1,x)
```

The Chebyshev polynomial V(n,x), or Chebyshev polynomial of the third kind, may be defined, for 0 <= n, and -1 <= x <= +1 by:

```        cos ( t ) = x
V(n,x) = cos ( (2n+1)*t/2) / cos ( t/2)
```
For any value of x, V(n,x) may be evaluated by a three term recurrence:
```        V(0,x) = 1
V(1,x) = 2x-1
V(n+1,x) = 2x V(n,x) - V(n-1,x)
```

The Chebyshev polynomial W(n,x), or Chebyshev polynomial of the fourth kind, may be defined, for 0 <= n, and -1 <= x <= +1 by:

```        cos ( t ) = x
W(n,x) = sin((2*n+1)*t/2)/sin(t/2)
```
For any value of x, W(n,x) may be evaluated by a three term recurrence:
```        W(0,x) = 1
W(1,x) = 2x+1
W(n+1,x) = 2x W(n,x) - W(n-1,x)
```

### Languages:

CHEBYSHEV_POLYNOMIAL is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version and a Python version.

### Related Data and Programs:

BERNSTEIN_POLYNOMIAL, a C++ library which evaluates the Bernstein polynomials, useful for uniform approximation of functions;

CHEBYSHEV, a C++ library which computes the Chebyshev interpolant/approximant to a given function over an interval.

CHEBYSHEV_SERIES, a C++ library which can evaluate a Chebyshev series approximating a function f(x), while efficiently computing one, two or three derivatives of the series, which approximate f'(x), f''(x), and f'''(x), by Manfred Zimmer.

CHEBYSHEV1_RULE, a C++ program which computes and prints a Gauss-Chebyshev type 1 quadrature rule.

CHEBYSHEV2_RULE, a C++ program which compute and print a Gauss-Chebyshev type 2 quadrature rule.

CLAUSEN, a C++ library which evaluates a Chebyshev interpolant to the Clausen function Cl2(x).

GEGENBAUER_POLYNOMIAL, a C++ library which evaluates the Gegenbauer polynomial and associated functions.

HERMITE_POLYNOMIAL, a C++ library which evaluates the physicist's Hermite polynomial, the probabilist's Hermite polynomial, the Hermite function, and related functions.

INT_EXACTNESS_CHEBYSHEV1, a C++ program which tests the polynomial exactness of Gauss-Chebyshev type 1 quadrature rules.

INT_EXACTNESS_CHEBYSHEV2, a C++ program which tests the polynomial exactness of Gauss-Chebyshev type 2 quadrature rules.

JACOBI_POLYNOMIAL, a C++ library which evaluates the Jacobi polynomial and associated functions.

LAGUERRE_POLYNOMIAL, a C++ library which evaluates the Laguerre polynomial, the generalized Laguerre polynomial, and the Laguerre function.

LEGENDRE_POLYNOMIAL, a C++ library which evaluates the Legendre polynomial and associated functions.

LEGENDRE_SHIFTED_POLYNOMIAL, a C++ library which evaluates the shifted Legendre polynomial, with domain [0,1].

JACOBI_POLYNOMIAL, a C++ library which evaluates the Jacobi polynomial and associated functions.

LAGUERRE_POLYNOMIAL, a C++ library which evaluates the Laguerre polynomial, the generalized Laguerre polynomial, and the Laguerre function.

LEGENDRE_POLYNOMIAL, a C++ library which evaluates the Legendre polynomial and associated functions.

LEGENDRE_SHIFTED_POLYNOMIAL, a C++ library which evaluates the shifted Legendre polynomial, with domain [0,1].

LOBATTO_POLYNOMIAL, a C++ library which evaluates Lobatto polynomials, similar to Legendre polynomials except that they are zero at both endpoints.

POLPAK, a C++ library which evaluates a variety of mathematical functions.

TEST_VALUES, a C++ library which supplies test values of various mathematical functions.

### Reference:

1. Theodore Chihara,
An Introduction to Orthogonal Polynomials,
Gordon and Breach, 1978,
ISBN: 0677041500,
LC: QA404.5 C44.
2. Walter Gautschi,
Orthogonal Polynomials: Computation and Approximation,
Oxford, 2004,
ISBN: 0-19-850672-4,
LC: QA404.5 G3555.
3. John Mason, David Handscomb,
Chebyshev Polynomials,
CRC Press, 2002,
ISBN: 0-8493-035509,
LC: QA404.5.M37.
4. Frank Olver, Daniel Lozier, Ronald Boisvert, Charles Clark,
NIST Handbook of Mathematical Functions,
Cambridge University Press, 2010,
ISBN: 978-0521192255,
LC: QA331.N57.
5. Gabor Szego,
Orthogonal Polynomials,
American Mathematical Society, 1992,
ISBN: 0821810235,
LC: QA3.A5.v23.

### List of Routines:

• DAXPY computes constant times a vector plus a vector.
• DDOT forms the dot product of two vectors.
• DNRM2 returns the euclidean norm of a vector.
• DROT applies a plane rotation.
• DROTG constructs a Givens plane rotation.
• DSCAL scales a vector by a constant.
• DSVDC computes the singular value decomposition of a real rectangular matrix.
• DSWAP interchanges two vectors.
• I4_MAX returns the maximum of two I4's.
• I4_MIN returns the minimum of two I4's.
• I4_TO_STRING converts an I4 to a C++ string.
• I4_UNIFORM_AB returns a scaled pseudorandom I4 between A and B.
• I4VEC_MAX returns the value of the maximum element in an I4VEC.
• IMTQLX diagonalizes a symmetric tridiagonal matrix.
• R8_CHOOSE computes the binomial coefficient C(N,K) as an R8.
• R8_EPSILON returns the R8 roundoff unit.
• R8_FACTORIAL computes the factorial of N.
• R8_HYPER_2F1 evaluates the hypergeometric function F(A,B,C,X).
• R8_MAX returns the maximum of two R8's.
• R8_MOP returns the I-th power of -1 as an R8 value.
• R8_PSI evaluates the function Psi(X).
• R8_SIGN returns the sign of an R8.
• R8_UNIFORM_AB returns a scaled pseudorandom R8.
• R8MAT_COPY_NEW copies one R8MAT to a "new" R8MAT.
• R8MAT_MM_NEW multiplies two matrices.
• R8MAT_MTV_NEW multiplies a transposed matrix times a vector.
• R8MAT_MV_NEW multiplies a matrix times a vector.
• R8MAT_PRINT prints an R8MAT.
• R8MAT_PRINT_SOME prints some of an R8MAT.
• R8POLY_PRINT prints out a polynomial.
• R8VEC_DOT_PRODUCT computes the dot product of a pair of R8VEC's.
• R8VEC_IN_AB is TRUE if the entries of an R8VEC are in the range [A,B].
• R8VEC_LINSPACE_NEW creates a vector of linearly spaced values.
• R8VEC_MAX returns the value of the maximum element in an R8VEC.
• R8VEC_PRINT prints an R8VEC.
• R8VEC_UNIFORM_01_NEW returns a new unit pseudorandom R8VEC.
• R8VEC_UNIFORM_AB_NEW returns a scaled pseudorandom R8VEC.
• R8VEC2_PRINT prints an R8VEC2.
• SVD_SOLVE solves a linear system in the least squares sense.
• T_MASS_MATRIX computes the mass matrix for the Chebyshev T polynomial.
• T_MOMENT: integral ( -1 <= x <= +1 ) x^e dx / sqrt ( 1 - x^2 ).
• T_POLYNOMIAL evaluates Chebyshev polynomials T(n,x).
• T_POLYNOMIAL_01_VALUES: values of shifted Chebyshev polynomials T01(n,x).
• T_POLYNOMIAL_AB: Chebyshev polynomials TAB(n,x) in [A,B].
• T_POLYNOMIAL_AB_VALUE: Chebyshev polynomial TAB(n,x) in [A,B].
• T_POLYNOMIAL_COEFFICIENTS: coefficients of the Chebyshev polynomial T(n,x).
• T_POLYNOMIAL_PLOT plots Chebyshev polynomials T(n,x).
• T_POLYNOMIAL_VALUE: returns the single value T(n,x).
• T_POLYNOMIAL_VALUES returns values of the Chebyshev polynomial T(n,x).
• T_POLYNOMIAL_ZEROS returns zeroes of the Chebyshev polynomial T(n,x).
• T_PROJECT_COEFFICIENTS: function projected onto Chebyshev polynomials T(n,x).
• T_PROJECT_COEFFICIENTS_AB: function projected onto TAB(n,x) over [a,b]
• T_PROJECT_COEFFICIENTS_DATA: project data onto Chebyshev polynomials T(n,x).
• T_PROJECT_VALUE evaluates an expansion in Chebyshev polynomials T(n,x).
• T_PROJECT_VALUE_AB evaluates an expansion in Chebyshev polynomials TAB(n,x).
• TIMESTAMP prints the current YMDHMS date as a time stamp.
• TT_PRODUCT: evaluate T(i,x)*T(j,x)
• TT_PRODUCT_INTEGRAL: integral (-1<=x<=1) T(i,x)*T(j,x)/sqrt(1-x^2) dx
• TTT_PRODUCT_INTEGRAL: integral (-1<=x<=1) T(i,x)*T(j,x)*T(k,x)/sqrt(1-x^2) dx
• TU_PRODUCT: evaluate T(i,x)*U(j,x)
• U_MASS_MATRIX computes the mass matrix for the Chebyshev U polynomial.
• U_MOMENT: integral ( -1 <= x <= +1 ) x^e sqrt ( 1 - x^2 ) dx.
• U_POLYNOMIAL evaluates Chebyshev polynomials U(n,x).
• U_POLYNOMIAL_01_VALUES: values of shifted Chebyshev polynomials U01(n,x).
• U_POLYNOMIAL_AB: Chebyshev polynomials UAB(n,x) in [A,B].
• U_POLYNOMIAL_AB_VALUE: Chebyshev polynomial UAB(n,x) in [A,B].
• U_POLYNOMIAL_COEFFICIENTS evaluates coefficients of Chebyshev polynomials U(n,x).
• U_POLYNOMIAL_PLOT plots Chebyshev polynomials U(n,x).
• U_POLYNOMIAL_VALUE: returns the single value U(n,x).
• U_POLYNOMIAL_VALUES returns values of Chebyshev polynomials U(n,x).
• U_POLYNOMIAL_ZEROS returns zeroes of Chebyshev polynomials U(n,x).
• UU_PRODUCT: evaluate U(i,x)*U(j,x)
• UU_PRODUCT_INTEGRAL: integral (-1<=x<=1) U(i,x)*U(j,x)*sqrt(1-x^2) dx
• V_MASS_MATRIX computes the mass matrix for the Chebyshev V polynomial.
• V_MOMENT: integral ( -1 <= x <= +1 ) x^e sqrt(1+x) / sqrt(1-x) dx.
• V_POLYNOMIAL evaluates Chebyshev polynomials V(n,x).
• V_POLYNOMIAL_01_VALUES: values of shifted Chebyshev polynomials V01(n,x).
• V_POLYNOMIAL_AB: Chebyshev polynomials VAB(n,x) in [A,B].
• V_POLYNOMIAL_AB_VALUE: Chebyshev polynomial VAB(n,x) in [A,B].
• V_POLYNOMIAL_COEFFICIENTS: coefficients of the Chebyshev polynomial V(n,x).
• V_POLYNOMIAL_PLOT plots Chebyshev polynomials V(n,x).
• V_POLYNOMIAL_VALUE: returns the single value V(n,x).
• V_POLYNOMIAL_VALUES returns values of Chebyshev polynomials V(n,x).
• V_POLYNOMIAL_ZEROS returns zeroes of the Chebyshev polynomial V(n,x).
• VV_PRODUCT_INTEGRAL: integral (-1<=x<=1) V(i,x)*V(j,x)*sqrt(1+x)/sqrt(1-x) dx
• W_MASS_MATRIX computes the mass matrix for the Chebyshev W polynomial.
• W_MOMENT: integral ( -1 <= x <= +1 ) x^e sqrt(1-x) / sqrt(1+x) dx.
• W_POLYNOMIAL evaluates Chebyshev polynomials W(n,x).
• W_POLYNOMIAL_01_VALUES: values of shifted Chebyshev polynomials W01(n,x).
• W_POLYNOMIAL_AB: Chebyshev polynomials WAB(n,x) in [A,B].
• W_POLYNOMIAL_AB_VALUE: Chebyshev polynomial WAB(n,x) in [A,B].
• W_POLYNOMIAL_COEFFICIENTS: coefficients of the Chebyshev polynomial W(n,x).
• W_POLYNOMIAL_PLOT plots Chebyshev polynomials W(n,x).
• W_POLYNOMIAL_VALUE: returns the single value W(n,x).
• W_POLYNOMIAL_VALUES returns values of Chebyshev polynomials W(n,x).
• W_POLYNOMIAL_ZEROS returns zeroes of the Chebyshev polynomial W(n,x).