public static double binomialCoefficientDouble(final int n, final int k) throws NotPositiveException, NumberIsTooLargeException, MathArithmeticException { return CombinatoricsUtils.binomialCoefficientDouble(n, k);
/** {@inheritDoc} */ public double probability(int x) { double ret; if (x < 0) { ret = 0.0; } else { ret = CombinatoricsUtils.binomialCoefficientDouble(x + numberOfSuccesses - 1, numberOfSuccesses - 1) * FastMath.pow(probabilityOfSuccess, numberOfSuccesses) * FastMath.pow(1.0 - probabilityOfSuccess, x); } return ret; }
/** * Computes \(P(D_{n,m} > d)\) if {@code strict} is {@code true}; otherwise \(P(D_{n,m} \ge * d)\), where \(D_{n,m}\) is the 2-sample Kolmogorov-Smirnov statistic. See * {@link #kolmogorovSmirnovStatistic(double[], double[])} for the definition of \(D_{n,m}\). * <p> * The returned probability is exact, implemented by unwinding the recursive function * definitions presented in [4] (class javadoc). * </p> * * @param d D-statistic value * @param n first sample size * @param m second sample size * @param strict whether or not the probability to compute is expressed as a strict inequality * @return probability that a randomly selected m-n partition of m + n generates \(D_{n,m}\) * greater than (resp. greater than or equal to) {@code d} */ public double exactP(double d, int n, int m, boolean strict) { return 1 - n(m, n, m, n, calculateIntegralD(d, m, n, strict), strict) / CombinatoricsUtils.binomialCoefficientDouble(n + m, m); }
return binomialCoefficientDouble(n, n - k);
return FastMath.log(binomialCoefficientDouble(n, k));
/** {@inheritDoc} */ public double probability(int x) { double ret; if (x < 0) { ret = 0.0; } else { ret = CombinatoricsUtils.binomialCoefficientDouble(x + numberOfSuccesses - 1, numberOfSuccesses - 1) * Math.pow(probabilityOfSuccess, numberOfSuccesses) * Math.pow(1.0 - probabilityOfSuccess, x); } return ret; }
public static double binomialCoefficientDouble(final int n, final int k) throws NotPositiveException, NumberIsTooLargeException, MathArithmeticException { return CombinatoricsUtils.binomialCoefficientDouble(n, k);
public static double binomialCoefficientDouble(final int n, final int k) throws NotPositiveException, NumberIsTooLargeException, MathArithmeticException { return CombinatoricsUtils.binomialCoefficientDouble(n, k);
@Override public Map<Node<Double>, Double> getValidNeighbors(final Collection<? extends Node<Double>> neighborhood) { propensity = 0; neigh = neighborhood.stream() .filter(n -> n instanceof CellNode && n.getConcentration(mol) >= conc) .collect(Collectors.<Node<Double>, Node<Double>, Double>toMap( n -> n, n -> CombinatoricsUtils.binomialCoefficientDouble(n.getConcentration(mol).intValue(), conc.intValue()))); if (!neigh.isEmpty()) { propensity = neigh.values().stream().max((d1, d2) -> d1.compareTo(d2)).get(); } return new LinkedHashMap<>(neigh); }
/** * Propensity influence is computed through the binomial coefficient. See * Bernardo, Degano, Zavattaro - Formal Methods for Computational Systems * Biology for the formulae. * * @return the propensity influence */ @Override public double getPropensityConditioning() { final int n = getNode().getConcentration(molecule).intValue(); final int k = qty.intValue(); if (k > n) { return 0; } return CombinatoricsUtils.binomialCoefficientDouble(n, k); }
/** {@inheritDoc} */ public double probability(int x) { double ret; if (x < 0) { ret = 0.0; } else { ret = CombinatoricsUtils.binomialCoefficientDouble(x + numberOfSuccesses - 1, numberOfSuccesses - 1) * FastMath.pow(probabilityOfSuccess, numberOfSuccesses) * FastMath.pow(1.0 - probabilityOfSuccess, x); } return ret; }
/** * Computes \(P(D_{n,m} > d)\) if {@code strict} is {@code true}; otherwise \(P(D_{n,m} \ge * d)\), where \(D_{n,m}\) is the 2-sample Kolmogorov-Smirnov statistic. See * {@link #kolmogorovSmirnovStatistic(double[], double[])} for the definition of \(D_{n,m}\). * <p> * The returned probability is exact, implemented by unwinding the recursive function * definitions presented in [4] (class javadoc). * </p> * * @param d D-statistic value * @param n first sample size * @param m second sample size * @param strict whether or not the probability to compute is expressed as a strict inequality * @return probability that a randomly selected m-n partition of m + n generates \(D_{n,m}\) * greater than (resp. greater than or equal to) {@code d} */ public double exactP(double d, int n, int m, boolean strict) { return 1 - n(m, n, m, n, calculateIntegralD(d, m, n, strict), strict) / CombinatoricsUtils.binomialCoefficientDouble(n + m, m); }
return binomialCoefficientDouble(n, n - k);
return Math.log(binomialCoefficientDouble(n, k));
@Override public double getPropensityConditioning() { final double totalQuantity = getTotalQuantity(); if (totalQuantity < getQuantity()) { return 0; } return CombinatoricsUtils.binomialCoefficientDouble( (int) FastMath.round(totalQuantity), (int) FastMath.round(getQuantity()) ); }
return binomialCoefficientDouble(n, n - k);
bitsDiffering++; cumulativeProbability += CombinatoricsUtils.binomialCoefficientDouble(numHashes, bitsDiffering) / denominator;
return FastMath.log(binomialCoefficientDouble(n, k));