public static string StartCount(double xn, double xk, int n, int m, MathFunctionHandler mathFunction) { double h = (xk - xn) / m; double fx = 0; if (mathFunction == null) { return("Error: math function isn't choosen!"); } StringBuilder result_str = new StringBuilder(); for (int i = 1; xn < xk && i < m + 1; i++, xn += h) { fx = Round(mathFunction(xn), 4); result_str.Append ( $"{i.ToString()}. f(x) = {fx}, S(x) = {GetSXFunctionResult(fx, n)} " + $"Y(x) = {GetYXFunctionResult(fx)}\n" ); } return(result_str.ToString()); }
public static async Task <string> StartCountAsync(double xn, double xk, int n, int m, MathFunctionHandler mathFunction) { return(await Task.Run(() => StartCount(xn, xk, n, m, mathFunction))); }