Can the derivative of a $C^1$ function vanish at the infinity imply it has a limit at the infinity? Now I'm interesting in the question as follow,
Let $f\in C^1(\mathbb{R})$ and $f$ is bounded, $\lim_{x\rightarrow+\infty}f'(x)=0$, then $\lim_{x\rightarrow+\infty}f(x)$ exists.
Is this statement true? If not, please give a counterexample!
My try: if we remove the boundness condition of the function $f$, I can give a counterexample on the half line, namely, $f(x):=\ln x$.
Any answer will be appreciated!  
 A: Counterexample: $f(x) = \sin(\ln(x))$
A: My recipe for creating counterexamples of this sort is to design a function that oscillates between $-1$ and $1$.
In this case, you want the derivative to converge to $0$. This is easy to arrange piecewise: start at $0$ and have the function increase to $1$, then decrease to $-1$ more gradually, then increase to $1$ even more gradually, then decrease to $-1$ even more gradually....
Then you need to insert smooth arcs to replace the sharp corners, and voila, we have a bounded divergent function whose derivative converges to zero.
Usually once I go through this procedure, I can think up with a variation on the $\sin$ function that shares the behavior; pick any function $f(x)$ that converges to $+\infty$, but $f'(x)$ is strictly decreasing to zero. Then,
$$ \sin f(x) $$
will be a counterexample.
A: No.
Take, for example the function
$$f(x)=\cos(\log x )$$
for $x>0$.
This function is crearly $C^\infty$ and bounded in its domain.
We have:
$$f'(x)=-\frac1{x}\sin\left(\log x \right)$$
which vanishes at infinity. However, since $\log x\rightarrow\infty$ when $x\rightarrow\infty$, $f(x)$ has no limit at infinity.
Just in case os you need a proof of that, take the sequence $\lbrace f(e^{\pi n}) \rbrace_{n=0}^\infty$, which is in fact $(1,-1,1,-1,\ldots)$.
I apologize if formulas are not correctly displayed. MathJax seems not to work well in this site for my computer.
