## `orthpoly::chebyshev2` -- the Chebyshev polynomials of the second kind

#### Introduction

`orthpoly::chebyshev2``(n,x)` computes the value of the n-th degree Chebyshev polynomial of the second kind at the point x.

#### Call(s)

`orthpoly::chebyshev2(n, x)`

#### Parameters

`n` | - | a nonnegative integer: the degree of the polynomial.
`x` | - | an indeterminate or an arithmetical expression. An indeterminate is either an identifier (of domain type `DOM_IDENT`) or an indexed identifier (of type `"_index"`).

#### Returns

If `x` is an indeterminate, then a polynomial of domain type `DOM_POLY` is returned. If `x` is an arithmetical expression, then the value of the Chebyshev polynomial at this point is returned as an arithmetical expression. If `n` is not a nonnegative integer, then `orthpoly::chebyshev2` returns itself symbolically.

#### Related Functions

`orthpoly::chebyshev1`, `orthpoly::gegenbauer`, `orthpoly::jacobi`

#### Details

- These polynomials have integer coefficients.
- Evaluation is fast and numerically stable for real floating point values x from the interval [-1.0,1.0]. Cf. example 2.
- `orthpoly::chebyshev1` implements the Chebyshev polynomials of the first kind.

#### Example 1

Polynomials of domain type `DOM_POLY` are returned, if identifiers or indexed identifiers are specified:

    >> orthpoly::chebyshev2(2, x)

                                        2
                                poly(4 x  - 1, [x])

    >> orthpoly::chebyshev2(3, x[1])

                                     3
                          poly(8 x[1]  - 4 x[1], [x[1]])

However, using arithmetical expressions as input the ``values'' of these polynomials are returned:

    >> orthpoly::chebyshev2(2, 6*x)

                                         2
                                    144 x  - 1

    >> orthpoly::chebyshev2(3, x[1] + 2)

                                                    2
                        2 (2 x[1] + 4) (2 (x[1] + 2)  - 1)

``Arithmetical expressions'' include numbers:

    >> orthpoly::chebyshev2(2, sqrt(2)),
       orthpoly::chebyshev2(3, 8 + I),
       orthpoly::chebyshev2(1000, 0.3)

                          7, 3872 + 1524 I, -1.012277265

If no integer degree is specified, then `orthpoly::chebyshev2` returns itself symbolically:

    >> orthpoly::chebyshev2(n, x), orthpoly::chebyshev2(1/2, x)

             orthpoly::chebyshev2(n, x), orthpoly::chebyshev2(1/2, x)

#### Example 2

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

    >> orthpoly::chebyshev2(200, 0.3)

                                  -0.01869337443

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:

    >> U200 := orthpoly::chebyshev2(200, x):

    >> DIGITS := 10: evalp(U200, x = 0.3)

                                    437298.8655

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

    >> DIGITS := 20: evalp(U200, x = 0.3)

                              -0.01865010149206721612

    >> delete DIGITS, U200:

#### Background

- The Chebyshev polynomials of the second kind are given by

      U(n,x)=sin((n+1)*arccos(x))/sin(arccos(x))

  for real x in [-1,1]. This representation is used by `orthpoly::chebyshev2` for floating point values in this range.
- These polynomials satisfy the recursion formula

      U(n,x) = 2*x*U(n-1,x) - U(n-2,x)

  with U(0,x)=1 and U(1,x)=2*x.
- They are orthogonal on the interval [-1,1] with respect to the weight function w(x)=(1-x^2)^(1/2).
- U(n,x) coincides with the Gegenbauer polynomial G(n,1,x).
- U(n,x) is a special Jacobi polynomial:

      U(n,x) = 2^(2*n)*n!*(n+1)!/(2*n+1)!*P(n,1/2,1/2,x).

#### Changes

- Indexed identifiers are now regarded as indeterminates. Non-integer degrees n are now accepted, leading to an unevaluated function call. Floating point evaluations are now numerically stable. Efficiency was improved.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000