It is necessary to programmatically implement approximations (interpolation) of the function by Chebyshev polynons. Those. we have the n-th number of pairs x, y, and we need to get an approximate y for a given x.
The approximating function is sought as the sum of Chebyshev polynomials, i.e.
AND
Tried to implement, so far without success
public class Polynom { public double[] X { get; set; } public double[] Y { get; set; } public Polynom(double[] x, double[] y) { X = x; Y = y; } public Polynom(List<DoublePoint> list) { X = new double[list.Count]; Y = new double[list.Count]; int j = 0; foreach (var i in list) { X[j] = iX; Y[j] = iY; j++; } } public double GetY(double x) { double res = GetRatio(0, X.Length) * (1 / Math.Pow(2, 0.5)); //отдельно считаем первое слогаемое (для Т с тильдой) for (int i = 1; i < X.Length - 1; i++) { res += (GetRatio(i, X.Length) * GetChebPolynom(x, i)); //сумма многочленов } return res; } public double GetChebPolynom(double x, long n) //считаем многочлен { if (n == 1) return x; double result = Math.Cos(n * Math.Acos(x)); return result; } public double GetRatio(double j, double n) { double res = Y[0] * 1; //отдельно считаем первое слогаемое (для Т без тильды) for (var i = 1; i < n - 1; i++) { res += Y[i] * GetChebPolynom(X[i], (long)j); } return res * 2 / n; } } Class DoublePoint:
public class DoublePoint : IComparable { public double X { get; set; } public double Y { get; set; } public DoublePoint(double x, double y) { X = x; Y = y; } } Please point me to my errors. I will be glad to any help.
Perhaps I did not fully understand this method. After all, I did not understand why the formula that calculates Xj. And I do not know whether I think polynomials.
Thank you in advance.

