Abusing numbers and the importance of type checking
November 8, 2015 8 Comments
What would you say if I told you that I could count to infinity on my hands? Infinity is large, and I have a typical number of fingers. Surely, I must be joking. Well, let me guide you through my process. Since you can’t see me right now, you will have to imagine my hands. When I hold out the thumb on my left hand, that’s one, and when I hold up the thumb and the index finger, that’s two. Actually, we should be more rigorous, since you are imagining my fingers, it actually isn’t one and two, but i and 2i. This is why they call them imaginary numbers.
Let’s continue the process of extending my (imaginary) fingers from the leftmost digits towards the right. When I hold out my whole left hand and the pinky, ring, and middle fingers on my right hand, I have reached 8i.
But this doesn’t look like what I promised. For the final step, we need to remember the geometric interpretation of complex numbers. Multiplying by i is the same thing as rotating counter-clockwise by 90 degrees in the plane. So, let’s rotate our number by 90 degrees and arrive at .
I just counted to infinity on my hands.
Of course, I can’t stop at a joke. I need to overanalyze it. There is something for scientists to learn from the error that makes this joke. The disregard for the type of objects and jumping between two different — and usually incompatible — ways of interpreting the same symbol is something that scientists, both modelers and experimentalists, have to worry about it.
I will focus this post on the use of types from my experience with stoichiometry in physics. Units in physics allow us to perform sanity checks after long derivations, imagine idealized experiments, and can even suggest refinements of theory. These are all features that evolutionary game theory, and mathematical biology more broadly, could benefit from. And something to keep in mind as clinicians, biologists, and modelers join forces this week during the 5th annual IMO Workshop at the Moffitt Cancer Center.
Stoichiometry was one of the most useful things I learned in high-school. It was probably my first exposure to type checking. Given that I went on to do almost no chemistry, stoichiometry for me became the art of converting between units. It was particularly helpful in physics. In a typical introductory physics problem, you are given a bunch of numeric properties associated with objects in specific units: this cart weighs 10 kg, that battery has a 9 V potential, this train is traveling at 60 miles/hour, etc. You were then asked for an answer, which was usually also some quantity with units. If you know how to convert between units — for example, that a newton is a kg*m/s^2 — then you could usually guess the form of your final equations — F = ma. Given that (introductory) physics is simple, your guess — especially if supplemented by some basic physical intuition to get the signs — would probably end up being qualitatively right, although maybe off by some constant factors. For example, if you know that energy is measured in Joules which are kg*m^2/s^2 then you would guess right that E = Fd, but be off by a factor of 2 when you guessed that E = mv^2; although that particular case could be fixed by knowing the calculus of polynomials and that introducing a power of 2 is accompanied by a factor of 1/2. On the flip side, if (you thought that) you knew what you were doing, but your final answer came out in the wrong units then that was a clear sign that you made a mistake earlier in your derivation. Given how careless I am with details, this saved me a lot of work in college.
As you go on in theoretical physics, stoichiometry becomes second nature and more of a chore than insight. You start designing systems of units where as many constants as possible disappear, and you start defining properties that are unitless. But that doesn’t mean that analyzing units was just a hack to get past poorly designed exam questions. In physics, many of the basic units are things we can (relatively) easily measure — distance, time, etc. — or infer in a straightforward way — mass, charge, etc. When we see an equation, we know how the types of the objects in the equation map back, at least roughly, to idealized experiments. This allows theory to stick closer to experiment, and vice versa.
It might seem like units in physics are easy or obvious, but I think that is only because the underlying logic of measurement has been imbedded so deeply in our minds. The fact that this logic exists and inter-relates so many of your measures of interests so consistently is stunning. Compare this to the difficulty of assigning units and conversion factors to quantities like fitness or utility in evolutionary game theory. Or to how isolated these units feel within a typical EGT model and how few compound units one typically encounters.
Being mindful of the same types showing up in very different settings, can also help drive new theoretical questions and insights. For example, Newton defined the property of mass in two different ways. One was the inertial mass of m = F/a and the other was the gravitational mass from how two objects interact with each other through gravity. These give two completely different metaphysical interpretations for mass — one is related to the resistance to motion; the other to the attractions of other massive objects — and two different experimental procedures for measuring it. On the surface of it, calling them by the same name is a lot like calling numbers on imagined fingers the same thing as imaginary numbers.
Yet when we measured inertial and gravitational mass, they were always the same. They seem to follow the same logic. For Newton, this was a curious and accidental empirical fact. After introducing inertial mass, he writes in the Principia:
Its [mass] can also be known from a body’s weight, for – by making very accurate experiments with pendulums – I have found it to be proportional to the weight
He went on to measure this empirical correspondence with many carefully crafted experiments with pendulums made of different materials, and also argued for it from astronomical observations of the moons of Jupiter. It is important to note though that had some of his measurements resulted in non-proportionality between inertial and gravitational mass, this would not have falsified his theory. It would have just forced us to associate two independent mass properties with each object, and this would feel no stranger than how we currently associate a separate property of charge.
Geometric theories of gravity like Einsteins, however, demand that gravitational and inertial mass are numerically identical because they are ontologically the same thing: gravitational motion is just inertial motion in a curved space-time. General relativity — or at least the usual geometric interpretation of it — would be falsified by a discrepancy between inertial and gravitational mass. Thus, providing an explanation of why two not obviously related units are the same produced a more falsifiable theory. It produced a stronger theory.
Unfortunately, when kids are first introduced to physics, this distinction is avoided. We learn classical mechanics with both inertial and gravitational mass measured by the same unit and represented by the same symbol. Usually do not go on to ask the questions of correspondence that vexed Newton, motivated Einstein, and still excite physicists today.
But whenever we see a number or property in our models called by a suggestive name, we should be asking these sort of critical questions. Does this property follow the logic of the type we are assigning to it? Can it be measured by experiments associated with the type we are assigning to it? Are we using two completely different experiments but assuming they are measuring the same thing just because we used the same name?
These are questions that both experimentalists and theorists should be asking. To share a pet-peeve from the experimental side: an example of not asking the first of the above three questions. In many studies, the quantity of interest becomes a proportion, probability, or some other percentage. This is then plotted over time, and some sort of trend becomes evident. Maybe the proportion is increasing. The experimenters then proceed to fit a line, or run some stats to rule out a simple linear fit in favor of a more complicated model. The choice of line is justified as the simplest model. Only problem is that linear models do not act on proportions, probabilities, or other percentages; their inputs are numbers of a different a type. A type whose logic does not bind them between 0 and 1. And the model only seems natural and simple under addition, but the natural operation for probabilities is multiplicative.
We need to be very mindful of operationalizing our properties and equations. Earlier this year I started working towards this more carefully for the fitness function and local environment of replicator dynamics. In these cases I was trying to answer the second question: what is the logic of measurement associated with our properties? What is the (simplest) model this logic implies? The main goal is to make sure that I am not inadvertently using my imaginary models to rigorously count to infinity. A hopeful consequence is to bring theory and experiment closer together in EGT. This will require both continued philosophical interrogate of the models and dialogue with experimentalists. Something that I won’t lack during this weeklong IMO Workshop.