Extrema at the Integers

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 \cos(\pi x) 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 y=x, but wavy, with extrema). The function x+\cos(\pi x) 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, y_0=m_0x+b_0 and y_1=m_1x+b_1, and that for x\geq 0 the line y_0 is lower than the line y_1. In particular, this means b_0\leq b_1 and m_0\leq m_1 (and I’m assuming 0< m_0). Now, I want the maximum values to lie on the line y_1, minimum values on y_0. 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” h(x) and combine the two lines with the mixing function to make

f(x)=h(x)y_1+(1-h(x))y_0.

If my h(x) is bounded by 0 and 1, then when it is 0, f(x) will be y_0, and when h(x)=1, we’ll have f(x)=y_1. So how does my mixing function look? Well, I want y_0 (so h=0) at the even integers, and y_1 (so h=1) at the odds, so it looks like a reasonable first guess for h(x) is

h(x)=\frac{1}{2}(1-\cos(\pi x)).

Now, when I mix my two lines using this function, and the rule above for f(x), I don’t get what I want. Sad. After a while, I realized why I didn’t get what I wanted. Since my h(x) is always between 0 and 1, the f(x) is always between the two lines, y_0 and y_1. But if f(x) has a minimum on y_0 at some point x=a, then f'(a)=0, so in some interval to the right of a, we’ll have f(x)\leq y_0 (since y_0'>0).

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 y_0 with a function whose derivative is \frac{a}{2}(1-\cos(2\pi x)), for some value a. Of course, we can find a, because we know the values at all of the integers. Integrating and such, we set up

y_0=m_0(x-\frac{1}{2\pi}\sin(2\pi x))+b_0.

and similarly

y_1=m_1(x-\frac{1}{2\pi}\sin(2\pi x))+b_1.

Now, finally, when we mix these two functions with our mixing function h(x) above, to make the function f(x), we finally get what I set out for (as long as the values m_0,b_0,m_1,b_1 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 x-1 and x+1, then my function is

f(x)=\frac{1}{2}(2x-\frac{1}{\pi}\sin(2\pi x)-2\cos(\pi x)),

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?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: