Approximating Harmonic numbers $H_n$ with degree 3 polynomial and $\ln$.

asymptoticsharmonic-numberslogarithmspolynomials

Suppose we want to understand when an harmonic number is close to an integer.
Then we understand how fast the harmonic series grows.

$$H_n = v$$

The series expansion of the harmonic number is
$$H_n=\gamma +\log \left({n}\right)+\frac{1}{2n}+O\left(\frac{1}{n^2}\right)$$
Neglecting the higher order terms, you then need to solve for $n$ the equation
$$\gamma +\log \left({n}\right)+\frac{1}{2 n}-v=0$$ the solution of which being given in terms of the famous Lambert-W function.
$$n=-\frac{1}{2 W\left(-\dfrac{e^{\gamma -v}}{2}\right)}$$ Since the argument is small, you can approximate, for small $v$.

It is a famous conjecture apparantly that

$$ f(v) = \operatorname{floor}\left( \exp(n – \gamma) – \frac{1}{2} \right) $$

Which I asked about earlier :

Simple formula for $H_n = m + \alpha $?

*** quote from the link : ***

Let $H_i$ be the $i$ th harmonic number.
For a given positive integer $m$ we want to find the smallest possible positive integer value $n$ such that $H_n = m + \alpha $, where $\alpha > 0$.

Let us define the solution as $f(m) = n$

Let $\operatorname{floor}$ be defined as rounding downwards.
Examples $\operatorname{floor}(3,14) = 3 , \operatorname{floor}(9,99999) = 9 $)

Let $\gamma$ be the Euler-Mascheroni constant.

Now it appears that $f(m) $ has a simple closed form :

$$ f(m) = \operatorname{floor}\left( \exp(n – \gamma) – \frac{1}{2} \right) $$

*** end quote ***

I will also paste an important part of an answer (by Alex Ravsky) there :

*** quote answer ***

For $k\ge 1$, $$\log(k + 1/2) + \gamma < H_k< \log(k + 1/2) + \gamma + 1/(24k^2),$$ where $\gamma$ is Euler's constant (A001620). It is likely that the upper and lower bounds have the same floor for all $k\ge2$, in which case $a(n) = \lfloor \exp(n-\gamma) + 1/2\rfloor$ for all $n\ge 0$.
This remark is based on a simple heuristic argument. The lower and upper bounds differ by $1/(24k^2)$, so the probability that there's an integer between the two bounds is $1/(24k^2)$. Summing that over all $k\ge 2$ gives the expected number of values of $k$ for which there's an integer between the bounds. That sum equals $\pi^2/144 – 1/24 \approx 0.02687$. That's much less than $1$, so it is unlikely that there are any such values of $k$. – Dean Hickerson, Apr 19 2003

*** end quote ***

So good approximations help to understand when the harmonic numbers cross an integer or are close to an integer.
But the situation is more complex as demonstrated by the above.

But lets try better approximations.

It is also known that

$$H_n=\gamma +\log \left({n}\right)+\frac{1}{2n}+\frac{-1}{12 n^2} + \frac{1}{120 n^4} – …)$$

where the coefficients beyong $1/2$ are $\zeta(1-2n)$ and the powers are even ( $n^{-2},n^{-4},n^{-6},…$)

And we know the boundaries

$$\frac{1}{2(n+1)} < H_n -\gamma -\log \left({n}\right) < \frac{1}{2n}$$

Or the sharper one

$$\frac{1}{24(n+1)^2} < H_n -\gamma -\log \left({n+\frac{1}{2}}\right) < \frac{1}{24 n^2}$$

How does one continue ?

It seems natural to either use more laurent terms, and that is what I see most sources do.

OR we continue that path of more accurute log type functions.

The philosophy is

$$\frac{1}{(n+1)^k} < H_n -\gamma -betterlog \left({n}\right) < \frac{1}{n^k}$$

where $k$ is maximilized and "better log" is a increasingly better log type function.

More specific

$$betterlog(x) = \frac{log(a_0 + a_1 x + a_2 x^2 + a_3 x^3 + … a_m x^m)}{m}$$

Which also imply that in the limit " betterlog " becomes "best log" , the $k$ in

$$\frac{1}{(n+1)^k} < H_n -\gamma -betterlog \left({n}\right) < \frac{1}{n^k}$$

goes to +infinity.

Also the coefficients $a_0,a_1,…$ are preferred positive.
( and in fact rational )

Also it seems and is desired that $k$ is close to $m$.

This probably implies indirectly that we get superclose approximations for $H_n$, that then essentially only depend on $n$ ( for large $k$ and $m$ relative to $n$ ) and the rational approximations of the euler's gamma constant. Which is somewhat of an argument for irrationality perhaps.

