def cum2mc(kappa):
 mc = [1, 0.0]
 kappa0 = kappa[0]
 kappa = ([1] + list(kappa))
 for (nn, m) in enumerate(kappa[2:]):
  n = (nn + 2)
  mc.append(0)
  for k in range((n - 1)):
   mc[n] += ((comb((n - 1), k, exact=1) * kappa[(n - k)]) * mc[k])
 mc[1] = kappa0
 return mc[1:]

def cum2mc ( kappa ) : mc = [ 1 , 0.0 ] kappa0 = kappa [ 0 ] kappa = ( [ 1 ] + list ( kappa ) ) for ( nn , m ) in enumerate ( kappa [ 2 : ] ) : n = ( nn + 2 ) mc . append ( 0 ) for k in range ( ( n - 1 ) ) : mc [ n ] += ( ( comb ( ( n - 1 ) , k , exact = 1 ) * kappa [ ( n - k ) ] ) * mc [ k ] ) mc [ 1 ] = kappa0 return mc [ 1 : ]
convert non-central moments to cumulants recursive formula produces as many cumulants as moments references kenneth lange: numerical analysis for statisticians .