/// <summary>Initializes a new instance of the <see cref="MomentCalculator" /> class.
 /// </summary>
 /// <param name="logNormalDistribution">The log-normal distribution.</param>
 internal MomentCalculator(LogNormalDistribution logNormalDistribution)
     : base(Int32.MaxValue)
 {
     Distribution = logNormalDistribution;
     m_Mean       = Math.Exp(logNormalDistribution.Mu + 0.5 * logNormalDistribution.Sigma * logNormalDistribution.Sigma);
     m_Variance   = Math.Exp(2 * logNormalDistribution.Mu + logNormalDistribution.Sigma * logNormalDistribution.Sigma);
 }
        public void GetCdfValue_ResultOfGetInverseCdfValue_InputValue(
            [Values(0.0, 0.005, 0.25, 0.5, 0.75, 0.995, 1.0)]
            double probability,
            [Values(0.0, -1.25, 2.75)]
            double mean,
            [Values(1.0, 0.25, 1.75)]
            double sigma)
        {
            Assume.That(probability, Is.LessThanOrEqualTo(1.0));
            var logNormalDistribution = LogNormalDistribution.Create(mean, sigma);

            double expected = probability;

            double x      = logNormalDistribution.GetInverseCdfValue(probability);
            double actual = logNormalDistribution.GetCdfValue(x);

            Assert.That(actual, Is.EqualTo(expected).Within(1E-6));
        }
Ejemplo n.º 3
0
 /// <summary>Initializes the <see cref="LogNormalDistribution" /> class.
 /// </summary>
 static LogNormalDistribution()
 {
     Standard = new LogNormalDistribution(0.0, 1.0);
 }