# Question about $f(x)=\sum_{k=1}^\infty (-1)^{k+1}\sin (\frac{x}{k})$

This function is rather peculiar. It is easy to establish the following:

$$f(x) =\sum_{k=0}^\infty (-1)^k A_{2k+1} \cdot x^{2k+1}, \mbox{ with } A_k=\Big(1-\frac{1}{2^{k}} + \frac{1}{3^{k}}- \frac{1}{4^{k}}+\cdots\Big).$$

Note that $$A(1)=\log 2$$, and for $$k>1$$, we have

$$A(k)= \Big(1-\frac{1}{2^{k-1}}\Big)\zeta(k)$$

where $$\zeta$$ is the Riemann Zeta function. Also, $$f(-x) = - f(x)$$ and we have the following approximation when $$x$$ is large, using a value of $$K$$ such that $$x/K < 0.01$$:

$$f(x) \approx \sum_{k=1}^K (-1)^{k+1}\sin \Big(\frac{x}{k}\Big) - x\cdot\sum_{k=K+1}^\infty \frac{(-1)^{k}}{k}$$

The function is smooth but exhibits infinitely many roots, maxima and minima. I am in particular interested in the following quantity:

$$g(x) = \sup_{0\leq y\leq x}f(y).$$

What is the growth rate for $$g(x)$$? Is it linear, sub-linear, or super-linear? Another question of interest is the average spacing between two roots or two extrema.

Below are two plots of $$f(x)$$, the first one for $$0\leq x\leq 200$$, the second one for $$0\leq x\leq 2000$$.

Addendum: Failed attempt to solve this

I used the Euler-Maclaurin summation formula to get a good approximation for $$f(x)$$ when $$x$$ is large, and this leads to

$$f(x) \approx \int_1^\infty \Big(\sin\frac{x}{2u} - \sin\frac{x}{2u+1}\Big) du.$$

A closed form for this integral exists, involving the cosine integral, see WolframAlpha here. Lots of asymptotic formulas are available (see here) but when I apply them, I end up with $$f(x)$$ being bounded, which is very clearly not the case based on my observations.

As an illustration, below is the computation of $$f(x)$$ for $$x = 52,000,001$$. The first chart shows $$f(x)$$ based on the first $$n=2000$$ terms in the series. Here the X-axis represents $$n$$, and the Y-axis represents $$f(x)$$ for the particular value of $$x$$ in question, when using a growing number of terms. In the second chart, $$n$$ goes to $$200,000$$. Stability is reached after adding about $$4,100$$ terms, and oscillations are slowly dampening then.

One promising approach is this. Let

$$f_k(x)=\sum_{i=1}^k (-1)^{i+1}\sin \Big(\frac{x}{i}\Big) .$$ Define $$h_k(x) =\frac{1}{2}(f_k(x) + f_{k-1}(x))$$.Then $$f(x) = \lim_{k\rightarrow\infty} h_k(x)$$. The iterates $$h_k$$'s are much smoother than the $$f_k$$'s, and convergence is much faster.

• Looks like: $$f(x)=\sum _{k=0}^{\infty } (-1)^k \left(1-2^{-2 k}\right) \zeta (1+2 k) x^{2 k+1}=\frac{1}{4} x \left(-H_{-\frac{1}{2}-\frac{i x}{2}}+H_{-\frac{1}{2} (i x)}+H_{\frac{i x}{2}}-H_{\frac{1}{2} i (i+x)}\right)$$ where $H$ is Harmonic number. – Mariusz Iwaniuk Apr 13 '20 at 9:14
• I think you might be missing a factor of $\frac{1}{(2k+1)!}$ in your first series – user125932 May 16 '20 at 20:07
• @VincentGranville The second and third derivative of this series are bounded by $\sum \frac{1}{k^{2}}$ and $\sum \frac{1}{k^{3}}$ respectively. So if we are at a point of, say, local minimum with positive second derivative, then the next local maximum will happen with the change of sign of second derivative - through the inflection point, etc. Since the third derivative is even smaller, this change will have to take place on a wider interval. Let me try to edit my recent answer to add this analysis – Igor Oliynyk May 18 '20 at 21:27
• @VincentGranville I have added an analysis on local extrema - it suggests more or less equally spaced local extrema - see my edited second answer. Thank you – Igor Oliynyk May 20 '20 at 1:08
• Thank you. I was about to do some analysis about the probabilistic distribution of these extrema. – Vincent Granville May 20 '20 at 3:05

Distribution of Roots - Example

There was a question about the distribution of roots and extrema values of this function. From the analysis above, it sufficient to study first $$4K^{\prime}$$ elements of the series, as it should be a good approximation.

It is intuitive to group values of $$x$$ having the same integral part of $$K^{\prime}$$ and to check the distrubution of function values for them.

Our study, by no means a complete one, considers this sequence of values

