Accord.Tests.Statistics.LogLinkFunctionTest.DerivativeTest C# (CSharp) Method

DerivativeTest() private method

private DerivativeTest ( ) : void
return void
        public void DerivativeTest()
        {
            double beta = 0.52;
            double constant = 2.42;

            double[] expected =
            {
               5.84785, 6.15998, 6.48877, 6.83512, 7.19995, 7.58425, 
               7.98906, 8.41549, 8.86467, 9.33783, 9.83624
            };

            LogLinkFunction target = new LogLinkFunction(beta, constant);

            for (int i = 0; i < 11; i++)
            {
                double x = i / 10.0;
                double y = target.Inverse(x);

                double d1 = target.Derivative(x);
                double d2 = target.Derivative2(y);

                Assert.AreEqual(expected[i], d1, 1e-5);
                Assert.AreEqual(expected[i], d2, 1e-5);

                Assert.IsFalse(Double.IsNaN(d1));
                Assert.IsFalse(Double.IsNaN(d2));
            }
        }