first principles: modeling for function so that you can dance with change.

First principles

The art of modelling for function rather than form
Published: 2021 01 19

Working from first principles is essentially about effectively modelling.

In one of my first science classes our teacher summed up science as the process of building and improving models. The better the model the better the predictions.

An important point was that no model was perfect. (If it was perfect, it was no longer model. It was the thing that was being modelled!) As a result, science is a process of constantly building better models.

What has this to do with first principles?

Modelling looks vs modelling function

When I was a kid I used to build plastic models of planes. These models were scale, generally 1/72 of actual size and they were models in shape only. They were designed to look like the thing modelled. The pieces that a model was made of bore no resemblance to the pieces the actual thing was made of. Instead, these pieces were made in such a way that they were easy to manufacture in plastic and easy for the end user to put together.

Some artists or perhaps artisans is the better word, take the time to make miniature models that are a scale model in every aspect, they actually fly or operate.

And so there are different ways to model something.

Building a model that works

The person who makes a working scale model could be said to be working from first principles because they've taken the actual thing (or the plans for it) and reproduced every part in scaled down detail.

As a result, assuming they can get a driver or pilot small enough, this model can react fairly closely to how the real thing works.

More importantly, because they've build a scale model that actually works, they understand how the real thing works.

This probably wasn't exactly the type of model that my science teacher was talking about. But the idea is basically the same. A model is a representation of reality. It can be a representation of the way something looks, or it can be a representation of how something functions.

In terms of function, the better your model is, the more detailed it is, the better you understand the thing that is modelled.

How do you build a model that actually works? By looking at the real thing, or the plans for it, seeing the parts and how they relate, and by making those parts, and by putting them together.

What working from first principles is

Working from first principles is a way of thinking, of analyzing, of coming to a level of understanding. It's a way of modelling. It's a way of using scientific methodology to work towards better understanding.

Working from first principles is about building models that go beyond mere looks and into function. They represent how the thing being modelled actually works.

First principle thinking is about understanding the thing we are modelling or learning to understand it.

It's about actually learning a subject versus cramming enough in to pass a test.

Learning from Apple

A good example of working from first principles is apple. (popularmechanics.com/ipad-handwriting-recognition-ios14) There are perhaps quite a few examples of how they work from first principles while their opponents simply copy them but a really good example of working from first principles is their approach to hand writing recognition using the apple pencil.

Instead of analyzing lots of examples of handwriting, they actually took measurements while people were using the pencil.

