TITLE: Example of differentiable function with $f'(s_{n})=0$ but $f'(0)>0$
QUESTION [0 upvotes]: Ex: Give an example of a differential function $f:\mathbb{R} \rightarrow \mathbb{R}$ such that $0$ is a limit (accumulation) point of a sequence of critic points ($f'(x)=0$) and however $f'(0)>0$
This may be related somehow with the fact that the set of critic points of a $C^1$-class function is closed (but I can't relate it!)
I think a fuction involving $\sin(1/x)$ or $\cos(1/x)$ may work with a sequence like $s_{n}=1/2n\pi$, but every fuction I try doesn't have derivate at 0.
Thanks!
Edit: I know that $x^2\sin(1/x)$ (with $f(0)=0$) has discontinuos derivative at zero, and if I add $kx$ then $f′(0)>0$. But I can't find a sequence of critical points converging to zero, because in the derivative I have a sine, a cosine and a constant ($k$).

REPLY [1 votes]: As you have remarked one possible solution is
$$
f(x)=\frac{x}{2}+x^2\sin\left(\frac{1}{x}\right)
$$
Note that, for $n\geq 1$,
$$
f'\left(\frac{1}{ \pi n}\right)=\frac{1}{2}-(-1)^n
$$
This means that $f'$ changes its sign on each interval $I_n=\left(\dfrac{1}{\pi(n+1)},\dfrac{1}{\pi n}\right)$, so there is some $s_n\in I_n$ such that $f'(s_n)=0$. Moreover, clearly $f'(0)=\dfrac{1}{2}$.
{"set_name": "stack_exchange", "score": 0, "question_id": 946277}