Is there a pathological continuous function $\ f:\mathbb{R}\to\mathbb{R}\ $ that is nowhere increasing or decreasing and has no local extrema?
Is there a pathological yet continuous function $\ f:\mathbb{R}\to\mathbb{R}\ $ such that:
For every $\ x\in\mathbb{R}\ $ and $\ \delta>0,\ \exists\ a,b,\ $ both in $\ (x,x+\delta),\ $ such that $\ f(a)<f(x)<f(b)\qquad (*)\quad ? $
This makes me think of Weierstrass function because it is nowhere increasing and nowhere decreasing. However, at some points of the Weierstrass function a local maximum is attained. Let $\ x\ $ be a local maximum. Then by definition of local maximum, $\ \exists\ \delta>0\ $ such that $\ a\in(x,x+\delta)\implies f(a)\leq f(x).\ $ Therefore the Weierstrass function does not satisfy $\ (*).$
Maybe such a function is well known? Or if not, I was wondering if we can construct such a function using transfinite induction/recursion, although it might be difficult to prove that the function remains continuous in the limit case?
Or maybe there is some clever argument that any real function with the property $\ (*)\ $ cannot be continuous everywhere (in particular, the function cannot be continuous at $ x)$ ?
Suppose that such a function exists.
Take any interval $[u, v]\subseteq\mathbb R, u<v$. As it is well known, the (continuous) function $f$ reaches a maximum somewhere on $[u,v]$. If the maximum is reached in any point $x\in [u, v)$, then take $\delta=v-x$ and for all $b\in(x, x+\delta)$ you will have $f(b)\le f(x)$.
This means that the maximum is reached in $v$ only, i.e. $f(x)<f(v)$ for all $x\in[u,v)$. In particular, $f(u)<f(v)$. As $u<v$ were arbitrary, this then implies the $f$ is strictly increasing, which is impossible (it will be impossible to find $a$ for any $x, \delta$).
This contradiction proves that the function with properties given in your question does not exist.
Suppose that $f : \mathbb R \to \mathbb R$ is a continuous function without any local extrema. I'll prove that $f$ is strictly monotonic.
To see why, consider any $a < b$ in $\mathbb R$. The restricted function $f \mid [a,b]$ has a maximum and a minimum, by the Extreme Value Theorem. If any point of the open interval $(a,b)$ is an extremum of the restricted function, then the whole function $f$ has a local extremum, contradiction. Therefore, the only possible extrema for $f \mid [a,b]$ are $a$ and $b$, one of $f(a)$ or $f(b)$ is a maximum, and the other is a minimum, and they are not equal.
The argument in the previous paragraph holds for all choices of $a<b$ in $\mathbb R$. Using this, let me prove that $f$ is strictly monotonic. There might be a very slick argument at this point, but there is also a tedious proof by cases which I'll outline.
Pick an arbitrary pair $a<b$ to start, so either $f(a) < f(b)$ or $f(a)>f(b)$. I'll assume the $f(a)<f(b)$, and prove that for all $x<y \in \mathbb R$ we have $f(x)<f(y)$ (the other case, where $f(a)>f(b)$, follows just by switching the order).
First look at where $x$ is located with regard to $a$ and $b$. If $x<a<b$ then we must have $f(x)<f(a)$, because otherwise $f \mid [x,b]$ has a minimum value at some $c \in (x,b)$. If $a < x < b$ then $f(a) < f(x) < f(b)$ because otherwise $f \mid [a,b]$ has a minimum or maximum value at some $c \in (a,b)$. And if $a < b < x$ then $f(b) < f(x)$ because other wise $f \mid [a,x]$ has a maximum value at some $c \in (a,b)$.
Finally, look at where $x$ and $y$ are jointly located with regard to $a$ and $b$. By a similar case analysis, you can conclude that $f(x)<f(y)$.