public static double second_diff_2(IntroducedFunction f, Coord x, int number_1, int number_2) { double dx = 1e-5; int length = x.coord.Length; Coord x_dx_1 = dx * Coord.Ort(length, number_1); Coord x_dx_2 = dx * Coord.Ort(length, number_2); return((f.Answer(x + x_dx_1 + x_dx_2) - f.Answer(x + x_dx_1 - x_dx_2) - f.Answer(x - x_dx_1 + x_dx_2) + f.Answer(x - x_dx_1 - x_dx_2)) / (4 * dx * dx)); }
public static double diff_4(IntroducedFunction f, Coord x, int number) { double dx = 1e-5; int length = x.coord.Length; Coord x_dx = dx * Coord.Ort(length, number); return((-f.Answer(x + 2 * x_dx) + 8 * f.Answer(x + x_dx) - 8 * f.Answer(x - x_dx) + f.Answer(x - 2 * x_dx)) / (12 * dx)); //return (-f(x + 2 * x_dx, parts) + 8 * f(x + x_dx, parts) - 8 * f(x - x_dx, parts) + f(x - 2 * x_dx, parts)) / (12 * dx); }
//Значение функции в новой точке override public double f(double alfa) { point(alfa); return(y.Answer(x1)); }