private static double fc_lnpk(int k, int N_Mn, int M, int n) { return(Arithmetic.logFactorial(k) + Arithmetic.logFactorial(M - k) + Arithmetic.logFactorial(n - k) + Arithmetic.logFactorial(N_Mn + k)); } /**
private static double fc_lnpk(int k, int N_Mn, int M, int n) { return(Arithmetic.logFactorial(k) + Arithmetic.logFactorial(M - k) + Arithmetic.logFactorial(n - k) + Arithmetic.logFactorial(N_Mn + k)); } /**
/** * Returns the probability distribution function. */ public double pdf(int k) { if (k < 0) throw new IllegalArgumentException(); int r = this.n - k; return Math.exp(this.log_n - Arithmetic.logFactorial(k) - Arithmetic.logFactorial(r) + this.log_p * k + this.log_q * r); } /**
/** * Returns the probability distribution function. */ public double pdf(int k) { if (k < 0) throw new IllegalArgumentException(); int r = this.n - k; return Math.exp(this.log_n - Arithmetic.logFactorial(k) - Arithmetic.logFactorial(r) + this.log_p * k + this.log_q * r); } /**
private static double f(int k, double l_nu, double c_pm) { return Math.exp(k * l_nu - Arithmetic.logFactorial(k) - c_pm); } /**
private static double f(int k, double l_nu, double c_pm) { return Math.exp(k * l_nu - Arithmetic.logFactorial(k) - c_pm); } /**
/** * Returns the probability distribution function. */ public double pdf(int k) { return Math.exp(k*Math.log(this.mean) - Arithmetic.logFactorial(k) - this.mean); // Overflow sensitive: // return (Math.pow(mean,k) / cephes.Arithmetic.factorial(k)) * Math.exp(-this.mean); } /**
/** * Returns the probability distribution function. */ public double pdf(int k) { return Math.exp(k*Math.log(this.mean) - Arithmetic.logFactorial(k) - this.mean); // Overflow sensitive: // return (Math.pow(mean,k) / cephes.Arithmetic.factorial(k)) * Math.exp(-this.mean); } /**
/** * Sets the parameters number of trials and the probability of success. * @param n the number of trials * @param p the probability of success. * @throws IllegalArgumentException if <tt>n*Math.min(p,1-p) <= 0.0</tt> */ public void setNandP(int n, double p) { if (n*Math.min(p,1-p) <= 0.0) throw new IllegalArgumentException(); this.n = n; this.p = p; this.log_p = Math.log(p); this.log_q = Math.log(1.0-p); this.log_n = Arithmetic.logFactorial(n); } /**
/** * Sets the parameters number of trials and the probability of success. * @param n the number of trials * @param p the probability of success. * @throws IllegalArgumentException if <tt>n*Math.min(p,1-p) <= 0.0</tt> */ public void setNandP(int n, double p) { if (n*Math.min(p,1-p) <= 0.0) throw new IllegalArgumentException(); this.n = n; this.p = p; this.log_p = Math.log(p); this.log_q = Math.log(1.0-p); this.log_n = Arithmetic.logFactorial(n); } /**
fm = Math.exp(Arithmetic.logFactorial(N - M) - Arithmetic.logFactorial(N_Mn + m) - Arithmetic.logFactorial(n - m) + Arithmetic.logFactorial(M) - Arithmetic.logFactorial(M - m) - Arithmetic.logFactorial(m) - Arithmetic.logFactorial(N) + Arithmetic.logFactorial(N - n) + Arithmetic.logFactorial(n) );
fm = Math.exp(Arithmetic.logFactorial(N - M) - Arithmetic.logFactorial(N_Mn + m) - Arithmetic.logFactorial(n - m) + Arithmetic.logFactorial(M) - Arithmetic.logFactorial(M - m) - Arithmetic.logFactorial(m) - Arithmetic.logFactorial(N) + Arithmetic.logFactorial(N - n) + Arithmetic.logFactorial(n) );
c_pm = m * l_my - Arithmetic.logFactorial(m); if (Math.log(W) <= X * l_my - Arithmetic.logFactorial(X) - c_pm) return(X);
c_pm = m * l_my - Arithmetic.logFactorial(m); if (Math.log(W) <= X * l_my - Arithmetic.logFactorial(X) - c_pm) return(X);