[

https://issues.apache.org/jira/browse/MATH-981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13667631#comment-13667631 ]

Thomas Neidhart commented on MATH-981:

--------------------------------------

It is not actually more accurate than the existing implementation, at least I am not sure as I just compared the existing one with the new one. I have no idea yet how accurate the existing implementation is.

The algorithm itself comes with a so-called refinement procedure to reduce the error:

||Method||Error vs. Current||Speed vs. Current||

|New|< 1e-8|~ factor 10 faster|

|New + Refinement|< 1e-10|slightly slower|

Now there are some use-cases where the accuracy of this algorithm is sufficient and the speed improvement would be quite interesting. One example is the RandomGenerator#nextGaussian() method. Right now, the BitsStreamGenerator (which is the base class for many of the fast ones like Well and MersenneTwister), does use a clever technique involving trigonometry functions to do the transformation from [0, 1] to a normally distributed value. This is much faster than calling inverseCumulativeProbability() on a normal distribution. The proposed algorithm is even faster than this method, so we could consider using it for this purpose.

We could also add this algorithm as FastMath#getInverseCDF(boolean errorCorrection) in case somebody wants to use a fast but less accurate variant of this.

This is especially interesting for Monte Carlo simulations imho.

> An improved algorithm for computing the inverse cumulative probability for the normal distribution

> --------------------------------------------------------------------------------------------------

>

> Key: MATH-981

> URL:

https://issues.apache.org/jira/browse/MATH-981> Project: Commons Math

> Issue Type: Sub-task

> Reporter: Thomas Neidhart

> Priority: Minor

>

> The following page outlines an algorithm (and alternative algorithms) to compute the inverse cumulative probability for the normal distribution:

>

http://home.online.no/~pjacklam/notes/invnorm/> An implementation of this is also included in the referred contribution for a Monte Carlo engine.

--

This message is automatically generated by JIRA.

If you think it was sent incorrectly, please contact your JIRA administrators

For more information on JIRA, see:

http://www.atlassian.com/software/jira