Accord.Tests.Math.BroydenFletcherGoldfarbShannoTest.createTestFunction C# (CSharp) Method

createTestFunction() private static method

private static createTestFunction ( double>.Func &f, double[]>.Func &g ) : void
f double>.Func
g double[]>.Func
return void
        private static void createTestFunction(out Func<double[], double> f, out Func<double[], double[]> g)
        {
            // min f(x, y) = -exp(-(x-1)^2) - exp(-0.5*(y-2)^2)
            f = (x) => -Math.Exp(-Math.Pow(x[0] - 1, 2)) - Math.Exp(-0.5 * Math.Pow(x[1] - 2, 2));

            g = (x) => new[] 
            {
                2 * Math.Exp(-Math.Pow(x[0] - 1, 2)) * (x[0] - 1),
                Math.Exp(-0.5 * Math.Pow(x[1] - 2, 2)) * (x[1] - 2)
            };
        }