static List <double> exponential(Sums s, double[] X, double[] Y) { double[] coefficient = new double[2]; double[,] sys_matrix = { { s.sum2(X), s.sum(X) }, { s.sum(X), X.Length } }; double[] solution_row = { s.sum_y_on_log_x(X, Y), s.sum_log_x(Y) }; alglib.rmatrixsolve(sys_matrix, 2, solution_row, out int t, out alglib.densesolverreport c, out coefficient); coefficient[1] = Math.Exp(coefficient[1]); List <double> cof = new List <double>(); cof.AddRange(coefficient); return(cof); }
static List <double> quadratic(Sums s, double[] X, double[] Y) { double[] coefficient = new double[3]; double[,] sys_matrix = { { s.sum4(X), s.sum3(X), s.sum2(X) }, { s.sum3(X), s.sum2(X), s.sum(X) }, { s.sum2(X), s.sum(X), X.Length } }; double[] solution_row = { s.sum_x_x_mult_y(X, Y), s.sum_x_mult_y(X, Y), s.sum(Y) }; alglib.rmatrixsolve(sys_matrix, 3, solution_row, out int t, out alglib.densesolverreport c, out coefficient); List <double> cof = new List <double>(); cof.AddRange(coefficient); return(cof); }
static List <double> hyperbolic(Sums s, double[] X, double[] Y) { double[] coefficient = new double[2]; double[,] sys_matrix = { { s.sum_dev_1_on_x_x(X), s.sum_dev_1_on_x(X) }, { s.sum_dev_1_on_x(X), X.Length } }; double[] solution_row = { s.sum_dev_y_on_x(X, Y), s.sum(Y) }; alglib.rmatrixsolve(sys_matrix, 2, solution_row, out int t, out alglib.densesolverreport c, out coefficient); List <double> cof = new List <double>(); cof.AddRange(coefficient); return(cof); }