I'm trying to evaluate the following sums that nest into eachother:
$$ m_k=\frac{k}{k-1} \left(e^{\gamma}+ \sum_{i=1}^{k-2} {k-1\choose i} \frac{m_i}{i} \right) \\ m_1=e^\gamma $$ and $$ \kappa_n = m_n - \sum_{i=1}^{n-1} {n-1 \choose i}m_i\kappa_{n-i} \\ \kappa_1 = m_1 $$
With the following code:
moment[1] = E^(EulerGamma);
moment[k_] :=
k/(k - 1) (E^(EulerGamma) +
Sum[Binomial[(k - 1), i]*moment[i]/i, {i, 1, k - 2}])
and
cum[1] = moment[1];
cum[n_] :=
moment[n] -
Sum[moment[i]*cum[n - i]*Binomial[n - 1, i], {i, 1, n - 1}]
But it's calculating wrong on $\kappa_4$. Am I missing something?
The results I'm trying to replicate come from a paper that offer the first 4 values of $\kappa$ to be:
$$ 1.781072 \quad 0.3899259 \quad 0.2814155 \quad 0.2399205 $$ And my results are: $$ 1.78107 \quad 0.389926 \quad 0.281416 \quad -3.32222$$
moment[2]
equal to $2 e^{\gamma }$ ? I ask because theSum
goes from $i=1$ to $i=k-2$ which is $i=1$ to $i=0$. $\endgroup$