public static double quantile(double p,double alpha,double beta){
  if (Double.isNaN(alpha) || Double.isNaN(beta) || Double.isNaN(p)|| alpha < 0. || beta < 0.) {
    return Double.NaN;
  }
  if (p < 0 || p > 1) {
    return Double.NaN;
  }
  if (p == 0) {
    return 0.0;
  }
  if (p == 1) {
    return 1.0;
  }
  if (p > 0.5) {
    return 1 - rawQuantile(1 - p,beta,alpha,logBeta(beta,alpha));
  }
 else {
    return rawQuantile(p,alpha,beta,logBeta(alpha,beta));
  }
}

public static double quantile ( double p , double alpha , double beta ) { if ( Double . isNaN ( alpha ) || Double . isNaN ( beta ) || Double . isNaN ( p ) || alpha < 0. || beta < 0. ) { return Double . NaN ; } if ( p < 0 || p > 1 ) { return Double . NaN ; } if ( p == 0 ) { return 0.0 ; } if ( p == 1 ) { return 1.0 ; } if ( p > 0.5 ) { return 1 - rawQuantile ( 1 - p , beta , alpha , logBeta ( beta , alpha ) ) ; } else { return rawQuantile ( p , alpha , beta , logBeta ( alpha , beta ) ) ; } }
compute quantile ( inverse cdf ) for beta distributions .
