View source code
Display the source code in std/mathspecial.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aGitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.

Function std.mathspecial.gammaIncompleteCompl

Regularized upper incomplete gamma function Q(a,x)

real gammaIncompleteCompl(
  real a,
  real x
) pure nothrow @nogc @safe;

Mathematically, Q(a,x) = Γ(a,x)/Γ(a), where Γ(a,x) is the upper incomplete gamma function, Γ(a,x) = xta-1e-tdt, a > 0 , and x ≥ 0. Note that P(a,x) + Q(a,x) = 1 or Q(a,x) = 1 - P(a,x), so Q is the complement of P.

Parameters

NameDescription
a the shape parameter, must be positive
x the fraction of integration completion from above, must be non-negative

Returns

It returns Q(a,x), an element of [0,1].

Special Values
a x gammaIncompleteCompl(a, x)
negative NAN
< 0 NAN
positive 0 1
positive 0
+0 > 0 0
(0, ∞) 1

See Also

gamma and gammaIncomplete

Example

assert(isClose(gammaIncompleteCompl(2, 1), 2/E));
writeln(gammaIncompleteCompl(1, 0)); // 1
writeln(gammaIncompleteCompl(1, real.infinity)); // 0
writeln(gammaIncompleteCompl(+0., 1)); // 0
writeln(gammaIncompleteCompl(real.infinity, 1)); // 1
assert(isClose(gammaIncompleteCompl(1, 2), 1-gammaIncomplete(1, 2)));

Authors

Stephen L. Moshier (original C code). Conversion to D by Don Clugston

License

Boost License 1.0.