Python Forum
Can I evaluate a Chebyshev polynomial using a function - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Can I evaluate a Chebyshev polynomial using a function (/thread-22649.html)



Can I evaluate a Chebyshev polynomial using a function - player1681 - Nov-21-2019

Hello everyone. I need to evaluate an arbitrary Chebyshev polynomial of order n at a point x. I have done it manually using their definition as

mt.cos(n*mt.acos(x))
However, I am not satisfied by the numerical precision of this, the results are not exact. I have searched the web for a function that does this in a more efficient way and the closest thing I have found is the Chebyshev module. However, inside of it I cannot find what I am looking for.

The first Chebyshev polynomials are P_0=1, P_1=x,P_2=2x^2-1 and so on. I need a function which output is the polynomial of the selected order evaluated at an arbitrary point. i.e. f(n=1, x=0.6)= 0.6, f(n=2, x=0.5)= 2*(0.5)^2-1 and so on.

Can someone tell me if said function exists?
Thanks.


RE: Can I evaluate a Chebyshev polynomial using a function - scidam - Nov-22-2019

Take a look at SymPy module. This is package for symbolic computations and computations with high precision.