List of usage examples for org.apache.commons.math MathException toString
public String toString()
From source file:dr.evomodel.epidemiology.casetocase.periodpriors.NormalPeriodPriorDistribution.java
public double calculateLogPosteriorPredictiveCDF(double value, boolean upperTail) { double mean = currentParameters[0]; double sd = Math.sqrt( currentParameters[3] * (currentParameters[1] + 1) / (currentParameters[2] * currentParameters[1])); double scaledValue = (value - mean) / sd; double out;//from w ww .jav a2 s . co m if (2 * currentParameters[2] <= normalApproximationThreshold) { TDistributionImpl tDist = new TDistributionImpl(2 * currentParameters[2]); try { out = upperTail ? Math.log(tDist.cumulativeProbability(-scaledValue)) : Math.log(tDist.cumulativeProbability(scaledValue)); } catch (MathException e) { throw new RuntimeException(e.toString()); } } else { out = upperTail ? NormalDistribution.standardCDF(-scaledValue, true) : NormalDistribution.standardCDF(scaledValue, true); } return out; }
From source file:edu.utexas.cs.tactex.servercustomers.factoredcustomer.ProbabilityDistribution.java
double drawSample() { try {//from ww w .j av a2 s.co m return sampler.sample(); } catch (MathException e) { System.err.println("ProbabilityDistribution(" + toString() + ") - drawSample():" + toString() + " Caught MathException:\n"); e.printStackTrace(System.err); throw new Error("ProbabilityDistribution(" + toString() + ") - drawSample(): Caught MathException: " + e.toString()); } }