let $f\colon\mathbb{R}\to\mathbb{R}$ is continuous function.
For arbitrary two real number $a, b$ $(a<b)\\$
Set $S=\left\{f(x)\vert a<x<b\right\}$ has both maximum and minimum.
I find $f$ must have local minima, local maxima in interval$(a, b)$ and the local maximum must bigger than $f(a)$ (or $f(b)$) and local minimum must smaller than $f(a)$ (or $f(b)$).
But, to satisfy that conditions, $f$ must have infinitely many local minimum(maximun)s.
I found constant function $f$ satisfies conditions, but I wonder existence of non-constant function.
Is there non-constant $f$ which satisfy that conditions?