TITLE: Bounded function in $[0,1]$ without max and min.
QUESTION [5 upvotes]: Do we have a function $f$ defined in $[0, 1]$, which is bounded but has no maximum and minimum ?
I do know that $\arctan x$ can give me a hint, which is bounded without max and min but that's in $\mathbb R$.
Thanks!

EDITED:
Firstly thank all the answers that I received.
I would like to ask a little additional question: could we find some edited or mixed trigonometric functions to satisfy this problem?
If yes, a example please!
The reason is, that I got stuck with the idea of $\arctan x$ and other possible trigonometric functions.
Thanks!

REPLY [3 votes]: You cannot have a purely trigonometric function defined on $[0,1]$ that does not attain its max/min because it would be continuous and the extreme value theorem would apply.
$$
f(x)=\begin{cases}(1-x)\sin(\frac 1x) &; x\in(0,1]\\
0 &; x=0
\end{cases}
$$
This function is almost a trigonometric function as you specified. It has $\sup_{x\in[0,1]} f(x)=1$ and $\inf_{x\in[0,1]} f(x)=-1$ but those values are not attained.