# How to get the right approximation for a series involving the harmonic number?

The right numerical value of the closed form of $$\sum_{n=1}^\infty\frac{4^n H_n^2}{{2n\choose n}n^2}$$ is $$40.66752074791188333...$$.

I tried to verify this result on Mathematica using the command:

NSum[4^n HarmonicNumber[n]^2/(Binomial[2 n, n] n^2), {n, 1, Infinity},
WorkingPrecision -> 8]


but it failed to give any approximation, so I replaced Infinity by 1000 000 and it gave 39.70 which is close to the numeric value of the closed form. My question is: why Mathemtica fails to give the right approximation for series involving the binomial series when we use Infinity?. Other question is: is there another command besides

NSum[4^n HarmonicNumber[n]^2/(Binomial[2 n, n] n^2), {n, 1, 1000000},
WorkingPrecision -> 8]


that gives a more accurate approximation?

• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is useful for learning how to format your questions and answers. You may also find this meta Q&A helpful Feb 28 at 18:51
• Are you sure about the right numerical value? Because I find $40.66752074791188\ldots$ Feb 28 at 18:59
• I get the same as @Roman Feb 28 at 19:03
• @Roman thank you. Yes the value you mentioned is the right one. I edited my post. I would like to know the command you used. Feb 28 at 19:15
• @Michael E2 Thank you Michael. Whats the command you used and gave you 40.66...? Feb 28 at 19:27

The terms in the asymptotic expansion of the summand may be summed symbolically and thereby determine the major component of the desired sum. This helps NSum deal with the remainder. I'm not an expert on numerical summation, and I know neither why the sum is numerically difficult (other than convergence is very slow) nor what better methods/transformations might be applied (even if the method is not available in NSum). This approach worked, so I didn't go looking for other ways to accelerate convergence.

The majorsum converges very slowly toward the desired sum, but increasing the order improves the ability of NSum to deal with the remainder. Both Sum and NSum take a few seconds to run.

order = 12;
major = Normal@Series[
4^n HarmonicNumber[n]^2/(Binomial[2 n, n] n^2),
{n, Infinity, order}];
majorsum = Sum[major, {n, Infinity}];

majorsum + NSum[
4^n HarmonicNumber[n]^2/(Binomial[2 n, n] n^2) - major,
{n, 1, Infinity},
NSumTerms -> 50, WorkingPrecision -> 50, Method -> "WynnEpsilon"]

(*  40.66752074791188333784746413477  *)

• Amazing. thank you very much.+1 Feb 28 at 20:14
• whats order=12 and NSumTerms-> 50 stand for? and does 50 in NSumTerms and WorkingPrecision has to be the same? Feb 28 at 20:20
• They are described in the docs. Sum[expr, {n, Infinity, order}] gives a series of order order. The others are described in NSum. Feb 28 at 23:50
• Thanks. By the way, I compared your command to approximate the zeta(6) with N[Zeta[6],100] and the error was zero. Interesting! Mar 1 at 4:14
• @AliShadhar Oops, *Series[expr, {n, Infinity, order}], not Sum[...]. :) Mar 1 at 17:13

Here is a somewhat different way. First, we approximate the summand for big n. Second, we exactlly summarize that approximated summand from 20 to Infinity. Third, we add the first 19 terms.

Normal[Series[4^n HarmonicNumber[n]^2/(Binomial[2 n, n]* n^2),{n, Infinity,20}]];
Sum[%, {n, 20, Infinity}];
N[%, 20] + Sum[4^n HarmonicNumber[n]^2/(Binomial[2 n, n] n^2), {n, 1, 19}]


40.667520747911883338

• Beautiful command. thank you .+1 Feb 28 at 20:37
• BTW, the error can be estimated here. The one is of order $20^{-18}$ at first sight. Feb 28 at 21:08
• Can you give more digits for approximation ? Mar 1 at 0:40
• @AliShadhar: Let us change the last two lines by Sum[%, {n, 25, Infinity}]; N[%, 42] + Sum[4^n HarmonicNumber[n]^2/(Binomial[2 n, n] n^2), {n, 1, 24}]. This produces 40.6675207479118833378474641375573196174775. In most cases such precision is not needed. Mar 1 at 7:42