I have a Chebyshev polynomial $f$ of degree $n$ in point-value form \begin{align} f&=:S = \left( \left( x_i, y_i \right) \right)_{i=0}^n, \tag{1} \\ x_i &= \cos\left( \frac{i \pi}{n} \right), i=0, \ldots, n. \tag{2} \end{align}
I want to sample this polynomial at a higher number of chebyshev points $m$, with $m>n$, so as to obtain the sample \begin{align} S' &= \left( \left( x'_i, y'_i \right) \right)_{i=0}^m, \tag{3} \\ x'_i &= \cos\left( \frac{i \pi}{m} \right), i=0, \ldots, m. \tag{4} \end{align} I do this with the Discrete Cosine Transform (DCT). But no matter what I try I don't get a consistent sample $S'$. For example, I should get that $$ y'_0 = y_0 \text{ and } y'_m = y_n, \tag{5} $$ but I don't.
I will describe my procedure for obtaining $S'$ below.
If you can spot any error, it will be great.
I probably have some constant wrong in the DCT.
Sampling Procedure
1. Obtain the coefficient representation of $f$
$$
f\left(x\right) = \sum_{k=0}^n a_k \cos\left( k \arccos\left(x\right) \right). \tag{6}
$$
This is done by applying the DCT, so that
$$
a_k = \frac{1}{n} y_0 + \frac{1}{n} y_n \cos\left(k\pi\right) + \frac{2}{n} \sum_{i=1}^{n-1} y_i \cos\left(k\frac{i\pi}{n}\right). \tag{7}
$$
Form a new set of coefficient $a'_k$ by zero-padding the previously obtained coefficient $$ a'_k = \begin{cases} a_k & k \le n, \\ 0 & n < k \le m. \end{cases} \tag{8} $$
Obtain the desired sample $S'$ by applying the DCT to the $a'_k$ $$ y'_i = \frac12 a'_0 + \frac12 a'_m \cos\left(i\pi\right) + \sum_{k=1}^{m-1} a'_k \cos\left(i\frac{k\pi}{m}\right). \tag{9} $$