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.gammaIncomplete

Regularized lower incomplete gamma function P(a,x)

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

Mathematically, P(a,x) = γ(a,x)/Γ(a), where γ(a,x) is the lower incomplete gamma function, γ(a,x) = 0xta-1e-tdt, a > 0, and x ≥ 0.

Parameters

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

Returns

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

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

See Also

gamma and gammaIncompleteCompl

Example

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

Authors

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

License

Boost License 1.0.