UditArora2000 commented on issue #8: Addition of Log Cauchy Distribution URL: https://github.com/apache/commons-statistics/pull/8#issuecomment-498005751 Sir I will be doing it. Just familiarising myself with the function. Sorry for the delay.. On Mon, 20 May 2019, 6:13 pm Alex Herbert, <[email protected]> wrote: > 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. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/apache/commons-statistics/pull/8?email_source=notifications&email_token=ALY6VOZH47XOMMI76XYVW3LPWKMIJA5CNFSM4HNWMMS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVYWNUQ#issuecomment-493971154>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/ALY6VO4ZFZI37E74EANY4HDPWKMIJANCNFSM4HNWMMSQ> > . >
---------------------------------------------------------------- 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
