Chebyshev coefficients- interpolation on [a,b]

My problem is to solve a second order differential equation given two (Dirichlet) boundary conditions.

$$\frac{d^2y}{dx^2} = M/EI$$

Both M and I are functions of x. Owing to complexity of the function, my idea was to generate an interpolation function that can be easily integrated (the function is smooth). This brings us to the Chebyshev function. As my function is defined on [a,b], I applied a linear transformation to bring this to [-1,1].

The Chebyshev polynomial used is $$c_0T_0/2 +c_1T_1+c_2T_2+...$$ where c is the coefficient and T is the corresponding polynomial. Being a sum of cosines, I can easily generate a sum of sines which can then be integrated to solve my problem.

My problem lies in the integration step. The coefficients are found as-

$$\sum_{i=1}^{N} f(X_i) \times cos(k\times cos^{-1}x)$$ in [a,b] with $$x$$ being the Chebyshev nodes and $$X$$ being the corresponding values in [a,b]

This works perfectly and provides a very good approximation. The issue is the integrated function has little to no match with the actual function values. If I were to repeat the same steps but consider that the function lies between [-1,1], then I get a good match (<1% error) between the integrated function and actual function.

The integrated functions are shown below-

$$\int T_0 = x$$

$$\int T_1 = x^2/2$$

$$\int T_i = 1/2*(cos((i+1)\times cos^{-1}x)/(i+1) - cos((i-1)\times cos^{-1}x)/(i-1)$$ , $$i>=2$$

I worked out the integration but cannot find anything out of place. Does the change of variables introduce an extra factor that would have to be included in the integration? What am I missing here?

• Try plotting both the [a, b] version and the [-1, 1] version. My guess is that you need to transform the result. – marty cohen Dec 17 '18 at 18:10
• The function from [a,b] has no relation to the one in [-1,1]. It feels like the integration constant I find still has a dependence on $x$. – speed_of_light Dec 18 '18 at 8:05