Home > Blockchain >  Setting up Chebyshev interpolation
Setting up Chebyshev interpolation

Time:10-30

My h/w question asks me to "write a function that takes the limits of an interval and the order n of the polynomial interpolation pn(x), and returns the data points xi that can be used for Chebyshev interpolation."

I have written the following function that produces a list of evenly distributed points xi on a given interval [a, b] to be used however I don't think I have incorporated the degree of my polynomial into this function, here n is just the number of points I decide to have, does this still answer the question?

import numpy as np


def chebs(a, b, n):
    i = np.array(range(n))
    x = np.cos((2 * i   1) * np.pi / (2 * n))
    return 0.5 * (b - a) * x   0.5 * (b   a)

CodePudding user response:

If your h/w questions refers to the Chebyshev nodes (the roots of the Chebyshev polynomials of the first kind), then yes, your Python function exactly answers the question. And yes, you have incorporated the order of the Chebyshev polynomial: as the order is arbitrarily chosen (e.g. you can have a second ordered Chebyshev polynomial p2(x), third order p3(x), etc.), your function argument n in the calculation of Chebyshev nodes is the order of the polynomial.

  • Related