Express First kind Chebyshev polynomial in terms of monomials
First kind Chebyshev polynomial of order n ($T_n$) is defined in terms of cosine function as follow:
1) $T_n(\cos x)=\cos n x$
Instead of working with cosine functions, I want to express Chebyshev polynomial in terms of monomials (powers of x) using the following recursion formula: $T_0(x)=1; T_1(x)=x; T_{n+1}(x)=2xT_n(x)−T_{n−1}(x)$ for $x \in [-1, 1]$.
For example, first kind Chebyshev polynomial of order 2 can be expressed as:
Usig formula 1) $T_2(cosx)=cos(2x)$,
Usig recursive formula) $T_2(x)=2xT_1(x)-T_0(x)=2x^2-1$
If we plot $cos2x$ vesrus $cosx, cosx\in [-1,1]$ and also $2x^2-1$ versus $x, x\in [-1, 1]$, the two plot should match.
However as "n" increases ($n\ge45$), the $T_n$ obtained as a polynomial by the recursive formula doesn't match the Chebyshev polynomial of formula (1).
Why is that????? The recursion formula is not valid for higher orders????
here is my Matlab code that compares two formulas:
clc;clear;close all;
syms x;
n=45;
Tr(1,1)=1+0*x; Tr(2,1)=x;
for i=2:n; Tr(i+1,1)= expand(2*x*Tr(i,1)-Tr(i-1,1));end;
hold on;for x=-1:0.01:1; plot(x,eval(Tr(n)),'--bo'); end;
t=[0:0.01:2*pi]; plot(cos(t),cos((n-1)*t),'k*-')