37 Real d = 1.0-qab*x/qap;
44 for (m=1; m<=maxIteration; m++) {
46 aa=m*(
b-m)*x/((qam+m2)*(a+m2));
53 aa = -(a+m)*(qab+m)*x/((a+m2)*(qap+m2));
61 if (std::fabs(del-1.0) < accuracy)
64 QL_FAIL(
"a or b too big, or maxIteration too small in betacf");
71 QL_REQUIRE(a > 0.0,
"a must be greater than zero");
80 QL_REQUIRE(x>0.0 && x<1.0,
"x must be in [0,1]");
84 a*std::log(x) +
b*std::log(1.0-x));
86 if (x < (a+1.0)/(a+
b+2.0))
Beta and beta incomplete functions.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
ext::function< Real(Real)> b
QL_INTEGER Integer
integer number
Real betaContinuedFraction(Real a, Real b, Real x, Real accuracy, Integer maxIteration)
Real incompleteBetaFunction(Real a, Real b, Real x, Real accuracy, Integer maxIteration)
Incomplete Beta function.