Discrete Chebyshev polynomials,
t_{n}(x; N),
N a positive integer,
n = 0, … , N  1, are orthogonal on the support interval
[0,N1] with weight function
w(x) = Σ_{n=0}^{N1}&delta(x  n) 

and normalized by the requirement that the leading coefficient of
t_{n}(x; α) is
(2n)! / n!².
t_{n}(x; α) satisfies the threeterm recurrence relation
(n + 1) t_{n+1}(x; N) = (2n + 1) (2x  (N1)) t_{n}(x; N)  n (N²  n²) t_{n1}(x; N)  for n ≥ 1 

with starting values
t_{0}(x; N) = 1,  t_{1}(x; N) = x  (N  1). 

 double Chebyshev_tn( double x, int N, int n )
This function returns t_{n}(x; N) where t_{n}(x; N) is described above.
 long double xChebyshev_tn( long double x, int N, int n )
This function returns t_{n}(x; N) where t_{n}(x; N) is described above.
 void Chebyshev_tn_Sequence( double t[ ], double x, int N, int max_n )
This function returns t_{n}(x; N), for n = 0, 1, …, max_n in the array t[ ] where t_{n}(x; N) is described above. Note that t[ ] should be declared as double t[K] where
K ≥ max_n + 1._{ }
 void xChebyshev_tn_Sequence( long double t[], long double x, int N, int max_n )
This function returns t_{n}(x; N), for n = 0, 1, …, max_n in the array t[ ] where t_{n}(x; N) is described above. Note that t[ ] should be declared as long double t[K] where
K ≥ max_n + 1._{ }
 double Chebyshev_tn_Series( double x, int N, double a[ ], int degree )
This function returns Σ_{k=0}^{n}a[k] t_{k}(x; N) where n = degree and t_{k}(x; N) for k = 0, …, n is described above._{ }
 long double xChebyshev_tn_Series( long double x, int N, long double a[ ], int degree )
This function returns Σ_{k=0}^{n}a[k] t_{k}(x; N) where n = degree and t_{k}(x; N) for k = 0, …, n is described above._{ }
C source code is available for these routines: