public double Function(double[] x) { double norm = 0.0; for (int i = 0; i < x.Length; i++) norm += x[i] * x[i]; if (norm <= 1) return constant; return 0; }