TITLE: Is $f(x) = \sum_{n=-\infty}^\infty \frac{2^n \log x}{1+(2^n \log x)^2}$ for $x \geq 2$ constant?
QUESTION [6 upvotes]: I want to find a non-constant, continuous function $f: [2, \infty) \rightarrow \mathbb{R}$ which satisfies $f(x) = f(x^2)$ for all $x \in [2, \infty)$. A friend of mine suggested to try something of the form
$$f(x) = \sum_{n=-\infty}^\infty \varphi(2^n \log x)$$
and we tried $\varphi(x) = \frac{x}{1+x^2}$. Now my friend plotted the function for $-1000 \leq n \leq 1000$ which gave the following result:
Now we let MATLAB compute $f(x)$ for a few $x \in \mathbb{N}$ and observed that $f(x) \approx 2.2662$. As the plot of the function did not imply that the function was constant but periodic (however with a very small amplitude), we computed a few other values, e.g. $x = \pi$, $x = \pi+1$ and we were surprised to see that again $f(x) \approx 2.2662$. For large values, MATLAB was no more capable of computing the result. 
So I mainly have have two questions:

Is this function constant? How can I see this and prove or disprove it?
Is there a more trivial example of such a function which is non-constant?

Thanks for any answers in advance.

REPLY [7 votes]: You just have to take the log two times instead of one:
Replace $f(x)=f(x^2)$ by $g(x)=f(\exp(x))$ and $g(x)=f(\exp(x))=f(\exp(2x))=g(2x)$.
Replace $g(x)=g(2x)$ by $h(x)=g(\exp(x))$ and $h(x)=g(\exp(x))=g(\exp(x+\log(2)))=h(x+\log(2))$.
Now, find a non-constant continuous function with period $\log 2$.
$$h(x)=\sin\left(\frac{2\pi x}{ \log 2}\right)$$
So, we can take 
$$f(x)=g(\log(x))=h(\log(\log(x)))= \sin\left(\frac{2\pi \log \log x}{\log 2}\right)$$
This is defined if $\log x$ is positive, so for $x > 1$.

Now, for your function, regard the corresponding integral (you have $a=2$ and $y=\log x$) and make the variable change $u=ya^t$:
$$\begin{align}
\int_{-\infty}^{\infty}\varphi(y a^t)dt&=\int_{-\infty}^{\infty}\frac{y a^t}{1+y^2a^{2t}}dt\\
&=\int_{0}^{\infty}\frac{1}{\log a}\frac{1}{1+u^2}du\\
&=\frac{1}{\log a}\arctan u \,\,\big|_{u=0}^{u=\infty}\\
&=\frac{\pi}{2\log a}
\end{align}$$
In particular, the integral does not depend on $y$ and is constant and for $a=2$, the value $\frac{\pi}{2\log 2}$ is the mysterious $2.266$.
This explains why your sum is  close to this value, but this does not make your sum constant.

How to estimate the number of necessary terms for 6 digits:
We find upper limits for the two tails:
$$\sum_{n < -M}\frac{2^n\log x}{1+(2^n\log x)^2}< \sum_{n <  -M}\frac{2^n\log x}{1}= \frac{\log x}{2^M}$$
and
$$\sum_{n > M}\frac{2^n\log x}{1+(2^nlog x)^2}=\sum_{n > M}\frac{2^{-n}\log x}{2^{-2n}+(\log x)^2}< \sum_{n > M}\frac{2^{-n}\log x}{(\log x)^2} = \frac1{\log x 2^M}$$
So, it is sufficient to sum from $-M$ to $M$ if $\frac{\log x}{2^M}+\frac1{\log x 2^M} < 10^{-7}$ which is equivalent to $10^7(\log x+\frac 1{\log x }) < 2^M$ or
$$ M > \log_2(10^7(\log x +\frac1 {\log x})).$$
For example, for $x=\pi$, you can take $M=25$, but don't forget that you need to calculate each term with appropriate precision (9 digits after the comma will suffice to sum 50 terms to a 7 digit result).