Derivative() public method

First derivative of the Inverse function.
public Derivative ( double x ) : double
x double The input value.
return double
コード例 #1
0
        public void DerivativeTest()
        {
            double beta = 3.14;
            double constant = 2.91;

            double[] expected =
            {
                -0.370803, -0.302092, -0.25085, -0.21162, -0.180922, 
                -0.156449, -0.136626, -0.120345, -0.10681, -0.0954358, -0.0857865
            };

            InverseLinkFunction target = new InverseLinkFunction(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-6);
                Assert.AreEqual(expected[i], d2, 1e-6);

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