chebyshev nodes - formula for general interval

2.1k Views Asked by At

Could you help me write elegant form of formula for Chebysev nodes in $[a,b]$ ? Size of vector of points is $n$.

I am working with octave, but the most important thing is: How to formulate it clear and elegant ?

1

There are 1 best solutions below

4
On BEST ANSWER

Consider $n$ Chebyshev interpolation points $x_k=\cos\frac{\pi}2 \frac{2k+1}{n}\in[-1,1]$, $k=0,1,2,\dots, n-1$. Use $x_k$ to define $z_k\in [a,b]$ as following $${z_k} = \frac{{a + b}}{2} + \frac{{b - a}}{2}{x_k}$$

k=0:(n-1);
nodes = cos( (pi/2) * (2*k+1)/(n) ) ;
nodes = (a+b)/2 + nodes*(b-a)/2;