3
$\begingroup$

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 ?

$\endgroup$
3
  • 1
    $\begingroup$ It seems that your question is about the best way to write a program from Octave; since this is primarily a coding question, it seems off-topic here and should rather be on stackoverflow. $\endgroup$
    – user296602
    Dec 28, 2015 at 23:19
  • 1
    $\begingroup$ nodes = cos(pi/n*((1:n)-.5)) $\endgroup$
    – user147263
    Dec 28, 2015 at 23:24
  • $\begingroup$ Ok, thanks. Unfortunately I did forget to say that I have interval $[a, b]$. What is form of nodes in case of interval ? $\endgroup$
    – user40545
    Dec 28, 2015 at 23:54

1 Answer 1

4
$\begingroup$

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;
$\endgroup$
4
  • $\begingroup$ tell me, what it should be written for n+1 nodes ? $\endgroup$
    – user40545
    Jan 1, 2016 at 22:59
  • 1
    $\begingroup$ just write $n+1$ instead of $n$ $\endgroup$ Jan 1, 2016 at 23:23
  • $\begingroup$ so k=0:n or k=1:n+1 $\endgroup$
    – user40545
    Jan 1, 2016 at 23:31
  • 1
    $\begingroup$ k=0:n and also .../(n+1) instead of .../n $\endgroup$ Jan 1, 2016 at 23:35

Not the answer you're looking for? Browse other questions tagged .