I would like to be able to randomly generate functions, each of which satisfies
$f : [-10, 10] \rightarrow [-10, 10]$
All the zeroes, critical points, and inflection points have an integral $x$-value
Some of the critical points -- $x$-values where $f'(x) = 0$ -- are local extrema, but some aren't
Some of the zeroes are also at local extrema (like $x=0$ in the function $y=x^2$), and some aren't
It's easy to draw such a function by hand and then define a piecewise function that looks similar. The hard part, for me, is finding an algorithm that generates these functions with some randomness. I was approaching this by taking functions of the form $y=a (x-b)^2 + c$ and gluing them together so that the points and derivatives match up. (If the second derivatives don't match up, that's ok -- my Mathematica method will still identify the "gluing" points as inflection points.) This works fine if I'm only worried about critical points and inflection points, but seems to become very difficult when trying to respect the zeroes condition.
Can anyone think of a tractable algorithm for this?
EDIT: the randomness needs to be present beyond just, say, a scalar multiple. The goal is to show graphs of these functions to students and ask them to visually identify zeros / critical points / inflection points, and so different functions should correspond to usefully-different problems.
Interpolation
, it's somewhat hard to get every zero, critical point, and inflection point to occur at an integer abscissa. Also randomly generated ones are probably not always going to look good. $\endgroup$