Thursday, October 15, 2020

Down The Rabbit Hole

Charles Dodgson who wrote the wonderful book Alice's Adventures in Wonderland under the pen name Lewis Carroll was a mathematician by training and practice. His book was admirably illustrated by Sir John Tenniel. Dodgson  made some good strides in mathematical logic, linear algebra, and matrix operations. Of course, who doesn't remember who Alice spotted one fine day and decided to follow. 

 


Our notorious white rabbit, and so down his rabbit hole we go to do some exploring. Namely data, mathematics, curve fitting, and models,  all of which would be familiar territory for Dodgson. I was planning to post on a completely different matter when I realized I have been remiss, and that I needed to better define some things. 

Let me start with the term "data". Data is usually seen to be the measured result of some sort of experiment. In today's world of high volume information the term's usage can often be a bit misleading. The term data might also be used as an inference or a reduced value from something else that is measured. This is where you have to be careful. If the data has been reduced or inferred from some other measurement you need to know exactly how that was done to make further deductions and inferences.

This leads us to mathematics. It's easiest to think of it as a language that's used to describe things around us in a formal manner. But like any other language it can be misconstrued. A mathematical expression can be established for most anything yet still be totally unsuitable in describing that thing. Or as Humpty Dumpty might have put it.

"... it means just what I choose it to mean -- neither more nor less..."

So I try to pay attention to the underlying mathematics to make some sort of judgement about the expressions having a basis in the physical reality being described. For example, in the posts I did on the SIR Model and disease spreading I spent a fair amount of time considering the mathematics. The basis for the SIR model follows certain aspects of the Predator-Prey model developed by Lotka and Volterra, et. al.

Though those two things might seem very different they hold to a similar relationship. That is the interdependency of the two groups necessary for the relationship. Predator-Prey and Infected-Susceptible. The Predator-Prey mathematical relationships have been tested against real measurements of populations and in many systems show fairly good agreement. Similarly the expressions for disease spreading against observed infections have been well noted. This implies that the underlying mathematical expressions can describe the given phenomena under certain conditions.

Curve fitting, or how to obfuscate with nice looking graphics. Humans are pretty good at pattern recognition and we like to see smooth curves which seem to describe a collection of measurements. In fact we'll often assume that the nicely smoothed curve going through the data is a good physical representation of the real world. Let me give an example. I've been writing some code to fit data and I'm at a certain stage in the problem. Here's a plot with the data and the curve fit.


It looks pretty good doesn't it? There is only one problem, none of it is real. It's just numbers with a curve drawn through them according to a mathematical expression I believe to be relevant to the problem. I deliberately did this to check on how my algorithm "fits" the curve to the "data" on a previously established set of mathematical expressions. The data itself was generated using those mathematical expressions with some random noise thrown in to skew things a bit. The question was whether my fitting routine gave me the same parameter values as to what I used to create the data set. If not, why not? Fortunately for me it did. So now I can put them in a model.

Any model is really just a set of mathematical expressions, which can be solved either analytically or numerically, that we hope accurately represents the thing we are studying. It could be unrepresentative, which is where experience and work by others becomes so important. Let me give a real world example: For my engine controller I had to know how much fuel is to be injected into each cylinder. I started with the mathematical expressions for the Ideal Gas Law and the chemistry for stoichiometric burning for fuel in air.

Equations for Burning a Fuel in an Engine.

From these two, and measuring the temperature and pressure in the cylinder I can calculate the mols of fuel required in the cylinder. The temperature and pressure are derived from curve fits to the measured voltage output or resistance of the transducer being used. Which is a whole separate field of endeavor, that of transducer development and calibration.

The engine runs, so I am at least on the right trail, but that is rarely the whole story. For now that's enough as it appears I am late for another function.




No comments:

Post a Comment