Creating and debugging Chebyshev expansion functions