Absolute Bats

loopspace

2019-09-21

Creative Commons License

Contents

  1. Home

  2. 1. Introduction

  3. 2. The Absolute Value Function

  4. 3. Batman in Quadratics

  5. 4. Maxing Out

  6. 5. Tracing the Bat

  7. 6. Unrolling the Curves

1 Introduction

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:

x={xx0-xx<0

Less formally, it forces what is inside it to be positive. So -3=3. 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.

max(a,b)=12(a+b+a-b)min(a,b)=12(a+b-a-b)

We can also feed in functions into these and they give the pointwise maximum and minimum of those functions, as in Figure 1.

Figure 1: The minimum of two functions

I want to use a more compact notation for these, particularly when functions are concerned:

fg=min(f,g)fg=max(f,g)

There is another use of the absolute value function. Given a function, say f(x), we can consider f(x). This has the effect of taking the part of the function on the positive x–side and reflecting it onto the negative x–side as in Figure 2.

Figure 2: Reflecting a Function

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:

  1. y=-0.1x2+14.1

  2. y=0.05x2+4

  3. y=-0.25x2+4.5x-16.15

  4. y=-0.25x2-4.5x-16.15

  5. y=-0.3x2+2.7x-5

  6. y=-0.3x2-2.7x-5

  7. y=10x+14

  8. y=-10x+14

  9. y=5x+3

  10. y=-5x+3

  11. y=5.5

Several of these are in pairs, where one is a reflection of the other in the y–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:

  1. γ1:y=-0.1x2+14.1

  2. γ2:y=0.05x2+4

  3. γ3:y=-0.25x2+4.4x-16.15

  4. γ4:y=-0.3x2+2.7x-5

  5. γ5:y=-10x+14

  6. γ6:y=5x+3

  7. γ7:y=5.5

Figure 3: The Various Curves

4 Maxing Out

The lower part of the logo is the simplest. This is defined by curves γ3 and γ4 and we simply take their maximum, as in Figure 4. Thus:

γlow=γ3γ4

Figure 4: The Lower Part of the Curve

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 γ6 and γ7, after which we take the minimum of that with γ5, as in Figure 5. Thus:

γhead=γ5(γ6γ7)

Figure 5: The Head Curve

The inner part of the upper curve is then the maximum of this and γ2, and the full upper curve is the minimum of that with γ1 as in Figure 6:

γhigh=γ1(γ2(γ5(γ6γ7)))

Figure 6: The Upper Curve

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 y=γlow(x), we have to plot (x(t),y(t))=(t,γlow(t)). This is because the graph of a function cannot double back on itself horizontally. So what we want to do is something like:

t{(t,γlow(t))-11t11(22-t,γhigh(22-t))11t33

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 x=±11.

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 y–coordinate of our path. The "backtracking" will result from what happens to the x–coordinate. While the y–coordinate is along the upper part of the curve, the x–coordinate should simply increase, then when the y–coordinate moves to the lower part, the x–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.

To form the y–coordinate path, we start by translating the upper and lower paths so that they are side-by-side3 as in Figure 7.

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.

γy(t)=γhigh(t+11)γlow(t-11)

Figure 7: The Unravelled Curve

The x–coordinate path just needs to go from -11 to 11 and back again.

γx(t)=11-tγy(t)=γhigh(t+11)γlow(t-11)
1

Putting that together, we get our final curve as:

β(t)=(γx(t),γy(t))

Figure 8: The Full Parametrised Curve

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 γlow and γhigh are defined.

It is with some trepidation, therefore, that I am going to unroll the definition of γy back to a function of t.

Thanks to the left and right shifts, we can rearrange the final form of γy slightly.

γy(t)=γhigh(t+11)γlow(t-11)=(γ1(t+11)γ3(t-11)γ4(t-11))=(γ2(t+11)(γ5(t+11)(γ6(t+11)γ7(t+11))))=((-0.1t2-2.2t+2)(-0.25t2+5.5t-46.4+4.4t-11)=((-0.3t2+6.6t-41.3+2.7t-11))=((0.05t2+1.1t+10.05)((-10t+11+14)((5t+11+3)5.5)))=(-0.1t2-2.2t+2-0.25t2+5.5t-46.4+4.4t-11-0.3t2+6.6t-41.3+2.7t-11)(0.05t2+1.1t+10.05(-10t+11+14(5t+11+35.5)))

Putting the x and y parts together, we get:

(11-t,(-0.1t2-2.2t+2-0.25t2+5.5t-46.4+4.4t-11-0.3t2+6.6t-41.3+2.7t-11)(0.05t2+1.1t+10.05(-10t+11+14(5t+11+35.5))))