$$x = \pi / 4 * i, i = 10000, 10001, ..., 100000.$$

We check how terms in this sum

$$2 \sum_{k < 2K^{\prime}} \sin\big(\frac{x}{4k(2k-1)}\big) \cos\big(\frac{x(4k -1)}{4k(2k-1)}\big)$$

balance out - if sine and cosine have the same sign for most of the pairs, then we could expect a local maximum, and local minimum, otherwise. The root values must correspond to more or less equal number of pairs with same and opposite signs.

The corresponding number of elements in the sum above for values of $$x$$ ranges from 63 to 197.

A plot below shows the distribution of function values by total number of elements in the sum

We see that we have at least one root for $$x$$ values with the same number of $$2K^{\prime}$$ pairs.

Local Minima and Maxima of $$f$$

In this section we will show that the distribution of local minima and maxima values for $$f$$ is more or less homogeneous, i.e. evenly spread on $$x$$ axis.

For that, let's consider the first derivative of $$f$$

$$f^{\prime}(x) = \sum_{k} \frac{1}{2k-1} \cos{\frac{x}{2k-1}} - \frac{1}{2k} \cos{\frac{x}{2k}} =$$ $$\sum_{k} \big(\frac{1}{2k-1} - \frac{1}{2k}\big) \cos{\frac{x}{2k-1}} + \frac{1}{2k} \cos{\frac{x}{2k-1}} - \frac{1}{2k} \cos{\frac{x}{2k}} =$$ $$\sum_{k} \frac{1}{2k(2k-1)} \cos{\frac{x}{2k-1}} + \frac{1}{2k} \big(\cos{\frac{x}{2k-1}} - \cos{\frac{x}{2k}}\big) =$$ $$\sum_{k} \frac{1}{2k(2k-1)} \cos{\frac{x}{2k-1}} - \frac{1}{k} \sin{\frac{x}{4k(2k-1)}} \sin{\frac{x(4k-1)}{4k(2k-1)}}.$$

Now the last formula suggests that the derivative converges more rapidly than for the original function - see my previous answer. Indeed, the first term converges absolutely, and the last term suggests rapidly decresing oscillations. So a good approximation of the derivative depends on just a few terms of series.

We are going to show an equally spaced sequence of $$x$$, where $$f^{\prime}(x)$$ changes signs 59% of the time between two consecutive values. Let's consider interval $$[51,989,419; 52,009,776]$$ and plot the function there for 1000 uniformly selected points. We used 5099 pairs(see the definion in my previous answer) to approximate function values.

Now let's turn to the sequence with oscillating about zero derivatives. The first value is $$x_{0} = 51,989,402$$, and it approximately equals $$\pi/2\mod{2\pi}$$. Then $$x_{i} = x_{0} + 2\pi*i, i = 0, 1, ....$$ is defined on the interval above, and it has 3247 values. Here is a plot of derivative values for this sequence

The function oscillates about zero, and for 1920 points it changes sign from current value to the next one suggesting local extrema somewhere in between.

We could rewrite the function as $$\sum_{k=1}^{\infty} \big(\sin\big(\frac{x}{2k-1}\big) - \sin\big(\frac{x}{2k}\big)\big) = 2 \sum_{k=1}^{\infty} \sin\big(\frac{x}{4k(2k-1)}\big) \cos\big(\frac{x(4k -1)}{4k(2k-1)}\big)$$

In the last term we find $$k$$ such that the inequality $$\frac{x}{4k(2k-1)} \leq 1$$

holds. It is achieved for $$k > K^{\prime} = \frac{1 + \sqrt{2x + 1}}{4}.$$ First $$K^{\prime}$$ elements in the sum above could be bounded by $$1$$, and for the remainder of that sum we use the inequality $$\sin{y} \leq y$$. We get $$2 \sum_{k=1}^{\infty} \sin\big(\frac{x}{4k(2k-1)}\big) \cos\big(\frac{x(4k -1)}{4k(2k-1)}\big) \leq$$ $$2K^{\prime} + 2\sum_{k > K^{\prime}} \frac{x}{4k(2k-1)}$$ $$\leq 2K^{\prime} + 2 \frac{x}{4K^{\prime}(2K^{\prime}-1)} \sum_{k > K^{\prime}} \frac{1}{\frac{k}{K^{\prime}}\frac{2k-1}{2K^{\prime}-1}}$$ $$\leq 2K^{\prime} + 2 \sum_{k > K^{\prime}} \frac{1}{\frac{k}{K^{\prime}}\frac{2k-1}{2K^{\prime}-1}}.$$

The last sum is the convergent series, it is bounded by $$2K^{\prime}$$, and it can be made very small for large $$k$$ and fixed $$K^{\prime}$$. So the rough estimate of the fuction is $$O\big(\sqrt{x}\big)$$, and we have to take more than $$2K^{\prime}$$ terms to get a good approximation.