The network theory series is back! You may have thought it died out, but in fact it’s just getting started. Over the last year my grad students have made huge strides in working out the math of networks. Now it’s time to explain what they’ve done.
In the last three episodes I explained how electrical circuits made of resistors, inductors and capacitors are a great metaphor for many kinds of complex systems made of interacting parts. And it’s not just a metaphor; there are mathematically rigorous analogies—in other words, isomorphisms—between such electrical circuits and various other kinds of ‘passive linear networks’.
I showed you a chart of these analogies last time:
|Mechanics: rotation||angle||angular velocity||angular momentum||torque|
|Electronics||charge||current||flux linkage||voltage||Hydraulics||volume||flow||pressure momentum||pressure|
|Thermal Physics||entropy||entropy flow||temperature momentum||temperature|
|Chemistry||moles||molar flow||chemical momentum||chemical potential|
But what do I mean by a ‘passive linear network’? Let me explain this very roughly at first, since we’ll be painfully precise later on.
Right now by ‘network’ I mean a graph with gizmos called ‘components’ on the edges. For example:
In a network there is some kind of ‘flow’ running along each edge, and also some kind of ‘effort’ across that edge. For example, in electronics the flow is electrical current and the effort is voltage. The chart shows the meaning of flow and effort in other examples.
‘Passivity’ means roughly that none of the components put out energy that didn’t earlier come in. For example, resistors lose energy (which goes into heat, which we’re not counting). Capacitors can store energy and later release it. So, resistors and capacitors are passive—and so are inductors. But batteries and current sources actually put out energy, so we won’t allow them in our networks yet. For now, we’re just studying how passive components respond to a source of flow or effort.
For some subtleties that show up when you try to make the concept of passivity precise, try:
• Passivity (engineering), Wikipedia.
Finally, ‘linearity’ means that the flow along each edge of our network is linearly related to the effort across that edge. Here are the key examples:
• For electrical resistors, linearity is captured by Ohm’s law. If an edge in our network is labelled by a resistor of resistance usually drawn like this:
then Ohm’s law says:
where is the voltage across that edge and is the current along that edge.
• If our edge is labelled by an inductor of inductance :
Here we need to think of the voltage and current as functions of time.
• If our edge is labelled by a capacitor of capacitance :
we write the equation
where again we think of the voltage and current as functions of time.
Both linearity and passivity are simplifying assumptions that we eventually want to drop. If we include batteries or current sources, we’re dropping passivity. And if include transistors, we’re dropping linearity. Obviously both these are important!
However, there is a lot to do even with these simplifying assumptions. And now it’s time to get started!
In what follows, I will not use the terms ‘flow’ and ‘effort’, which are chosen to be neutral and subject-independent. Instead, I’ll use the vocabulary from electronics, e.g. ‘current’ and ‘voltage’. The reason is that we’ve all heard of resistors, capacitors, Ohm’s law and Kirchhoff’s laws, and while these have analogues in every row of the chart, it seems pointless to make up weird new ‘neutral’ terms for all these concepts.
But don’t be fooled by the jargon! We’re not merely studying electrical circuits. We’ll be studying passive linear networks in full generality… with the help of category theory.
Linear passive networks as morphisms
To get going, let’s think about circuits made of resistors. We can do this without harm, because we’ll later include capacitors and inductors using a simple effortless trick. Namely, we’ll generalize the ‘resistance’ of a resistor, which is a real number, to something called ‘impedance’, which is an element of some larger field. Everything will be so abstract that replacing resistances with impedances will be as easy as snapping our fingers.
Right now I want to define a category where the morphisms are circuits made of resistors. Any morphism will go from some ‘inputs’ to some ‘outputs’, like this:
So a morphism is roughly a graph with edges labelled by numbers called ‘resistances’, with some special nodes called ‘inputs’ and some special nodes called ‘outputs’.
What can do with morphisms? Compose them! So, suppose we have a second morphism whose inputs match the outputs of the first:
Then we can compose them, attaching the outputs of the first to the inputs of the second. We get this morphism as the result:
So, composing morphisms is a way to build big electrical circuits—or other ‘linear passive networks’—out of little ones.
This seems pretty simple, but let’s try to formalize it and see why we have a category. In fact it takes a bit of thought. To check that we get a category, we need to check that composition is associative:
and that each object has an identity morphism that does what an identity should:
All these equations seem obviously true in our example… until you try to prove them.
You might think an identity morphism should be a bunch of straight pieces of wire—a bunch of edges each with an input node and an output node—but that doesn’t quite work, since sticking an extra edge onto a graph gives a new graph with an extra edge!
Also, we are composing circuits by ‘sticking them together’. This process is formalized in category theory using a pushout, and pushouts are only defined ‘up to canonical isomorphism’. The very simplest example is the disjoint union of two sets. We all know what it means, but if you examine it carefully, you’ll see it’s only defined up to canonical isomorphism, because it involves a choice of how we make the two sets disjoint, and this choice is somewhat arbitrary.
All this means the category we’re after is a bit subtler than you might at first expect; in fact, it’s most naturally thought of as a bicategory, meaning roughly that all the equations above hold only ‘up to canonical isomorphism’.
So, we proceed like this.
First we define a concept of ‘labelled graph’, where (for now) only the edges are labelled. We do this because we want our circuits to have edges labelled by ‘resistances’, which are real numbers. But we do it in greater generality because later we’ll want the edges to be labelled by ‘impedances’, which are elements of some other field. And since we’re studying electrical circuits just as examples of networks, later still we will probably want graphs whose edges are labelled in still other ways.
Definition. A graph consists a finite set of edges, a finite set of nodes, and two functions
Thus each edge will have some node as its source and some node as its target:
Definition. Given a set we define an -labelled graph to be a graph together with a function This assigns to each edge its label We call the label set.
We use the letter because for circuits of resistors we will take the label set to be
the positive real numbers, and will be the resistance of the edge For circuits that also contain inductors and capacitors we will take the label set to be the positive elements of some larger field… but more about that later!
Now we want to give our -labelled graph a set of nodes called ‘inputs’ and a set of nodes called ‘outputs’. You might think the set of inputs should be disjoint from the set of outputs, but that’s a tactical error! It turns out an identity morphism in our category should have the inputs being exactly the same as the outputs… and no edges at all:
To handle this nicely, we need to make a category of -labelled graphs. This works in the obvious way, if you’re used to this stuff. A morphism from one -labelled graph to another sends edges to edges, nodes to nodes, and preserves everything in sight:
Definition. Given -graphs and a morphism of -labelled graphs from to is a pair of functions
such that the following diagrams commute:
There is a category where the objects are -labelled graphs and the morphisms are as we’ve just defined them.
Warning: the morphisms in are not the morphisms of the kind we really want, the ones that look like this:
They are just a step along the way. A morphism of the kind we really want is a diagram like this in :
where is an -labelled graph and are -labelled graphs with no edges!
You see, if and have no edges, all they have is nodes. We call the nodes of the inputs and those of the outputs. The morphisms and say how these nodes are included in is our circuit made of resistors.
In general, any diagram shaped like this is called a cospan:
If we turned the arrows around it would be called a span. Cospans are good whenever you a thing with an ‘input end’ and an ‘output end’, and you want to describe how the ends are included in the thing. So, they’re precisely what we need for describing a circuit made of resistors, like this:
This makes us want to cook up a category where:
• an object is an -labelled graph with no edges. We can alternatively think of it as a finite set: a set of nodes.
• a morphism from to is a cospan of -labelled graphs:
We still need to say how to compose these morphisms. We know it will amount to attaching the outputs of one circuit to the inputs of the next—that’s all there is to it! But we need to make this precise and prove we get a category. And as I’ve hinted, we will actually get something bigger and better: a bicategory! This will come as no surprise to if you’re familiar with span and cospan bicategories–but it may induce a heart attack otherwise.
This bicategory can then be ‘watered down’ to give our category And when we take
we’ll get the category where morphisms are circuits made of resistors! We’ll call this
Then I’ll explain what we can do with this category! There’s no end of things we could do with it. But the main thing Brendan does is study the ‘black-boxing’ operation, where we take a circuit, forget its inner details, and only keep track of what it does. This turns out to be quite interesting.
I thank Brendan Fong for drawing some of the pictures of circuits here. For the details of what I’m starting to explain here, read our paper:
• John Baez and Brendan Fong, A compositional framework for passive linear networks.
You can learn more about the underlying ideas here:
• Dean C. Karnopp, Donald L. Margolis and Ronald C. Rosenberg, System Dynamics: a Unified Approach, Wiley, New York, 1990.
• Forbes T. Brown, Engineering System Dynamics: a Unified Graph-Centered Approach, CRC Press, Boca Raton, 2007.
• Francois E. Cellier, Continuous System Modelling, Springer, Berlin, 1991.