[
https://issues.apache.org/jira/browse/NUMBERS-167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17426188#comment-17426188
]
Alex Herbert commented on NUMBERS-167:
--------------------------------------
I've created a [PR 105|https://github.com/apache/commons-numbers/pull/105] for
this. I have added the ability to precompute either term.
{code:java}
double a = 13.0;
double x = 10.0;
RegularizedGamma.P.value(a, x);
RegularizedGamma.ArgumentA argA = RegularizedGamma.ArgumentA.of(a);
RegularizedGamma.ArgumentX argX = RegularizedGamma.ArgumentX.of(x);
RegularizedGamma.P.value(argA, x);
RegularizedGamma.P.value(a, argX);
{code}
The names may be revised, e.g.
{code:java}
RegularizedGamma.ArgumentA argA = RegularizedGamma.argumentA(a);
{code}
Precomputation of the term a is useful for the Erf functions in the same
package which call:
{code:java}
RegularizedGamma.Q.value(0.5, x * x)
{code}
Precomputation of the term x is useful for the PoissonDistribution in
statistics which calls this for the cumulative probability function:
{code:java}
RegularizedGamma.Q.value((double) x + 1, mean);
{code}
Please review.
> RegularizedGamma.P with precomputed LogGamma value
> --------------------------------------------------
>
> Key: NUMBERS-167
> URL: https://issues.apache.org/jira/browse/NUMBERS-167
> Project: Commons Numbers
> Issue Type: Wish
> Components: gamma
> Reporter: Gilles Sadowski
> Priority: Minor
> Fix For: 1.1
>
>
> We have
> {code:java}
> double v = RegularizedGamma.P.value(a, x);
> {code}
> where method {{value}} internally calls {{LogGamma.value(a)}}.
> There is a use-case for
> {code:java}
> double logGammaA = LogGamma.value(a);
> double v = RegularizedGamma.P.value(a, x, logGammaA);
> {code}
> for when the user varies {{x}} but not {{a}}.
> Method name TBD: Another overload of {{value}} may be confusing (?).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)