def mnc2mc(mnc, wmean=True):
 n = len(mnc)
 mean = mnc[0]
 mnc = ([1] + list(mnc))
 mu = []
 for (n, m) in enumerate(mnc):
  mu.append(0)
  for k in range((n + 1)):
   mu[n] += (((((-1) ** (n - k)) * comb(n, k, exact=1)) * mnc[k]) * (mean ** (n - k)))
 if wmean:
  mu[1] = mean
 return mu[1:]

def mnc2mc ( mnc , wmean = True ) : n = len ( mnc ) mean = mnc [ 0 ] mnc = ( [ 1 ] + list ( mnc ) ) mu = [ ] for ( n , m ) in enumerate ( mnc ) : mu . append ( 0 ) for k in range ( ( n + 1 ) ) : mu [ n ] += ( ( ( ( ( - 1 ) ** ( n - k ) ) * comb ( n , k , exact = 1 ) ) * mnc [ k ] ) * ( mean ** ( n - k ) ) ) if wmean : mu [ 1 ] = mean return mu [ 1 : ]
convert non-central to central moments .