I have also seen a mix of this idea with laurent terms :

$$H_n \sim \frac{1}{2} \log
\left(n^2+n+\frac{1}{2}\right)+\gamma-\frac{1}{12 \left(n^2+n+\frac{1}{2}\right)}$$

( I think conjectured by user Claude Leibovici from MSE here )

But I want to go down the road of logs and I will explain why.

If we write $H_n – H_{n-1}$ we essentially cancel the $\gamma$ constant !

so
$$H_n – H_{n-1} = \frac{1}{n} = \frac{\ln(a_0 + a_1 n + a_2 n^2 + …)}{m} – \frac{\ln(a_0 + a_1 (n-1) + a_2 (n-1)^2 + …)}{m} $$

suddenly makes more sense.

We know $\ln(n) – \ln(n-1)$ is a poor approximation to $\frac{1}{n}$ but higher terms do better.

Such as $\ln(n+1/2) – \ln(n – 1 + 1/2)$.

So basicly the idea is

$$\frac{\ln(a_0 + a_1 n + a_2 n^2 + …) – \ln(a_0 + a_1 (n-1) + a_2 (n-1)^2 + …)}{m} – \frac{1}{n} $$

should be minimized with respect to $k$ in a big-O notation like $O(n^{-k})$.
Critics might argue this is limiting behaviour and it might not work well for smaller $n$ and perhaps even not give strong bounds valid for all $n$ ( also the small ).

However this is why the $a_0,a_1,…$ are required to be positive !
This should prevent bad behaviour for relatively small $n$.
Although I do assume it might only becomes good asymptotics for something like $n > m^2$.

I have only sketched a small part of the idea and I can anticipate more criticism and question but lets not make this too long.

Let me get to the point, I explained how and why I went down the road so now I present the approximation

$$H_n = \gamma + \frac{\ln(\frac{8}{7} n^3 + \frac{12}{7} n^2 + n + \frac{1}{2})}{3}$$

Hence the title : Approximating Harmonic numbers $H_n$ with degree 3 polynomial and log.

Now if I take the difference of both sides of the last equation and then substract $\frac{1}{n}$, I get an error term going to $0$.

I think that error term is at most $O(\frac{1}{n^3})$.

In fact the Laurent series starts as $\frac{1}{4n^4} + …$.

( Finally I believe that adding a few floor functions makes things complete but that is another topic and not the main point here )

What do you think about this approximation

$$H_n = \gamma + \frac{\ln(\frac{8}{7} n^3 + \frac{12}{7} n^2 + n + \frac{1}{2})}{3}$$

??

And why have I never seen it before ?

Best Answer

It is not difficult to see that such approximations exist. The complete asymptotic expansion of the $n$th harmonic number is given by $$ H_n \sim \gamma + \log n + \frac{1}{2}\frac{1}{n} - \sum\limits_{k = 1}^\infty {\frac{{B_{2k} }}{{2k}}\frac{1}{{n^{2k} }}} $$ as $n\to+\infty$, where $B_k$ denotes the Bernoulli numbers. Let $m\ge 1$ be an integer. Then we can re-write the right-hand side, formally, as $$ \gamma + \frac{1}{m}\log \!\bigg[ {n^m \exp\! \bigg( {m\bigg( {\frac{1}{2}\frac{1}{n} - \sum\limits_{k = 1}^\infty {\frac{{B_{2k} }}{{2k}}\frac{1}{{n^{2k} }}} } \bigg)} \bigg)} \bigg]. $$ Series expansion yields $$ \exp\! \bigg( {m\bigg( {\frac{1}{{2n}} - \sum\limits_{k = 1}^\infty {\frac{{B_{2k} }}{{2k}}\frac{1}{{n^{2k} }}} } \bigg)} \bigg) = 1 + \frac{m}{2}\frac{1}{n} + \frac{{m(3m - 2)}}{{24}}\frac{1}{{n^2 }} + \frac{{m^2 (m - 2)}}{{48}}\frac{1}{{n^3 }} + \ldots, $$ where the general term may be expressed in terms of complete Bell polynomials. Consequently, $$ H_n \sim \gamma + \frac{1}{m}\log \!\bigg( {n^m + \frac{m}{2}n^{m - 1} + \frac{{m(3m - 2)}}{{24}}n^{m - 2} + \frac{{m^2 (m - 2)}}{{48}}n^{m - 3}+ \ldots } \bigg) $$ as $n\to+\infty$. For $m=3$, this gives an approximation which is asymptotically more accurate than yours: $$ H_n \sim \gamma + \frac{1}{3}\log \left( {n^3 + \frac{3}{2}n^2 + \frac{7}{8}n + \frac{3}{{16}}} \right). $$ This paper may be of interest for you in solving $H_n=v$.

Related Question