C#, Calcul numérique - Méthode de calcul et programme source de Expondist

 

utiliser le système ;

espace de noms Legalsoft.Truffer
{     public class Expondist     {         double pari privé { obtenir ; ensemble; }


        public Expondist(double bbet)
        {             this.bet = bbet;             if (bet <= 0.0)             {                 throw new Exception("bad bet in Expondist");             }         }





        public double p(double x)
        {             if (x < 0.0)             {                 throw new Exception("bad x in Expondist");             }             return bet * Math.Exp(-bet * x);         }





        public double cdf(double x)
        {             if (x < 0.0)             {                 throw new Exception("bad x in Expondist");             }             return 1.0 - Math.Exp(-bet * x);         }





        public double invcdf(double p)
        {             if (p < 0.0 || p >= 1.0)             {                 throw new Exception("bad p in Expondist");             }             return -Math.Log(1.0 - p) / bet ;         }     } }








 

Supongo que te gusta

Origin blog.csdn.net/beijinghorn/article/details/131745201
Recomendado
Clasificación