The mean value of the fractional part $\{ x \}$ on $\mathbb{R}_+$ is clearly $\tfrac{1}{2}$. I'd like to know if a similar statement holds for $\{ f(x) \}$ where $f \colon X \to \mathbb{R}_{+}$ is a non-negative $C^{k}(X)$ function for some $k \geq 0$ and assumes all values of an infinite continuum subset of $\mathbb{R}$ at least once. For example, if $f(x) = x + 1$, then the average value on $[-1,\infty)$ remains at $\frac{1}{2}$. Does the same value hold if $f(x) = \log_{b} x$ for some base $b > 0$ on $[b,\infty)$? Is the result always $\frac{1}{2}$?
This Mathematica code may be useful:
Plot[Mean[Table[FractionalPart[Log[2, x]], {x, 2, y, 0.01}]], {y, 2, 1000}]
Clarification (and edits), examples, counterexamples and references are welcome! Thanks.
Edit: The nice constructions and counter-examples given below imply that further conditions are needed to ensure the mean value is exactly $\frac{1}{2}$. What are they?