I just came across that previously unknown to me approximation $$ \frac{x}{\sinh(x)} \approx \frac{1}{\cosh^2(4x/\pi^2)} $$ It shows astonishing precision (plotted are both curves on top of each other):

Plot of both functions on top of each other

I am looking for an (analytical) derivation/explanation of that formula. (Expansion in Taylor series is not an explanation because it does not provide the reason for its existence.)

Analytically, both functions differ at large $x$ but there the function is already very small so the absolute error is minimal anyway (while the relative error might be considerable).

The appearance of the coefficient $4/\pi^2$ can be motivated by requiring both sides to have the same integral over $[0,\infty)$ which is exactly $\pi^2/4$. But the almost identical form of both functions remains mysterious to me.

Update: From the Euler Gamma function we find $$ \left|\Gamma\left(1+i x\right)\right|^2 = \frac{\pi x}{\sinh(\pi x)} $$ Can this be helpful? $$ \left|\Gamma\left(\frac{1}{2}+i x\right)\right|^2 = \frac{\pi}{\cosh(\pi x)} $$

  • 1
    $\begingroup$ Why exactly is expansion in Taylor series not an explanation? I'd also add that this will not perform well in relative terms for large $x$, as the RHS decays asymptotically as $e^{-8x/\pi^2}$ while the LHS decays as $e^{-x}$ (so the asymptotic coefficients differ by almost 0.2). $\endgroup$
    – Ian
    Oct 28, 2021 at 17:26
  • $\begingroup$ @Ian Thanks for your comment. I updated the question. $\endgroup$
    – Nikodem
    Oct 28, 2021 at 17:33
  • $\begingroup$ I'm not sure that it doesn't, actually; you can analytically read off that the error vanishes at $x=0$ to first order, and it seems like the coefficients may be small enough that they may be connected to some kind of decent approximations of $\pi^{4k}$. For example the first coefficient is less than 0.003. Is the series also alternating? I'm not sure whether it is or not. It might be easier to check if you take reciprocals (though this would also emphasize how this doesn't actually perform well for large $x$.) $\endgroup$
    – Ian
    Oct 28, 2021 at 17:35
  • 2
    $\begingroup$ This live Sage script plots the difference or ratio of the functions, in PNG & SVG. $\endgroup$
    – PM 2Ring
    Oct 29, 2021 at 11:02
  • $\begingroup$ We can make a bit better. Have a look at my edit $\endgroup$ Oct 30, 2021 at 5:49

2 Answers 2


Using series $$\frac{x}{\sinh(x)}=1-\frac{x^2}{6}+\frac{7 x^4}{360}-\frac{31 x^6}{15120}+O\left(x^8\right)$$ $$\text{sech}^2\left(\frac{4 x}{\pi ^2}\right)=1-\frac{16 x^2}{\pi ^4}+\frac{512 x^4}{3 \pi ^8}-\frac{69632 x^6}{45 \pi ^{12}}+O\left(x^8\right)$$ Compare the coefficients $$\frac{1}{6}=0.166667 \qquad \text{while}\qquad \frac{16}{\pi ^4} = 0.164256$$ $$\frac{7 }{360}=0.0194444\qquad \text{while}\qquad \frac{512 }{3 \pi ^8}=0.0179866$$ $$\frac{31 }{15120}=0.00205026\qquad \text{while}\qquad \frac{69632 }{45 \pi ^{12}}=0.00167416$$

The numbers are sufficiently close to explain the similarity.

Now, $$\int_0^t \Bigg[\frac{x}{\sinh(x)}-\text{sech}^2\left(\frac{4 x}{\pi ^2}\right)\Bigg]\,dx$$ shows a maximum error of $0.003434$ close to $t=5.192$


You could have a bit better considering $$\frac{x}{\sinh(x)}-\text{sech}^2\left(k x\right)=\left(k^2-\frac{1}{6}\right) x^2+\left(\frac{7}{360}-\frac{2 k^4}{3}\right) x^4+O\left(x^6\right)$$ Choosing $k=\frac{1}{\sqrt{6}}$ which is close to $\frac 4 {\pi^2}$ ($0.408248$ to be compared to $0.405285$), the maximum error for the integral is $0.01952$ close to $t=6.385$.

