import uk.ac.cam.ch.wwmm.ptclib.xml.XOMTools;
public class ReactCollocations {
public static double binomialProbEqualGreater(int trials, int success, double prob) throws MathException {
BinomialDistribution bd = new BinomialDistributionImpl(trials, prob);
double score = 0;
for(int i=success;i<=trials;i++) {
score += bd.probability(i);
}
//double score = bd.cumulativeProbability(success-1);
System.out.println("bd:\t" + trials + "\t" + success + "\t" + prob + "\t" + (1.0-score) + "\t" + bd.cumulativeProbability(success-1));
return 1.0 - score;
}