The idea was to recognize text as it was being written and to model that (and even predict it) they had volunteers come in and write while they measured (and I'm guessing here) things like pen angle, velocity (speed in a given direction) and changes in pressure.

As a result they were able to develop an app that wasn't reliant on cloud computing. Instead they have hand writing recognition that needs only rely on the device's built in processor.

Because they've taken measurements of lots of people's handwriting while they are writing their model can, in part, predict hand writing input. As a result, their software can output text as it is hand written.

And this is perhaps another thing about first principle thinking.

When you understand something deeply enough you can begin predicting what can happen.

Experiments

To better understand how to work from first principles we can take a rough look at how scientists run experiments.

Scientists do experiments to help prove theories right or wrong, and to help refine theories.

In any experiment, a scientist will reduce a complex system down to as few parts as possible so that they can study how that isolated part works in controlled conditions.

When scientist carry out experiments they can run through a range of inputs and notice the outputs. They can then build or improve their model of the thing they are experimenting with.

Or not. Not all experiments are succesfull. Not all experiments result in or produce an effective model or help to deepen understanding of the thing being studied.

Sometimes some of the assumptions made have to be changed.

from this article:

technologyreview.com/ai-fourier-neural-network-cracks-navier-stokes-and-partial-differential-equations

"Now here's the crux of the paper. Neural networks are usually trained to approximate functions between inputs and outputs defined in Euclidean space, your classic graph with x, y, and z axes. But this time, the researchers decided to define the inputs and outputs in Fourier space, which is a special type of graph for plotting wave frequencies...

Why does this matter? Because it's far easier to approximate a Fourier function in Fourier space than to wrangle with PDEs in Euclidean space, which greatly simplifies the neural network's job. Cue major accuracy and efficiency gains: in addition to its huge speed advantage over traditional methods, their technique achieves a 30% lower error rate when solving Navier-Stokes than previous deep-learning methods...

Though they haven't yet tried extending this to other examples, it should also be able to handle every earth composition when solving PDEs related to seismic activity, or every material type when solving PDEs related to thermal conductivity."

Bringing this back to first principle thinking, the focus with first principle thinking is getting a model that works as well as possible. And that means questioning assumptions (or testing) to make sure that that the model does in fact resemble the thing it is supposed to represent.

The importance of testing, and of knowing what you are trying to do

There is a lot to be gathered from that article, but I'll point out here that one of the key habits for working from first principles is testing your work or your assumptions.

As an example of this, during one of my work terms while in university, my supervisor gave me a simple task. "Produce an engineering drawing of a spring we'd modified for a small calibre target rifle."

I printed the drawing without checking my work. Instead, I just gave it to him. And he promptly gave it back. I'd forgotten something. A dimension or perhaps it was the units used. So I redid the drawing, printed it and again gave him the output without checking.

The frustration you feel in reading this is perhaps a small portion of the frustration he felt especially as this process repeated several more times.

Eventually I got it in my head that I needed to check my work before I handed it to him.

And that's another important point. In order to test something you've done, or check it you need to know what you are checking for. And so another aspect of working from first principles is having a clear idea of what it is that you are trying to do.

Having clear references

I should point out here that another essential lesson from science class was that in order to measure things (and in order to create a desired change) you need a reference, a datum. One of the examples that sticks in my mind is measuring temperature. In order to measure it we need a reference point. Using the centigrade scale, this reference, called 0 degrees, is the freezing point of water.

References in a lot of cases are so obvious that we don't even think about it.

When I was in the army part of our training as an armourerer was a few months of bench fitting which could be summed up as learning to saw and file accurately.

One of our first projects was to file three adjacent faces of a piece of metal flat and square. And so the first job was to file one face flat. Once we had it flat we could then use it as a reference for filing the next face flat but also square to the first face. then we filed the third face using the first two faces as references.

If it came time to cut a piece of metal, we'd take measurements and then scribe a line to cut against. To measure we needed a reference, a fixed point or line.

A more obvious example of a reference is firing a rifle. The target is the fixed reference. But so that the rifle naturally points at the target we have to adjust our position and the way we hold the rifle so that it naturally points at the target. Since the target is fixed, and we can't change it, we change ourselves to suit.

This same idea is also important in partner dancing. One person is the lead, the fixed reference. With a fixed reference the partner, the follower can express the idea of the dance. One isn't better than the other. Instead, they are two necessary parts that make the dance realizable.

Note how the idea of having a reference, a fixed point is important both when taking measurements (i.e. measuring temperature or where to cut). It's also important when making actual changes.

Art and science

Artists are often like scientists in that they try to capture and portray reality.

Like scientists, the better they understand, in particular from first principle thinking, the better they can convey.

As an example of this, when I was in university, or perhaps even before this, when I was in the army, I picked up a book by Burne Hogarthe called dynamic anatomy. The book was filled with figure drawings drawn not from a model but directly from the author's imagination. What he used, and what he taught in his series of books was a series of guidelines, a canon for drawing the human body. this canon was based on the observation of the various parts of the human body and how they related to each other. And as a datum or reference of sorts, the length of a head was the basic unit of measure.

The idea of this book was to give the potential artist the freedom to draw the human figure in any position and form any angle. And so many of the lessons were about understanding how the apparent relationship between parts changed as viewing angle changed.

Note that this was a set of guides for drawing the figure in any position and from any angle and here again is the idea of first principles. When you've really got the fundamentals have a lot more freedom.

And this was something else the author talked about. The idea was to first learn to draw within the lines. draw the "average" or "ideal" human first. Once that became learned it was then possible to diverge from this using the "ideal" as a reference.

Note the clear idea guiding the construction of this book "drawing the human figure freely". Every part in that book was towards that end.

When an artist becomes responsive

And you might point out here, "hey wait a minute, isn't the idea of this article to build models based on function, and not form...?"

A way to look at it is that when an artists draws or sculpts, they are creating a change. Now someone could draw a human figure over and over again, perhaps using a model as a reference. Or, they could draw a figure based on a model that they have in their minds eye. And rather than being rigidly bound, they can then express this model anyway they see fit. They then produce a work that is in response to whatever they are feeling at the time.

Another good example of working from first principles is google.

One of the original intents that drove the creation of google was that one of the creators wanted to download the entire internet on his computer.

Another intent was that of somehow ranking pages for content. To get to where they are now, the creators had to play with downloading the internet and ranking each page. They had to work from first principles to begin what is now google.

So whether you are a scientist or an artist (or an engineer), working from first principles is about creating understanding. This understanding comes from knowing how things work together, how they function.

Put in slightly different words, working from first principles is about creating and improving models within your brain, or if you like, within our consciousness. And rather than being models designed to mimic form, these are models that are based on function.

Defining function

What is "function" (what is "a function"?). In maths, a function is something that creates an output based on an input. What you could say is that it is a device, a construct that creates a change based on the change that it is subjected to. So when working from first principles what you are trying to do is understand how the thing you are working with deals with change. You are trying to understand how it changes in response to change.

first principles: modeling for function so that you can dance with change.

Zero Parallax

First principles

Basic principles

ideas as units of meaning: and as the potential for change