public string ProtocolBuild(ICollection <XYDataModel> xYDatas, double step, double a = 0, double b = 0) { string Protocol = $"При n = {step}\nwi | xi | Ei | f(Ei) | wi * f(Ei) | Сума"; // int n = (int)step >= 1 && (int)step <= 7 ? (int)step : 2; IntegralChebishev.MakeQuadratureCoefficients(n); IInterpolation interpolation = new CubicSplineInterpolation(); double f = 0; for (int i = 0; i < n; i++) { double el = i <= QuadratureElementValue.Count - 1 ? QuadratureElementValue[i] : -QuadratureElementValue[n - i - 1]; double Ei = (b + a) / 2.0 + ((b - a) / 2.0) * el; double Yi = interpolation.InterpolationPolynom(xYDatas, Ei); f += Yi; Protocol += $"\n{el} | {Ei} | {Yi} | {f}"; } f *= ((b - a) / n); Protocol += $"\nИнтеграл = {f} при " + "{a, b} " + $"{{{a},{b}}}"; // return(Protocol); }
public double Integral(ICollection <XYDataModel> xYDatas, double step, double a = 0, double b = 0) { int n = (int)step >= 1 && (int)step <= 7 ? (int)step : 2; IntegralChebishev.MakeQuadratureCoefficients(n); IInterpolation interpolation = new CubicSplineInterpolation(); double f = 0; for (int i = 0; i < n; i++) { double el = i <= QuadratureElementValue.Count - 1 ? QuadratureElementValue[i] : -QuadratureElementValue[n - i - 1]; double Ei = (b + a) / 2.0 + ((b - a) / 2.0) * el; double Yi = interpolation.InterpolationPolynom(xYDatas, Ei); f += Yi; } f *= ((b - a) / n); return(f); }