システムを使用する;
namespace Legalsoft.Truffer
{ public class Gammadist : Gamma { private double alph { get; 設定; プライベート ダブル ベット { get; 設定; プライベート ダブルファク{取得; 設定; }
public Gammadist(double aalph, double bbet = 1.0)
{ this.alph = aalph; this.bet = バベット; if (alph <= 0.0 || bet <= 0.0) { throw new Exception("bad alph,bet in Gammadist"); fac = alph * Math.Log(bet) - Globals.gammln(alph); }
public double p(double x)
{ if (x <= 0.0) { throw new Exception("bad x in Gammadist"); return Math.Exp(-bet * x + (alph - 1.0) * Math.Log(x) + fac); }
public double cdf(double x)
{ if (x < 0.0) { throw new Exception("bad x in Gammadist"); gammp(alph, bet * x)を返します ; }
public double invcdf(double p)
{ if (p < 0.0 || p >= 1.0) { throw new Exception("bad p in Gammadist"); invgammp(p, alph) / ベットを返します 。 } } }