aherbert commented on issue #8: Addition of Log Cauchy Distribution URL: https://github.com/apache/commons-statistics/pull/8#issuecomment-493971154 Looking at the sister CauchyDistribution you should be able to define the method: ``` /** * {@inheritDoc} * * Returns {@code 0} when {@code p == 0} * and {@code Double.POSITIVE_INFINITY} when {@code p == 1}. */ @Override public double inverseCumulativeProbability(double p) { double ret; if (p < 0 || p > 1) { throw new DistributionException(DistributionException.OUT_OF_RANGE, p, 0, 1); } else if (p == 0) { ret = 0; } else if (p == 1) { ret = Double.POSITIVE_INFINITY; } else { ret = Math.exp(location + scale * Math.tan(Math.PI * (p - .5))); } return ret; } ``` Also this may be a worthwhile optimisation: ``` /** {@inheritDoc} */ @Override public double logDensity(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } final double logX = Math.log(x); final double dev = logX - location; return Math.log((1 / Math.PI) * (scale / (dev * dev + scale * scale))) - logX; } ``` It is the the same as `Math.log(density(x))` but should be investigated to see if it expands the range of x that can be computed.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
