art with code


Simple math

What is math? My current thinking is that math is a system that preserves some property. This property might be called "truth", or "internal consistency", or something like that. The big idea is that if you have a system like that and if you can describe a situation in terms of that system, you can use the system to manipulate your description while preserving the system's idea of truth.

That's a bit nebulous a description, so here's an example: I have two apples and give you one. How many apples do I have now? Let's describe this situation in terms of integer addition. Integer addition is a mathematical system where you can add up integers in a way that preserves a "truth" about it. Ok, we have a binary operator "give" and we'll map it to "minus", or "add the add-inverse of". Then map apples to integers by leaving out the apple-quantifier. What we get is "add to two the add-inverse of one", i.e. 2 + -1, or, in shorthand 2 - 1. Following the rules of addition, the result is one. Then we map the result back to apples by adding the apple-quantifier and get one apple.

Right. What was the truth preserved in the above? Addition is closed over integers, so "integerness" was preserved in the addition. "Additionness" was also preserved by doing the addition correctly. And it maps to reality pretty well too, if in a limited manner. To demonstrate some limitations in the above mapping, consider these: what if I am also you, what if I have zero apples, what if giving does not map to inverse adding, what if the apples-to-integers conversion isn't that simple (e.g. suppose an "apple" means "150g of apple flesh sans peel, stem, seeds and worms"). But if you keep the limitations in mind, it works well enough for everyday use.

The real power comes from mapping the preserved properties in a mathematical system to whatever you're interested in. If you deem that "integerness" and "additionness" do generally map to reality well enough for you, and you have good enough mappings to integers from the things you're interested in, you can bring a whole lot of different things to the integer addition system and do your manipulations inside it. Abstracting from

"I have two apples and give you one apple" => "I have (two + -one) apples"


"A has x Ts and gives B y Ts" => "A has (x + -y) Ts".

As most mappings between systems are lossy, you often have problems and limitations caused by that. Suppose something simple like adding speeds together. The problem there is that "additionness" doesn't always map to reality. Instead of "x + y" reality might follow "(x+y) / (1+xy/c^2)". Or go all general relativity on you. Further, with velocities "integerness" doesn't hold either and you need to start adding spacetime four-velocities instead (why yes, I did just look that up on Wikipedia).

And even if you do get a reasonable reality-to-property mapping going on, the element mapping might be wonky. Mapping apple mass to integers with a +- 2kg mapping error (e.g. from inaccurate scales) gets you decently accurate numbers if you're weighing apples by the ton. But if you're selling a single apple made out of gold, the error might mean the difference between you paying out 100k to get someone accept -1.8kg of gold and the buyer paying 100k too much.

Every operation you do on the values is also applied to the error distribution. Perhaps a better way to think about this would be to think of numbers as histograms: Do a calibration run on each value to get their histograms, then when measuring an object, take the histogram for the measured value. Adding two histograms together would mean taking their Cartesian product and adding up each pair. Or - as the histograms would get huge after a couple operations - approximate them with distribution functions with the measured value as the median of the distribution.

Anyhow! Systems that preserve properties. Math.
Post a Comment

Blog Archive

About Me

My photo

Built art installations, web sites, graphics libraries, web browsers, mobile apps, desktop apps, media player themes, many nutty prototypes