I had a question that goes like this:
Let $m$ be the number of local minima and $M$ be the number of local maxima. Can you create a function where $M > m + 2$ ? Graph.
I tried graphing it using piecewise function and I improvised it by doing 3 parabolas opening downward and 1 parabola opening upward with each horizontal line separating them.
I was just wondering if there is an easier way in creating a graph given such condition?
Such a function is not possible if you want a continuous function, because between 2 local minumums has to be a local maximum, and vice versa. So local minumums and maximums always alternate (if you exclude cases where $f(x)$ is constant on an interval).
If you allow discontinuous functions, you can use
$$f(x) = \lfloor x\rfloor -x$$
It has a local maximum at each integer ($f(x) = 0, \forall x \in \mathbb Z$), but no local minimum at all: for a given $x_0 \in \mathbb R$ with $\lfloor x_0\rfloor = k$, choose any $x \in (x_0, k+1): f(x_0) = k - x_0 > k - x = f(x)$, so $x_0$ can't be a local minimum.