Skip to contents

(x1 + ... + xk)^N summed over every composition n1 + ... + nk = N of C(N; n1,...,nk) x1^n1 ... xk^nk, eq (1.38), with the multinomial coefficient of eq (1.37). The total is cross-checked against the direct power.

Usage

MultiExp(xs, N)

Arguments

xs

the k values x1..xk.

N

the power, N >= 0.

Value

list(k, power, n_terms, expansion, direct_power, max_coefficient).

References

Morin, D. J. (2016). Probability: For the Enthusiastic Beginner. Createspace. Eqs. (1.37)-(1.38).

Examples

MultiExp(c(1, 1, 1), 4)$n_terms
#> [1] 15