Пример #1
0
        /// <summary>Initializes a new instance of the <see cref="ShiftedLogNormalDistribution"/> class.
        /// </summary>
        /// <param name="mu">The parameter \mu.</param>
        /// <param name="sigma">The parameter \sigma.</param>
        /// <param name="shift">The (non-negative) shift parameter of the shifted Log-Normal distribution.</param>
        /// <param name="infoOutputAction">A delegate called if specific data should be stored in <see cref="FillInfoOutput(InfoOutput, string)"/>; perhaps <c>null</c>.</param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown, if one of the arguments is not valid.</exception>
        internal protected ShiftedLogNormalDistribution(double mu, double sigma, double shift, Action <InfoOutput, string> infoOutputAction)
        {
            m_InfoOutputAction = infoOutputAction;

            if (sigma <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(sigma), String.Format(ExceptionMessages.ArgumentOutOfRange, sigma));
            }
            Sigma = sigma;
            if (Double.IsNaN(mu))
            {
                throw new ArgumentOutOfRangeException(nameof(mu), String.Format(ExceptionMessages.ArgumentIsNaN, mu));
            }
            Mu = mu;

            if (shift < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(shift), String.Format(ExceptionMessages.ArgumentOutOfRangeGreaterEqual, nameof(shift), 0.0));
            }
            Shift = shift;

            LongName = new IdentifierString(String.Format("Shifted LogNormal distribution LN({0}, {1}, {2})", Mu, Sigma * Sigma, shift));
            Name     = new IdentifierString(String.Format("LN({0}, {1}, {2})", Mu, Sigma * Sigma, shift));
            Moment   = new MomentCalculator(this);

            Median = m_ExpOfMu = Math.Exp(mu);
        }
Пример #2
0
        /// <summary>Initializes a new instance of the <see cref="ExponentialDistribution" /> class.
        /// </summary>
        /// <param name="lambda">The value of parameter \lambda.</param>
        /// <param name="infoOutputAction">A delegate called if specific data should be stored in <see cref="FillInfoOutput(InfoOutput, string)"/>; perhaps <c>null</c>.</param>
        /// <exception cref="ArgumentException">Thrown, if <paramref name="lambda"/> is negative or <c>0.0</c>.</exception>
        internal protected ExponentialDistribution(double lambda, Action <InfoOutput, string> infoOutputAction)
        {
            m_InfoOutputAction = infoOutputAction;

            if (lambda <= 0)
            {
                throw new ArgumentException("lambda");
            }
            Beta   = 1.0 / lambda;
            Lambda = lambda;

            Moment   = new MomentCalculator(this);
            Name     = new IdentifierString(String.Format("Exp({0})", lambda));
            LongName = new IdentifierString(String.Format("Exponential distribution; lambda = {0}", lambda));
        }
Пример #3
0
        /// <summary>Initializes a new instance of the <see cref="NormalDistribution"/> class.
        /// </summary>
        /// <param name="mu">The mean.</param>
        /// <param name="sigma">The standard deviation.</param>
        /// <param name="infoOutputAction">A delegate called if specific data should be stored in <see cref="FillInfoOutput(InfoOutput, string)"/>; perhaps <c>null</c>.</param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown, if one of the arguments is not valid.</exception>
        internal protected NormalDistribution(double mu, double sigma, Action <InfoOutput, string> infoOutputAction)
        {
            m_InfoOutputAction = infoOutputAction;

            if (sigma <= 0)
            {
                throw new ArgumentOutOfRangeException("sigma", String.Format(ExceptionMessages.ArgumentOutOfRange, sigma));
            }
            Sigma = sigma;
            if (Double.IsNaN(mu))
            {
                throw new ArgumentOutOfRangeException("mu", String.Format(ExceptionMessages.ArgumentIsNaN, mu));
            }
            Mu       = mu;
            LongName = new IdentifierString(String.Format("Normal distribution N({0}, {1})", Mu, Sigma * Sigma));
            Name     = new IdentifierString(String.Format("N({0}, {1})", Mu, Sigma * Sigma));
            Moment   = new MomentCalculator(this);
        }
Пример #4
0
 /// <summary>Initializes a new instance of the <see cref="StandardNormalDistribution"/> class.
 /// </summary>
 public StandardNormalDistribution()
 {
     LongName = new IdentifierString("Standard Normal distribution N(0,1)");
     Name     = new IdentifierString("N(0,1)");
     Moment   = new MomentCalculator();
 }