C#: Loop to find minima of function
问题 I currently have this function: public double Max(double[] x, double[] y) { //Get min and max of x array as integer int xMin = Convert.ToInt32(x.Min()); int xMax = Convert.ToInt32(x.Max()); // Generate a list of x values for input to Lagrange double i = 2; double xOld = Lagrange(xMin,x,y); double xNew = xMax; do { xOld = xNew; xNew = Lagrange(i,x,y); i = i + 0.01; } while (xOld > xNew); return i; } This will find the minimum value on a curve with decreasing slope...however, given this curve,