Chebyshev Polynomials in Mathematica

Sergey Fomel   02/26/2002

Polynomial Shape

The first three polynomials

MatrixForm[Table[ChebyshevT[n, x], {n, 0, 2}]]

plotcheb[n_] := 
      Plot[ChebyshevT[n, x], {x, -1, 1}, 
        PlotStyle -> {Thickness[0.01]}, Frame -> True, 
        DisplayFunction -> Identity, 
        AspectRatio -> Automatic]

Show[Table[plotcheb[n], {n, 0, 2}], 
        DisplayFunction -> $DisplayFunction];

The next six polynomials

MatrixForm[Table[ChebyshevT[n, x], {n, 3, 8}]]

Show[Table[plotcheb[n], {n, 3, 8}], 
        DisplayFunction -> $DisplayFunction];

The extremum points alternate between -1 and 1.

Zeros of the Chebyshev polynomials

Polynomial of degree 21:

Plot[Sqrt[1 - x^2], {x, -1, 1}, 
        PlotStyle -> Thickness[0.01], AspectRatio -> Automatic, 
        Frame -> True, Axes -> None, 
        Epilog -> 
          Flatten[{Table[{Dashing[{0.01}], 
                  Line[{{0, 0}, {Cos[Pi (2  k + 1)/42], 
                        Sin[Pi (2  k + 1)/42]}}]}, {k, 0, 20}], 
              Table[Line[{{Cos[Pi (2  k + 1)/42], 
                      0}, {Cos[Pi (2  k + 1)/42], 
                      Sin[Pi (2  k + 1)/42]}}], {k, 0, 20}]}, 
            1]];

The zeros of Tn(x) are distributed denser near the ends of the interval and sparser in the middle.

Show[plotcheb[21], 
        DisplayFunction -> $DisplayFunction];

Interpolation

In 1901, Runge demonstrated the pitfalls of equidistant polynomial interpolation using the function

f[x_] := 1/(1 + 25 x^2)

Plot[f[x], {x, -1, 1}, Frame -> True, 
        PlotStyle -> Thickness[0.01]];

equix[k_, n_] := -1  +  2 (k - 1)/(n - 1)

eqdist[n_]  :=  
      Interpolation[Table[{equix[k, n], f[equix[k, n]]}, {k, n}], 
        InterpolationOrder -> (n - 1)]

<<  Graphics`Legend`

Interpolation with 21 equidistant (regularly spaced) nodes:

Plot[{f[x], eqdist[21][x]}, {x, -1, 1}, 
        PlotStyle -> {Dashing[{0.01}], Dashing[{0}]}, 
        PlotLegend -> {"True", "Interpolated"}, 
        PlotRange -> All, Frame -> True, Axes -> False, 
        LegendPosition -> {-0.5, -0.25}, 
        PlotLabel -> "Equidistant Interpolation"];

chebx[k_, n_] := Cos[(2  k - 1.0) Pi/(2 n )]

chdist[n_] := 
      Interpolation[Table[{chebx[k, n], f[chebx[k, n]]}, {k, n}], 
        InterpolationOrder -> (n - 1)]

Interpolation with 21 Chebyshev nodes:

Plot[{f[x], chdist[21][x]}, {x, -1, 1}, 
        PlotStyle -> {Dashing[{0.01}], Dashing[{0}]}, 
        PlotLegend -> {"True", "Interpolated"}, 
        PlotRange -> All, Frame -> True, Axes -> False, 
        LegendPosition -> {0.5, 0}, 
        PlotLabel -> "Chebyshev Interpolation"];