1function sigma = moment_stirlingcycle(n)
2% sigma = moment_stirlingcycle(n)
4% Triangle of
the Stirling cycle numbers (
unsigned Stirling numbers of
the
5% first kind), sigma(i,j) = (-1)^(i-j) * s(i,j), obtained from
the recursion
7% sigma(i,j) = (i-1)*sigma(i-1,j) + sigma(i-1,j-1) for j > 0
8% sigma(0,0) = 1, sigma(i,0) = 0 for i > 0
10% These numbers are
the coefficients that convert power moments into
11% upward-factorial moments.
14% n: maximum order (n >= 0)
17% sigma: (n+1)x(n+1) matrix with sigma(i+1,j+1) = sigma(i,j) in
the 0-based
18% notation of
the reference. Entries with j > i are zero.
21% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
22% distributions. PMCCS, 2003, eq. (12).
25% sigma = moment_stirlingcycle(3)
27if ~isscalar(n) || n < 0 || n ~= round(n)
28 line_error(mfilename,'The maximum order n must be a nonnegative integer.');
30sigma = zeros(n+1,n+1);
34 sigma(i+1,j+1) = (i-1)*sigma(i,j+1) + sigma(i,j);