So I suppose, if I’m being honest, my post from earlier today about piecewise functions wasn’t entirely self-motivated. In all honestly, I sat down and was inspired to find a formula for a new polar curve. I’ve done similar things before. Today’s goal was to find a formula for a polar curve like the following:

My goal

The red lines are supposed to indicate that the curve is 0 at and . My goal in drawing this curve was to find something that looked like a limacon, but had self-intersections away from the origin. It’s a happy coincidence (in my mind, anyway) that the result, when crossings are properly applied, is a trefoil knot.

So, anyway, how to find a formula for my function? The first step, for me, is to unroll it back to a Cartesian form. I’ll call it , and it looks something like the following, with 0s at , a min corresponding to the polar point , and a max corresponding to the polar point :

My (Cartesian) goal

Next, I know that shifting functions horizontally isn’t too hard, so let me shift left by , obtaining a graph like the one above, except passing through the origin. Let’s call this :

As a third change, though one that’s trickier to sort out algebraically (I’ll do it below), I’ll make the graph more symmetric by assuming the second 0 occurs at , instead of at . Let’s call the resulting graph :

Now this, to me, looks like the plot of , except for the fact that the amplitude is 3 on the first half, and only 2 on the second half. So let’s call it , where my amplitude function looks like:

This is just the curve , so we have a formula for . Namely, . Not terribly pretty, but manageable.

Now, how do I do that change that took me from to ? Since the graph of is obtained from the graph of by some sort of horizontal manipulations, I know for some function . What does look like? Well, it sends 0 to 0, and to , and also sends to . That gives me three points, , , and on the graph of , and I’ll define to be the piecewise linear function connecting them. Because I think maybe it’ll be handy, let me set . From my work on piecewise curves in my earlier post (and a handful of algebra and horizontal translations), I know I can write . The following graph shows (in black), (in red), and (blue):

Thus, I’ve found , something I can write out fully if I want (it’s getting to be a pretty long formula). Finally, I shift this graph over to the right by to obtain , with graph:

Oh no! That’s not the graph I was expecting at the beginning. My Cartesian goal didn’t hit 2 at . What happened?

Let me plot the function , obtained so far, on a wider domain:

Notice that this looks like a piecewise function. It begins as a sin (sinusoidal, I guess) curve (with modified amplitudes) with period , and then shifts to one with a larger period. I would have probably hoped that the curve I was going for was just going to be periodic itself, so that if I extended the domain in the polar curve, I’d just end up tracing out the trefoil again.

The problem stems from my linear shift function , and it’s accompanying . Notice that the formula for is not periodic. It does what I want on the interval , but outside of that, it’s negative. That’s not what I wanted, and it matters because I shift some of these negative bits into the picture with my final shift from to . How can I take this function that I like on and extend it periodically throughout the whole real line?

Let me define another function, , which computes ““. Usually, I expect the modulus of a number to be taken with respect to an integer, not . All the same, we can make it work. The function can be written as (here is the “floor” function, returning the greatest integer less than ). The graph of this function is a saw-tooth curve. Of course, I don’t want ““, but ““. I just modify with some factors of , obtaining .

The following plot contains the original (in green), the saw-tooth curve (in black), and the nicely periodic offset function (in blue, overlapped by green in the first positive interval):

Now let’s go back and fix up our functions. The function was fine, it didn’t involve . The definition of above was , but that uses the non-periodic offset function . I’ll replace it with it’s period cousin, , so that . This has the nice periodic graph:

Finally, was just a horizontal shift of , so . This graph looks much better (it’s periodic, and not 2 at ).

Not only is it correct on , but when plotted as a polar curve, it gives us what we were after all along:

Hurray! Now, what are the coordinates of the intersection points (besides the origin)? Does the corner at (coming from the corner on ) in mean this function has a discontinuous derivative? How could it be patched up? Would making as a quadratic function (I’ve got 3 non-colinear points, which determine a quadratic) work well? Can the symmetry be improved? Perhaps by picking other angles where the curve is 0, or different amplitudes for the inner and outer loop (2 and 3, respectively, in the example above)?

I don’t know the answers to any of those questions. Some I have worked a little on (the last one, since I could do lots of nice plots if I set things up in enough generality in Maple), others, though interesting (points of intersection), I have not.

By the way, I made all of my graphs at fooplot.com (which I’ve used lots, it’s nice).