Ejemplo n.º 1
0
        public void CumulativeFunctionTest()
        {
            var p1 = new NormalDistribution(4.2, 1);
            var p2 = new NormalDistribution(7.0, 2);

            Independent <NormalDistribution> target = new Independent <NormalDistribution>(p1, p2);

            double[] x;
            double   actual, expected;

            x        = new double[] { 4.2, 7.0 };
            actual   = target.DistributionFunction(x);
            expected = p1.DistributionFunction(x[0]) * p2.DistributionFunction(x[1]);
            Assert.AreEqual(expected, actual);

            x        = new double[] { 0.0, 0.0 };
            actual   = target.DistributionFunction(x);
            expected = p1.DistributionFunction(x[0]) * p2.DistributionFunction(x[1]);
            Assert.AreEqual(expected, actual);

            x        = new double[] { 7.0, 4.2 };
            actual   = target.DistributionFunction(x);
            expected = p1.DistributionFunction(x[0]) * p2.DistributionFunction(x[1]);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void CumulativeFunctionTest()
        {
            var p1 = new NormalDistribution(4.2, 1);
            var p2 = new NormalDistribution(7.0, 2);

            Independent<NormalDistribution> target = new Independent<NormalDistribution>(p1, p2);

            double[] x;
            double actual, expected;

            x = new double[] { 4.2, 7.0 };
            actual = target.DistributionFunction(x);
            expected = p1.DistributionFunction(x[0]) * p2.DistributionFunction(x[1]);
            Assert.AreEqual(expected, actual);

            x = new double[] { 0.0, 0.0 };
            actual = target.DistributionFunction(x);
            expected = p1.DistributionFunction(x[0]) * p2.DistributionFunction(x[1]);
            Assert.AreEqual(expected, actual);

            x = new double[] { 7.0, 4.2 };
            actual = target.DistributionFunction(x);
            expected = p1.DistributionFunction(x[0]) * p2.DistributionFunction(x[1]);
            Assert.AreEqual(expected, actual);
        }