Concerning the series $$\frac{x}{\sinh(x)}=1-\frac{x^2}{6}+\frac{7 x^4}{360}-\frac{31 x^6}{15120}+O\left(x^8\right)$$ $$\text{sech}^2\left(\frac{x}{\sqrt{6}}\right)=1-\frac{x^2}{6}+\frac{x^4}{54}-\frac{17 x^6}{9720}+O\left(x^8\right)$$ Comparing the coefficients $$\frac{7 }{360}=0.0194444\qquad \text{while}\qquad \frac{1 }{54 }=0.0185185$$ $$\frac{31 }{15120}=0.00205026\qquad \text{while}\qquad \frac{17 }{9720 }=0.00174897$$

Update (after your answer to your own question)

Willing to keep the nice $\frac{4 }{\pi ^2}$ factor, I minimized the function $$f(\epsilon)=\int_0^\infty \Bigg[x\, \text{csch}(x)-\text{sech}^2\left(\frac{4 (1+\epsilon)}{\pi ^2}x\right)\Bigg]^2\,dx$$ and obtained, as a simple approximation of the optimum $$\epsilon_* \sim -\frac{2 \left(\sqrt{7}-1\right)}{1875}\implies f(\epsilon_*)=9.60\times 10^{-6}$$ This is $10$ times better than with $\frac{1}{\sqrt{6}}$ which gives $9.78\times 10^{-5}$

With $\epsilon=0$, the maximum error is $0.00251$ but with $\epsilon_*$ it becomes $0.00198$.

  • $\begingroup$ However, if $k$ is changed to $\frac1{\sqrt6}$, then the resulting graph becomes visibly different from $\frac x{\sinh x}$. So there's still a coincidence to be sorted out. $\endgroup$ Oct 30, 2021 at 6:42
  • $\begingroup$ @GregMartin. It is the same. Maximum error about $0.007$ instead of $0.002$. May be, you are speaking about PM 2Ring's plot. In this case, sure. Cheers :-) $\endgroup$ Oct 30, 2021 at 9:11
  • $\begingroup$ Only for the coefficient $4/\pi^2$ the integrals over $[0,\infty)$ much together. $\endgroup$
    – Nikodem
    Oct 31, 2021 at 16:00

My best idea so far is to compare the Taylor series of the reciprocal functions (which seems better than the direct Taylor expansions because the functions decay asymptotically to zero). Indeed, the series $$ \sinh(x)/x \approx 1 + \frac{x^2}{6} + \frac{x^4}{120} + \frac{x^6}{5040} + ... $$ $$ \cosh^2(4 x / \pi^2) \approx 1 + \frac{16 x^2}{\pi ^4} + \frac{256 x^4}{3 \pi ^8} + \frac{8192 x^6}{45 \pi ^{12}} + ... $$ $$ \cosh^2(x/\sqrt{6}) \approx 1 + \frac{x^2}{6} + \frac{x^4}{108} + \frac{x^6}{4860} + ... $$ have very similar first four coefficients and their reciprocals are little sensitive to the higher terms (cf. attached figure where all functions and their truncated Taylor expansions are plotted on top of each other). The factor $k = 1/\sqrt{6}$ comes from the direct comparison of the series for $\cosh^2(k x)$ with the series for $\sinh(x)/x$, as also suggested by @Claude Leibovici in his/her answer, and gives better approximation for $|x|<1$. But the maximal error is still lower for $k=4/\pi^2$ (by factor of about $2.7$).

All functions with their truncated Taylor series plotted together

Also the fact that the integral over $[0,\infty)$ of both functions does not match exactly for $k=1/\sqrt{6}$ but it does for $k=4/\pi^2$ requires further explanation. Taking into account that all the functions decay quickly to zero the main contribution comes anyway from the vicinity of $x\approx 0$ where all expansions match very well. Therefore, any scaling obtained from the requirement of matching integrals, like here $k=4/\pi^2$, should be near to $1/\sqrt{6}$ and it is.

So the factor $k=4/\pi^2$ is magically superior to the Taylor motivated one, $k=1/\sqrt{6}$, and the reason for it remains unclear.

  • 1
    $\begingroup$ Reciprocals are not "inverse functions". $\endgroup$
    – Dan Asimov
    Nov 20, 2023 at 20:53
  • $\begingroup$ @DanAsimov, of course. I corrected it. Thanks for pointing out! $\endgroup$
    – Nikodem
    Nov 21, 2023 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .