示例#1
0
        public void DifferentiationTest()
        {
            int i = 0;

            foreach (TestDerivative test in derivatives)
            {
                i++;

                foreach (double x in TestUtilities.GenerateRealValues(0.1, 100.0, 5))
                {
                    UncertainValue nd = FunctionMath.Differentiate(test.Function, x);
                    double         ed = test.Derivative(x);
                    Console.WriteLine("{0} f'({1}) = {2} = {3}", i, x, nd, ed);

                    Console.WriteLine(
                        //Assert.IsTrue(
                        nd.ConfidenceInterval(0.999).ClosedContains(ed)
                        );

                    /*
                     *  TestUtilities.IsNearlyEqual(
                     *  FunctionMath.Differentiate(test.Function, x),
                     *  test.Derivative(x),
                     *  Math.Pow(2, -42)
                     */
                }
            }
        }