Learn R Programming

boostmath (version 1.0.0)

factorials_and_binomial_coefficients: Factorials and Binomial Coefficients

Description

Functions to compute factorials, double factorials, rising and falling factorials, and binomial coefficients.

Usage

factorial_boost(i)

unchecked_factorial(i)

max_factorial()

double_factorial(i)

rising_factorial(x, i)

falling_factorial(x, i)

binomial_coefficient(n, k)

Value

A single numeric value with the computed factorial, double factorial, rising factorial, falling factorial, or binomial coefficient.

Arguments

i

Non-negative integer input for factorials and double factorials.

x

Base value for rising and falling factorials.

n

Total number of elements for binomial coefficients.

k

Number of elements to choose for binomial coefficients.

See Also

Boost Documentation for more details on the mathematical background.

Examples

Run this code
# Factorial of 5
factorial_boost(5)
# Unchecked factorial of 5 (using table lookup)
unchecked_factorial(5)
# Maximum factorial value that can be computed
max_factorial()
# Double factorial of 6
double_factorial(6)
# Rising factorial of 3 with exponent 2
rising_factorial(3, 2)
# Falling factorial of 3 with exponent 2
falling_factorial(3, 2)
# Binomial coefficient "5 choose 2"
binomial_coefficient(5, 2)

Run the code above in your browser using DataLab