Function Repository Resource:

ChebyshevNodes

Source Notebook

Produce Chebyshev nodes

Contributed by: Sander Huisman

ResourceFunction["ChebyshevNodes"][n]

produces n Chebyshev nodes in the range from -1 to 1.

ResourceFunction["ChebyshevNodes"][n,{min,max}]

produces n Chebyshev nodes in the domain min to max.

Details

In numerical analysis, Chebyshev nodes are specific real algebraic numbers, namely the roots of the Chebyshev polynomials of the first kind.
Chebyshev nodes are often used as nodes in polynomial interpolation because the resulting interpolation polynomial minimizes the effect of Runge's phenomenon.
Chebyshev nodes are also used to generate grids for numerical simulations with superior robustness to Runge's phenomenon.

Examples

Basic Examples (2) 

Create ten Chebyshev nodes analytically:

In[1]:=
ResourceFunction["ChebyshevNodes"][10]
Out[1]=

Approximate the numbers:

In[2]:=
N[ResourceFunction["ChebyshevNodes"][10]]
Out[2]=

Scope (2) 

Create the numbers on a domain from 0 to 2π:

In[3]:=
ResourceFunction["ChebyshevNodes"][30, {0.0, 2 Pi}]
Out[3]=

Show on a number line:

In[4]:=
NumberLinePlot[%]
Out[4]=

Applications (6) 

Find points for fifth order approximation:

In[5]:=
n = 5;
min = 0.0;
max = Pi;
x =.;
pts = ResourceFunction["ChebyshevNodes"][n + 1, {min, max}]
Out[6]=

Perform the approximation of Cos[x]:

In[7]:=
vdmm = VandermondeMatrix[pts];
sol = LinearSolve[vdmm, Cos[x] /. x -> pts]
Out[8]=

Represent the approximation as a polynomial:

In[9]:=
approxfunc = FromDigits[Reverse[sol], x]
Out[9]=

Compare the functions:

In[10]:=
Plot[{Cos[x], approxfunc}, {x, 0, Pi}]
Out[10]=

Show the difference:

In[11]:=
Plot[Cos[x] - approxfunc, {x, 0, Pi}]
Out[11]=

Compare to the error from a fifth-order series expansion evaluated at the midpoint:

In[12]:=
Plot[Evaluate[Cos[x] - Normal@Series[Cos[x], {x, Pi/2, 5}]], {x, 0, Pi}, PlotRange -> All]
Out[12]=

Properties and Relations (2) 

The Chebyshev nodes are related to the roots of Chebyshev polynomials of the first kind:

In[13]:=
f = ChebyshevT[11, x];
Plot[f, {x, -1, 1}]
Out[14]=

Compare the zeros by finding the roots numerically and using the function ChebyshevNodes:

In[15]:=
a = Sort[
   DeleteDuplicates[
    Identity[x /. FindRoot[f, {x, #}] & /@ Subdivide[-1, 1, 30]], Abs[#1 - #2] < 10^-4 &]];
b = ResourceFunction["ChebyshevNodes"][11];
Chop[a - b]
Out[16]=

Chebyshev nodes match the coordinate components of CirclePoints:

In[17]:=
Union[ResourceFunction["ChebyshevNodes"][10]] == Union[Flatten[CirclePoints[20]]]
Out[17]=

Neat Examples (1) 

Show how Chebyshev nodes are related to equi-distantly spaced points on a semi-circle:

In[18]:=
n = 10;
cns = ResourceFunction["ChebyshevNodes"][n];
p1 = AngleVector /@ MovingAverage[Subdivide[Pi, 0, n], 2];
p2 = {#, 0} & /@ cns;
Graphics[{
  Style[Circle[{0, 0}, 1, {0, Pi}], Black],
  Style[MapThread[Arrow[{#1, #2}] &, {p1, p2}], Black],
  Style[Disk[p1, 0.02], Blue],
  Style[Disk[p2, 0.02], Red],
  Style[InfiniteLine[{{-1, 0}, {1, 0}}]]
  },
 PlotRange -> {{-1.25, 1.25}, {-0.25, 1.25}}
 ]
Out[19]=

Publisher

SHuisman

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 11 October 2023

License Information