The factorial function is table driven for small arguments, and is
implemented in terms of __tgamma for larger arguments.
-[endsect]
+[endsect] [/section:sf_factorial Factorial]
[section:sf_double_factorial Double Factorial]
[h4 Testing]
-The spot tests for the double factorial use data
-generated by functions.wolfram.com.
+The spot tests for the double factorial use data generated by __WolframAlpha.
[h4 Implementation]
The double factorial is implemented in terms of the factorial and gamma
functions using the relations:
-(2n)!! = 2[super n ] * n!
+[expression ['(2n)!! = 2[super n ] * n!]]
-(2n+1)!! = (2n+1)! / (2[super n ] n!)
+[expression ['(2n+1)!! = (2n+1)! / (2[super n ] n!)]]
and
-(2n-1)!! = [Gamma]((2n+1)/2) * 2[super n ] / sqrt(pi)
+[expression ['(2n-1)!! = [Gamma]((2n+1)/2) * 2[super n ] / sqrt(pi)]]
-[endsect]
+[endsect] [/section:sf_double_factorial Double Factorial]
[section:sf_rising_factorial Rising Factorial]
Returns the rising factorial of /x/ and /i/:
-rising_factorial(x, i) = [Gamma](x + i) / [Gamma](x);
+[expression ['rising_factorial(x, i) = [Gamma](x + i) / [Gamma](x)]]
or
-rising_factorial(x, i) = x(x+1)(x+2)(x+3)...(x+i-1)
+[expression ['rising_factorial(x, i) = x(x+1)(x+2)(x+3)...(x+i-1)]]
Note that both /x/ and /i/ can be negative as well as positive.
[h4 Testing]
-The spot tests for the rising factorials use data generated
-by functions.wolfram.com.
+The spot tests for the rising factorials use data generated by __Wolfram_functions.
[h4 Implementation]
-Rising and falling factorials are implemented as ratios of gamma functions
-using __tgamma_delta_ratio. Optimisations for
-small integer arguments are handled internally by that function.
+Rising and factorials are implemented as ratios of gamma functions using __tgamma_delta_ratio.
+Optimisations for small integer arguments are handled internally by that function.
-[endsect]
+[endsect] [/section:sf_rising_factorial Rising Factorial]
[section:sf_falling_factorial Falling Factorial]
Returns the falling factorial of /x/ and /i/:
-falling_factorial(x, i) = x(x-1)(x-2)(x-3)...(x-i+1)
+[expression ['falling_factorial(x, i) = x(x-1)(x-2)(x-3)...(x-i+1)]]
Note that this function is only defined for positive /i/, hence the
`unsigned` second argument. Argument /x/ can be either positive or
[h4 Testing]
-The spot tests for the falling factorials use data generated by
-functions.wolfram.com.
+The spot tests for the falling factorials use data generated by __Wolfram_functions.
[h4 Implementation]
using __tgamma_delta_ratio. Optimisations for
small integer arguments are handled internally by that function.
-[endsect]
+[endsect] [/section:sf_falling_factorial Falling Factorial]
[section:sf_binomial Binomial Coefficients]
to represent in type T.
[important
-The functions described above are templates where the template argument T can not be deduced from the
+The functions described above are templates where the template argument `T` can not be deduced from the
arguments passed to the function. Therefore if you write something like:
`boost::math::binomial_coefficient(10, 2);`
[h4 Testing]
-The spot tests for the binomial coefficients use data
-generated by functions.wolfram.com.
+The spot tests for the binomial coefficients use data generated by __WolframAlpha.
[h4 Implementation]
Binomial coefficients are calculated using table lookup of factorials
where possible using:
-[sub n]C[sub k] = n! / (k!(n-k)!)
+[expression ['[sub n]C[sub k] = n! / (k!(n-k)!)]]
Otherwise it is implemented in terms of the beta function using the relations:
-[sub n]C[sub k] = 1 / (k * __beta(k, n-k+1))
+[expression ['[sub n]C[sub k] = 1 / (k * __beta(k, n-k+1))]]
and
-[sub n]C[sub k] = 1 / ((n-k) * __beta(k+1, n-k))
-
-[endsect]
+[expression ['[sub n]C[sub k] = 1 / ((n-k) * __beta(k+1, n-k))]]
+[endsect] [/section:sf_binomial Binomial Coefficients]
-[endsect][/section:factorials Factorials]
+[endsect] [/section:factorials Factorials]
[/
Copyright 2006, 2010 John Maddock and Paul A. Bristow.