예제 #1
0
        public void GammaFunctionValue()
        {
            for (int i = 0; i < knownX.Length; i++)
            {
                double expected = knownY[i];
                double actual   = GammaFunction.Value(knownX[i]);

                output.WriteLine($"X = {knownX[i]}");
                output.WriteLine($"Expected = {expected}");
                output.WriteLine($"Actual   = {actual}");
                output.WriteLine("");

                Assert.True(Math.Abs(expected - actual) < expected * 0.0001);
            }
        }
예제 #2
0
        public void Factorial()
        {
            double actual = 1.0;

            for (int n = 1; n <= 30; n++)
            {
                actual *= n;
                double expected = GammaFunction.Value(n + 1);

                output.WriteLine($"N = {n}");
                output.WriteLine($"Expected = {expected}");
                output.WriteLine($"Actual   = {actual}");

                Assert.True(Math.Abs(expected - actual) < expected * 0.0001);
            }
        }