Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

Real QuantLib::incompleteGammaFunction ( Real  a,
Real  x,
Real  accuracy = 1.0e-13,
Integer  maxIteration = 100 

Incomplete Gamma function.

Incomplete Gamma function

The implementation of the algorithm was inspired by "Numerical Recipes in C", 2nd edition, Press, Teukolsky, Vetterling, Flannery, chapter 6

Definition at line 32 of file incompletegamma.cpp.

References QL_REQUIRE.


        QL_REQUIRE(a>0.0, "non-positive a is not allowed");

        QL_REQUIRE(x>=0.0, "negative x non allowed");

        if (x < (a+1.0)) {
            // Use the series representation
            return incompleteGammaFunctionSeriesRepr(a, x,
                accuracy, maxIteration);
        } else {
            // Use the continued fraction representation
            return 1.0-incompleteGammaFunctionContinuedFractionRepr(a, x,
                accuracy, maxIteration);


Generated by  Doxygen 1.6.0   Back to index