# Is the limit of $\left(\sum_{i=-n}^{i=n} \tanh(x - i)\right)-2x$ a sine wave?

I have been plotting functions of the form $$\left(\sum_{i=-n}^{i=n} \tanh(x - i)\right)-2x$$ which, over the region around zero, look a lot like sine waves. For example, here's the function for $n=10$.

Empirically, it seems to be something approximating $0.00065 \sin(2 \pi x)$. Beyond about $n=10$ it is very stable over the region $x\in[-5,5]$, as you might expect from $\tanh(x)$ being approximately $\pm 1$ for large $\pm x$. I have found plots of the series and $0.00065 \sin(2 \pi x)$ are indistinguishable. Here's the same plot zoomed out with this sine wave in orange:

Is this actually tending towards a sine wave? and if so, what is the exact value of the constant $k$ in

$$\lim_{n \to \infty}\left(\sum_{i=-n}^{i=n} \tanh(x - i)\right)-2x = k \sin(2 \pi x)$$

Update

I've calculated the specific values of this function symbolically with Mathematica, and evaluated it with $N[.,100]$ function at x=1/4, 5/4, 401/4 and 4001/4 which gives

   1/4: 0.0006499727271926147575932558139650291715585570399687299381104388139877502424025845538796044013975974138
5/4: 0.0006499727271926147575932558139650291715585570399687299381104388139877502424025845538796044013975974138
401/4: 0.0006499727271926147575932558139650291715585570399687299381104388139877502424025845538796044013975974138
4001/4: 0.0006499727271926147575932558139650291715585570399687299381104388139877502424025845538796044013975974138


I'm not 100% sure this is not a numerical issue, but I also don't see any reason why it should be 0.00065 exactly either.

We have the following expansion:

$$\lim_{n\to\infty} \sum_{k=-n}^{n} \tanh(x+k) = 2x + \sum_{k=1}^{\infty} \frac{2\pi}{\sinh(\pi^2 k)} \sin(2\pi k x). \tag{*}$$

So the resulting function is not a pure sine function, but since the coefficients decay exponentially fast, the first term is predominant. This can also be glimpsed from the following numerical value:

$$\frac{2\pi}{\sinh(\pi^2)} \approx 0.000649972728931478984525468377615\cdots,$$

Derivation of the identity $\text{(*)}$.

1. Assume for a moment that not only the LHS of $\text{(*)}$ converges, but it is also differentiable and can be computed by interchanging the order of limiting operators:

\begin{align*} \frac{d}{dx}\lim_{n\to\infty} \sum_{k=-n}^{n} \tanh(x+k) &= \lim_{n\to\infty} \sum_{k=-n}^{n} \frac{d}{dx}\tanh(x+k) \\ &= \sum_{k=-\infty}^{\infty} \frac{1}{\cosh^2(x+k)}. \end{align*}

(We will justify this later, but at this point this is just a technical issue.) The summand of the last sum has exponential decay as $k\to\infty$, so we can use the Poisson summation formula to obtain

$$\sum_{k=-\infty}^{\infty} \frac{1}{\cosh^2(x+k)} = \sum_{k=-\infty}^{\infty} f(k) = \sum_{k=-\infty}^{\infty} \hat{f}(k).$$

To evaluate the last sum, we appeal to the following well-known result

$$\hat{f}(\xi) = e^{2\pi i \xi x} \frac{2\pi^2 \xi}{\sinh(\pi^2 \xi)}, \qquad \hat{f}(0) = 2.$$

Plugging this back, we have

$$\frac{d}{dx}\lim_{n\to\infty} \sum_{k=-n}^{n} \tanh(x+k) = 2 + \sum_{k \neq 0} \frac{4\pi^2 k}{\sinh(\pi^2 k)} e^{2\pi i k x}.$$

Integrating both sides and using the fact that the LHS of $\text{(*)}$ vanishes at $x = 0$, we have

\begin{align*} \lim_{n\to\infty} \sum_{k=-n}^{n} \tanh(x+k) &= 2x + \sum_{k \neq 0} \frac{2\pi}{i \sinh(\pi^2 k)} e^{2\pi i k x} \\ &= 2x + \sum_{k=1}^{\infty} \frac{2\pi}{\sinh(\pi^2 k)} \sin(2\pi k x) \end{align*}

as expected.

2. We justify that the limit and differentiation can be exchanged. This is in fact not hard:

\begin{align*} \sum_{k=-n}^{n} \tanh(x+k) &= \frac{1}{2} \sum_{k=-n}^{n} [\tanh(k+x) - \tanh(k-x)] \\ &= \frac{1}{2} \sum_{k=-n}^{n} \int_{-x}^{x} \frac{du}{\cosh^2(u+k)} \\ &= \frac{1}{2} \int_{-x}^{x} \left( \sum_{k=-n}^{n} \frac{1}{\cosh^2(u+k)} \right) \, du. \end{align*}

Since the integrand of the last integral converges uniformly on $\mathbb{R}$ to an even function, it follows that

\begin{align*} \lim_{n\to\infty}\sum_{k=-n}^{n} \tanh(x+k) &= \frac{1}{2} \int_{-x}^{x} \left( \sum_{k=-\infty}^{\infty} \frac{1}{\cosh^2(u+k)} \right) \, du \\ &= \int_{0}^{x} \left( \sum_{k=-\infty}^{\infty} \frac{1}{\cosh^2(u+k)} \right) \, du. \end{align*}

This is precisely what we needed to justify in the previous computation.

• Ah, Fourier transform... obvious in hindsight. Thanks very much, this problem was really bugging me. – Lucas Aug 27 '17 at 23:12