For a little while now I’ve been wanting to sit down and come up with a formula for a continuous function that has its local extrema at the integers. I forget why I wanted this.
As stated, this is an easy problem. The function has extrema at all the integers, and only the integers. For whatever reason, I want the function I’m after to be sort of like a wavy line (like
, but wavy, with extrema). The function
almost fits the bill. It has the right basic shape (a wavy line with extrema), but the extrema don’t hit exactly at the integers.
Let’s try to be a little more specific in our goal still. Suppose I have two lines, and
, and that for
the line
is lower than the line
. In particular, this means
and
(and I’m assuming
). Now, I want the maximum values to lie on the line
, minimum values on
. Let’s shoot for getting the minimums to occur at even integers, and the maximums to occur at odd integers.
My first thought at this point was to make an sort of “mixing function” and combine the two lines with the mixing function to make
If my is bounded by 0 and 1, then when it is 0,
will be
, and when
, we’ll have
. So how does my mixing function look? Well, I want
(so
) at the even integers, and
(so
) at the odds, so it looks like a reasonable first guess for
is
Now, when I mix my two lines using this function, and the rule above for , I don’t get what I want. Sad. After a while, I realized why I didn’t get what I wanted. Since my
is always between 0 and 1, the
is always between the two lines,
and
. But if
has a minimum on
at some point
, then
, so in some interval to the right of
, we’ll have
(since
).
To patch this up, I decided to modify my lines. I’ll make each of my lines a little wavy, so that at the integers they’ll have derivative 0 (but go through the same point). But I don’t want any extrema, so I’ll keep the derivative positive. So I’ll replace with a function whose derivative is
, for some value
. Of course, we can find
, because we know the values at all of the integers. Integrating and such, we set up
and similarly
Now, finally, when we mix these two functions with our mixing function above, to make the function
, we finally get what I set out for (as long as the values
are reasonable).
The whole formula is something I could write down here, but it doesn’t seem to simplify much. I’ll do a specific case though. If my lines are and
, then my function is
which you can investigate at (among other place) WolframAlpha. With a double angle identity, you can pretty quickly see the derivative is 0 just at the integers (and at all of them). If you’re into it, you can also see the points of inflection are always halfway between integers.
So, anyway. Anybody have a better way to do this? Or some idea why you might look for such a function?