Exemplo n.º 1
0
    public static NormalDistribution ByParams(double expectation, double variance)
    {
        if (Double.IsInfinity(expectation) || Double.IsNaN(expectation))
                throw new ArgumentException("The expectation must be a finite number");

            if (variance <= 0 || Double.IsInfinity(expectation) || Double.IsNaN(expectation))
                throw new ArgumentException("The variance must be a positive finite number");

            NormalDistribution distribution = new NormalDistribution();
            distribution.Expectation = expectation;
            distribution.Variance = variance;

            distribution.ComputeInternalParameters();

            return distribution;
    }
Exemplo n.º 2
0
    public static NormalDistribution ByParams(double expectation, double variance)
    {
        if (Double.IsInfinity(expectation) || Double.IsNaN(expectation))
        {
            throw new ArgumentException("The expectation must be a finite number");
        }

        if (variance <= 0 || Double.IsInfinity(expectation) || Double.IsNaN(expectation))
        {
            throw new ArgumentException("The variance must be a positive finite number");
        }

        NormalDistribution distribution = new NormalDistribution();

        distribution.Expectation = expectation;
        distribution.Variance    = variance;

        distribution.ComputeInternalParameters();

        return(distribution);
    }