In this post, I described an activity using quadratics to draw the Batman Logo. It was slightly inspired by the famous Batman Curve, but based on a different version of the Batman logo. One key difference was that my version was presented as a series of quadratics and lines outlining a region, whereas the original Batman Curve was expressed as a single curve.
Slightly out of idle curiosity, I wondered about making my version also into a single curve. I decided to take a different approach to the original Batman Curve, which exploits some features of computer graphics systems, and make much use of the absolute value function.
2 The Absolute Value Function
If functions were superheros, the absolute value function would definitely not be Batman. It would have to be one that had a secret identity as someone very unassuming, and Bruce Wayne is just too flamboyant. On the other side, the superhero part would have to be very powerful indeed. So we're talking someone like Clark Kent, Peter Parker, or Carol Danvers here.
The absolute value function is formally defined as:
Less formally, it forces what is inside it to be positive. So . In computing, it is one of the simplest functions to implement as it just throws away the sign of the number.
And yet it can do so much. What we need to use it for is to define the maximum and minimum of two things.
We can also feed in functions into these and they give the pointwise maximum and minimum of those functions, as in Figure 1.
I want to use a more compact notation for these, particularly when functions are concerned:
There is another use of the absolute value function. Given a function, say , we can consider . This has the effect of taking the part of the function on the positive –side and reflecting it onto the negative –side as in Figure 2.
3 Batman in Quadratics
Although the absolute value is not Batman, we'll stick to the Batman Logo1. I don't know of another logo that is so distinctive, but also relatively straightforward to draw.
1As one of my students started the activity, I heard them mutter "I bet it's Batman. It's always Batman."
I'm going to modify it slightly, though, as when I drew up the original I was more concerned with the numbers in the coefficients than any other feature. It'll be useful to have the upper and lower parts of the curve meet at "nice" coordinates. Also, the original was upside-down to delay the reveal but for this I'll turn it back the right way. The starting functions are therefore:
Several of these are in pairs, where one is a reflection of the other in the –axis. We can use the "inner absolute value" trick to condense these into a single function. This leaves us with the following list, illustrated in Figure 3:
4 Maxing Out
The lower part of the logo is the simplest. This is defined by curves and and we simply take their maximum, as in Figure 4. Thus:
The upper part would be as simple if it were not for the head. That takes a little more thought. The inner part is the maximum of the lines and , after which we take the minimum of that with , as in Figure 5. Thus:
The inner part of the upper curve is then the maximum of this and , and the full upper curve is the minimum of that with as in Figure 6:
5 Tracing the Bat
We now have the upper and lower parts of the logo expressed as the graphs of functions. To put them together, though, requires treating them as parametrised curves. Thus rather than plotting , we have to plot . This is because the graph of a function cannot double back on itself horizontally. So what we want to do is something like:
Only we'd like to do it without calling on a piecewise definition. Note that our adjustments to the functions mean that the upper and lower curves intersect at .
What we will do to achieve this is the following2. We start by creating a function that first traces out the upper path and then the lower (due to the nature of our functions, we can create that quite simply). This function will form the –coordinate of our path. The "backtracking" will result from what happens to the –coordinate. While the –coordinate is along the upper part of the curve, the –coordinate should simply increase, then when the –coordinate moves to the lower part, the –coordinate should reverse.
2I will freely admit that this is the second idea that I had to do this. The first method ended up with a formula that needed more than a full page to typeset.
3We exploit a bit symmetry here in that the lower path should be reflected as well as translated but we don't need to do that.
The –coordinate path just needs to go from to and back again.
Putting that together, we get our final curve as:
6 Unrolling the Curves
Mathematical notation is designed to focus attention. By hiding unnecessary details, it allows us to work on what is important or relevant without getting lost in a morass of symbols. The form of our curve in Equation 1 has this property. We can see enough of the definition without having to know too much about how and are defined.
It is with some trepidation, therefore, that I am going to unroll the definition of back to a function of .
Thanks to the left and right shifts, we can rearrange the final form of slightly.
Putting the and parts together, we get: