Returns the regularized gamma function P(a,z) = γ(a,z)/Γ(a). This method is more numerically stable and accurate than computing it via the direct method, and is always in the range [0,1]. Note: The this method returns Double#NaN for a<0, though real values of P(a,z) do exist
(double a, double z)
| 682 | * @return P(a,z) |
| 683 | */ |
| 684 | public static double gammaP(double a, double z) |
| 685 | { |
| 686 | if(z<= 0 || a < 0) |
| 687 | return Double.NaN; |
| 688 | |
| 689 | if(z < a+1) |
| 690 | return gammaPSeries(a, z); |
| 691 | |
| 692 | /* |
| 693 | * This method is currently usntable for values of z that grow larger, so it is not currently in use |
| 694 | * return exp(a*log(z)-z-lnGamma(a))/gammaP.lentz(a,z); |
| 695 | */ |
| 696 | return 1 - gammaQ(a, z); |
| 697 | } |
| 698 | |
| 699 | /** |
| 700 | * Finds the value <tt>x</tt> such that {@link #gammaP(double,double) P(a,x)} = <tt>p</tt>. |
no test coverage detected