Пример #1
0
        public async Task TestGammaGetDensities()
        {
            // arrange
            var subject  = new GammaDistribution(1d, 1d);
            var expected = (await GetNumDataAsync(
                                "sapply(seq(qgamma(0.3, 1.0), qgamma(0.7, 1.0), length.out = 5), function(cd){dgamma(cd, 1.0)})"
                                ))[0].Data.ToArr();

            // act
            var(_, actual) = subject.GetDensities(0.3, 0.7, 5);

            // assert
            Assert.IsTrue(actual.Count == 5);
            expected.Iter((i, d) => Assert.AreEqual(d, actual[i], Base.Constant.TOLERANCE));
        }