TITLE: $f(x)\in C^0,f(0)=0,$ for$\ x\neq 0,f(x)>0,$ is $\int^x_0f(t)dt=o(f(x))?$
QUESTION [5 upvotes]: I wanna find a counter example to prove that "if $f(x)\in C^0,f(0)=0$,and for $x\neq 0(f(x)>0)$, then $\int^x_0f(t)dt=o(f(x)),$ as $x\to 0$" is not always true even if $f(x)\in C^p,p\geq1$.
First I found $f(x)=x^n|\sin(\frac1x)|+x^m\in C^0,m>n$, and by using an auxiliary function $\phi(x)$ which is a broken line connecting the point where $|sin(\frac1x)|=0,1$. So for the sequence $\{x_k=\frac1{k\pi}\},\int_0^{x_k}t^n\sin(\frac1t)dt\geq\int_0^{x_k}t^n\sin\phi(t)dt\geq\frac{nx_k^{n+1}}{2(n+1)}-\frac{(x_k)^{n+1}}{n\pi}$ , which means $\lim\limits_{k\to\infty} \frac{\int^{x_k}_0f(t)dt}{f(x)}$ doesn't exist.
Then I found that $f(x)=x^n(\sin(\frac1x)+1)+x^m\in C^{n-2},m>n$, and by using $\varphi(x)=$$\begin{cases}1,sin(\frac1x)>0\\0,sin(\frac1x)\leq0\end{cases}$ and $\int^{x_k}_0t^n\varphi(x)dt\geq\int^{\frac{x_k}2}_0t^ndt$, we can prove that for  $\{x_k=\frac{1}{2k\pi-\frac{\pi}2}\}, \lim\limits_{k\to\infty}\frac{\int^{x_k}_0f(t)dt}{f(x)}$ doesn't exist.
As you can see, these two functions are pretty complicated, so I'm wondering if there are better (simpler) counter examples for the problem.

REPLY [3 votes]: Many counterexamples can be obtained this way: Let $(x_n)$ be a sequence in $(0,1]$ that decreases to $0.$ Let $g$ be a continuous function on $[0,1]$ such that $g(x)=0$ for all $x\in \{x_1,x_2,\dots\}\cup \{0\},$ and $g>0$ elsewhere. (Example: $g(x)=x\sin^2(1/x),$ $x_n=1/(n\pi), n=1,2,\dots$)
Define
$$f(x) = g(x) + \left(\int_0^x g(t) \,dt\right)^2.$$
This $f$ will be a counterexample. Note $f(x_n) = (\int_0^{x_n} g(t) \,dt)^2$ for all $n.$ Thus as $n\to \infty,$
$$\frac{\int_0^{x_n} f(t)\,dt}{f(x_n)} > \frac{\int_0^{x_n} g(t)\,dt}{(\int_0^{x_n} g(t) \,dt)^2} = \frac{1}{\int_0^{x_n} g(t) \,dt} \to \infty.$$