utilizando el sistema;
espacio de nombres Legalsoft.Truffer
{ public class Normaldist : Erf { private double mu { get; colocar; } firma doble privada { get; colocar; }
public Normaldist(doble mmu = 0.0, doble ssig = 1.0)
{ this.mu = mmu; this.sig = ssig; if (sig <= 0.0) { throw new Exception("bad sig in Normaldist"); } }
public double p(doble x)
{ return (0.398942280401432678 / sig) * Math.Exp(-0.5 * Globals.SQR((x - mu) / sig)); }
public double cdf(doble x)
{ return 0.5 * erfc(-0.707106781186547524 * (x - mu) / sig); }
public double invcdf(doble p)
{ if (p <= 0.0 || p >= 1.0) { throw new Exception("mala p en Normaldist"); } return -1.41421356237309505 * sig * inverfc(2.0 * p) + mu; } } }