pub const fn binomial(n: usize, k: usize) -> usizeExpand description
Computes the binomial coefficient C(n, k) = n! / (k! * (n-k)!).
This gives the number of blades of grade k in an n-dimensional algebra.
ยงExample
use clifford_codegen::algebra::binomial;
// Number of bivectors in 3D: C(3, 2) = 3
assert_eq!(binomial(3, 2), 3);
// Number of vectors in 4D: C(4, 1) = 4
assert_eq!(binomial(4, 1), 4);
// Number of scalars: always 1
assert_eq!(binomial(5, 0), 1);
// Edge cases
assert_eq!(binomial(5, 5), 1);
assert_eq!(binomial(5, 6), 0); // k > n