I am trying to interpolate a generic polynomial using python, just to understand the theory better. I have seen something regarding the library in numpy, with respect to polynomials using cèbyshèv, and I have developed the following code:
# f(x) = -3 + 2x^2 - x^3 + x^4
f = lambda x: -3 + 2*x**2 - x**3 + x**4
pcoeffs = [-3, 0, 2, -1, 1]
ccoeffs = np.polynomial.chebyshev.poly2cheb(pcoeffs)
fpoly = np.polynomial.Polynomial(pcoeffs)
fcheb = np.polynomial.Chebyshev(ccoeffs)
I know that the Chebyshev polynomials is a polynomial based on chebyshev points, computed as follow:
And I use these points to compute the polynomial, using the formula:

Where:
- -ak is the function evaluated at each at each Chebyshev points before defined, and If I am correct, I am able to find this function with "np.polynomial.Chebyshev(ccoeffs)"
Now, running the previous code, I get the following output:

Now I have some questions:
- What have I written above, is correct?
- How can I find the values of Ti(x)?
- How can I represent the Chebyshev polynomials in python with a plot?
Thanks in advance!

