## August 5, 2020

### Open Systems in Classical Mechanics

#### Posted by John Baez

I think we need a ‘compositional’ approach to classical mechanics. A classical system is typically built from parts, and we describe the whole system by describing its parts and then saying how they are put together. But this aspect of classical mechanics is typically left informal. You learn how it works in a physics class by doing lots of homework problems, but the rules are never completely spelled out, which is one reason physics is hard.

I want an approach that makes the compositionality of classical mechanics formal: a category (or categories) where the morphisms are open classical systems—that is, classical systems with the ability to interact with the outside world—and composing these morphisms describes putting together open systems to form larger open systems.

There are actually two main approaches to classical mechanics: the Lagrangian approach, which describes the state of a system in terms of position and velocity, and the Hamiltonian approach, which describes the state of a system in terms of position and momentum. There’s a way to go from the first approach to the second, called the Legendre transformation. So we should have a least two categories, one for Lagrangian open systems and one for Hamiltonian open systems, and a functor from the first to the second.

That’s what this paper provides:

The basic idea is not new—but there are some twists! I like treating open systems as cospans with extra structure. But in this case it makes more sense to use spans, since the space of states of a classical system maps to the space of states of any subsystem. We’ll compose these spans using pullbacks.

For example, suppose you have a spring with rocks at both ends:

If it’s in 1-dimensional space, and we only care about the position and momentum of the two rocks (not vibrations of the spring), we can say the phase space of this system is the cotangent bundle $T^\ast \mathbb{R}^2.$

But this system has some interesting subsystems: the rocks at the ends! So we get a span. We could draw it like this:

but what I really mean is that we have a span of phase spaces:

Here the left-hand arrow maps the state of the whole system to the state of the left-hand rock, and the right-hand arrow maps the state of the whole system to the state of the right-hand rock. These maps are smooth maps between manifolds, but they’re better than that! They are Poisson maps between symplectic manifolds: that’s where the physics comes in. They’re also surjective.

Now suppose we have two such open systems. We can compose them, or ‘glue them together’, by identifying the right-hand rock of one with the left-hand rock of the other. We can draw this as follows:

Now we have a big three-rock system on top, whose states map to states of our original two-rock systems, and then down to states of the individual rocks. This picture really stands for the following commutative diagram:

Here the phase space of the big three-rock system on top is obtained as a pullback: that’s how we formalize the process of gluing together two open systems! We can then discard some information and get a span:

Bravo! We’ve managed to build a more complicated open system by gluing together two simpler ones! Or in mathematical terms: we’ve taken two spans of symplectic manifolds, where the maps involved in are surjective Poisson maps, and composed them to get another such span.

Since we can compose them, it shouldn’t be surprising that there’s a category whose morphisms are such spans — or more precisely, isomorphism classes of such spans. But we can go further! We can equip all the symplectic manifolds in this story with Hamiltonians, to describe dynamics. And we get a category whose morphisms are open Hamiltonian systems, which we call $\mathsf{HamSy}.$ This is Theorem 4.2 of our paper.

But be careful: to describe one of these open Hamiltonian systems, we need to choose a Hamiltonian not only on the symplectic manifold at the apex of the span, but also on the two symplectic manifolds at the bottom — its ‘feet’. We need this to be able to compute the new Hamiltonian we get when we compose, or glue together, two open Hamiltonian systems. If we just added Hamiltonians for two subsystems, we’d ‘double-count’ the energy when we glued them together.

This takes us further from the decorated cospan or structured cospan frameworks I’ve been talking about repeatedly on this blog. Using spans instead of cospans is not a big deal: a span in some category is just a cospan in the opposite category. What’s a bigger deal is that we’re decorating not just the apex of our spans with extra data, but its feet — and when we compose our spans, we need this data on the feet to compute the data for the apex of the new composite span.

Furthermore, doing pullbacks is subtler in categories of manifolds than in the categories I’d been using for decorated or structured cospans. To handle this nicely, my coauthors wrote a whole separate paper!

Anyway, in our present paper we get not only a category $\mathsf{HamSy}$ of open Hamiltonian systems, but also a category $\mathsf{LagSy}$ of open Lagrangian systems. So we can do both Hamiltonian and Lagrangian mechanics with open systems.

Moreover, they’re compatible! In classical mechanics we use the Legendre transformation to turn Lagrangian systems into their Hamiltonian counterparts. Now this becomes a functor:

$\mathcal{L} \colon \mathsf{LagSy} \to \mathsf{HamSy}$

That’s Theorem 5.5.

So, classical mechanics is becoming ‘compositional’. We can convert the Lagrangian descriptions of a bunch of little open systems into their Hamiltonian descriptions and then glue the results together, and we get the same answer as if we did that conversion on the whole big system. Thus, we’re starting to formalize the way physicists think about physical systems ‘one piece at a time’.

Posted at August 5, 2020 2:22 AM UTC

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3239

### Re: Open Systems in Classical Mechanics

And by replacing real numbers with quasiprobability distributions you get open systems in quantum mechanics.

### Re: Open Systems in Classical Mechanics

This switch from cospans to spans feels to me like the duality between algebra and geometry, or more generally the dualization that happens when taking “functions on blah”. That is, if $A\to C \leftarrow B$ is a cospan and $R$ is an object, then $R^A \leftarrow R^C \to R^B$ is a span. Is there some sense in which your categories of spans are obtained by dualizing a category of cospans?

Posted by: Mike Shulman on August 5, 2020 5:34 PM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

There is a dualization going on. If you look at the picture of what’s going on:

the two rocks are included in the rock-spring-rock system as ‘subsystems’. The arrows seem to be pointing the wrong way!

But this means that any state of the rock-spring-rock system maps to states of the two rocks:

In this example, we can understand the duality in the way you suggest. A point in $R= T^\ast \mathbb{R}$ describes the position and momentum of a single rock moving on a line. Then our span can be seen as

$R^1 \leftarrow R^{1+1} \rightarrow R^1$

and it comes from the cospan

$1 \to 1 + 1 \leftarrow 1$

by applying the contravariant functor $R^{-}$. Not all the spans in classical mechanics arise so simply as this, but I think this captures the basic idea.

I’m glad you called your object $R$, for ‘rock’.

We can dualize again by looking at continuous real-valued functions on the spaces of states: these are called ‘observables’ in classical mechanics, since they are things you can measure about a system. We get a span of algebras

$C(R^1) \leftarrow C(R^{1+1}) \rightarrow C(R^1)$

This says how any observable for either rock determines an observable for the rock-spring-rock system.

This second dualization is really an example of the algebra-geometry duality we’re familiar with in algebraic geometry.

Posted by: John Baez on August 5, 2020 8:15 PM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

Thanks! That helps.

I think you meant a cospan of algebras at the end?

Posted by: Mike Shulman on August 6, 2020 6:04 AM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

Yes, I meant

$C(R^1) \to C(R^{1+1}) \leftarrow C(R^1)$

Posted by: John Baez on August 6, 2020 6:13 AM | Permalink | Reply to this

For axiomatization of physical compositionality at a simpler level (but which might still serve as a foundation for more sophisticated analyses), see “Ontology: A World of Systems” by Mario Bunge.

Posted by: Mitchell Porter on August 6, 2020 10:41 AM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

Cool! This is similar to the symplectic (bi-)categories studied by Alan Weinstein, but the composition is different.

Do the two projection maps in a span always have fibres that are orthogonal with respect to the symplectic pairing?

Posted by: Francis on August 6, 2020 6:10 PM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

No, our morphisms are spans where each leg is an arbitrary Poisson surjection between symplectic manifolds (and therefore a submersion). For example, this is a perfectly fine morphism:

$\ast \leftarrow M \to \ast$

where $M$ is a symplectic manifold and $\ast$ is a point. This describes a degenerate case of an open system, namely a ‘closed’ system: one with no inputs or outputs.

I’ll have to look at Weinstein’s symplectic bicategories. I’ve talked to him about these things, but a longish time ago.

Posted by: John Baez on August 6, 2020 11:09 PM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

I think this is quite different from Weinstein’s picture, in that his correspondences are Lagrangian cycles in the product, rather than Poisson maps.

John, is it interesting to restrict to the case that the span-space is the product of the two end spaces? There’s a curious issue that although two Poisson spaces A,B give an obvious Poisson structure on AxB, that’s not the only one that maps to A,B (i.e. the category of Poisson manifolds doesn’t have categorical products).

Posted by: Allen Knutson on August 7, 2020 1:27 AM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

On the Category Theory Community Server, Morgan Rogers and I are having a nice conversation about this paper. He wrote:

It’s been a while since I did any hands-on physics, and I’m a little lazy to take a full dive into your paper, so forgive me if my question seems silly. When you say “We can equip all the symplectic manifolds in this story with Hamiltonians”, and then say it’s a big deal that you’re doing this for the feet of the spans as well as the apex, why is that? When equipping Hamiltonians, don’t you do so on the underlying category before taking spans? That is, if one is composing spans with Hamiltonians, shouldn’t the Hamiltonians of the intermediate system match up for that to make sense, and shouldn’t the Hamiltonian on the apex be constrained to be compatible with the Hamiltonians on the feet?

Another way of saying what I’m trying to ask is, why isn’t “HamSy” an exactly analogous construction to the category of spans of Poisson maps, but on a slightly richer category? I gather that taking pullbacks is not straightforward in the richer setting; is that the root of it?

I wrote:

When you say “We can equip all the symplectic manifolds in this story with Hamiltonians”, and then sat it’s a big deal that you’re doing this for the feet of the spans as well as the apex, why is that?

Just for people who didn’t read my blog article: I didn’t exactly say it was a “big deal”. It’s only “big” in a rather technical sense, namely that this prevents our theory of open classical systems from fitting into the “decorated cospan” or “structured cospan” frameworks that some of us have been working on for a while. Nobody who wasn’t closely following these technical developments would care much.

When equipping manifolds with Hamiltonians, don’t you do so on the underlying category before taking spans?

No, because we don’t want to require that the legs of the spans are morphisms “preserving” the Hamiltonians, and perhaps more importantly when we compose two spans to get the Hamiltonian on the new apex we add the Hamiltonians on the apices of the spans we’re composing (after pulling them back) and subtract the Hamiltonian on the common foot (after pulling it back).

This tricky-sounding rule says that when you glue together two physical systems by identifying a piece of one with an isomorphic piece of the other, the energy of the resulting system is the sum of the energies of the two systems you glued together, minus the energy in the piece you’ve identified. The subtraction is necessary to avoid “double-counting”.

Another way of saying what I’m trying to ask is, why isn’t “HamSy” an exactly analogous construction to the category of spans of Poisson maps, but on a slightly richer category?

I think not; I think $\mathsf{HamSy}$ is not a decorated or structured cospan category, thanks to the sneaky rule for getting the Hamiltonian of a composite system.

I should try to prove it’s not.

I gather that taking pullbacks is not straightforward in the richer setting; is that the root of it?

That’s a somewhat different issue that we also have to deal with.

He wrote:

When equipping manifolds with Hamiltonians, don’t you do so on the underlying category before taking spans?

No, because we don’t want to require that the legs of the spans are morphisms “preserving” the Hamiltonians, and perhaps more importantly when we compose two spans to get the Hamiltonian on the new apex we add the Hamiltonians on the apices of the spans we’re composing (after pulling them back) and subtract the Hamiltonian on the common foot (after pulling it back).

Aren’t there constraints on the Hamiltonians of subsystems of a common system? If not, why not, and if so, shouldn’t there be morphisms (possibly in the opposite direction to the Poisson maps) expressing this? The formula you describe does sound a lot like the formula you would get for a pushout, after all.

I wrote:

Aren’t there constraints on the Hamiltonians of subsystems of a common system?

Not sure what you mean. When we compose open systems, which are cospans with extra structure, we demand that the Hamiltonians on the feet match. But we don’t impose any relation between the Hamiltonian on the feet of a span and the Hamiltonian on its apex.

If not, why not?

Because there’s no way to determine the energy of a subsystem just from the energy of the whole system, or vice versa; in general they obey no relation whatsoever.

He wrote:

In the example of particles on ends of a spring you give in the blog post, the kinetic energy of either particle surely makes an additive contribution to the energy of the system, doesn’t it? Although the calculation for potentials seems more difficult…

As another example, if I have (a classical model of) two atoms in a molecule (such as the two hydrogens in a water molecule), their individual energies are not determined by the energy of the molecule, nor do their energies determine the energy of the entire system since there is another big piece attached, but there must surely be constraints in each direction?

I wrote:

In the example of particles on ends of a spring you give in the blog post, the kinetic energy of either particle surely makes an additive contribution to the energy of the system, doesn’t it?

Kinetic energy is additive in a certain sense. But when you’re doing Hamiltonian mechanics with general symplectic manifolds, there’s no concept of “kinetic” versus “potential” energy: energy is just an arbitrary smooth function on your symplectic manifold of states.

In this situation there’s no general relation that holds between the energy of a whole system and the energies of two randomly chosen subsystems of that system, so we specify all three.

We also have a setup for open Lagrangian systems, which is formally analogous.

In the Lagrangian approach there’s a distinction between kinetic and potential energy built in - at least at the level of generality we work at (which is not maximally general). The configuration space (= space of possible “positions”) is a Riemannian manifold. A point in the tangent bundle specifies a position and velocity. The Riemannian metric lets us compute the kinetic energy from the velocity. The potential energy is an arbitrary smooth function on the Riemannian manifold. The Lagrangian is the kinetic energy minus the potential energy.

Now our open systems are spans of Riemannian manifolds where the apex and feet are equipped with potential functions. When we compose these spans we do the same trick of adding the potentials for the apices of the two spans and subtracting off the potential for their common foot — again to prevent “double-counting”.

Posted by: John Baez on August 8, 2020 10:44 PM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

This blog was posted at the perfect time for me (or, I am seeing it at the perfect time). Let me explain:

I have been working on compositional systems theory for a bit now. I had come up with a definition of “dynamical system doctrine” and a way of turning such a doctrine into a doubly indexed category (unital lax functor from a double category into the double category of categories, functors, and profunctors, or as I later realized, double copresheaf) of “systems”. By “way” here, I mean really cartesian 2-functor.

But I knew that this wasn’t the only way to think about composable systems. There are plenty others: in particular, there are the Baez-Fong-et-al style decorated/structured cospan systems, which include things like circuits and Petri nets. And there are the Willems-style variable sharing systems. All of them should give doubly indexed categories, because a doubly indexed category just says what it means to compose systems via an interconnection pattern, and how maps of systems can change their interface.

As it turned out, one of my technical pieces in my construction of the doubly indexed category of systems from my “doctrine” — the “vertical slice construction” that takes a double functor into a doubly indexed category, indexed by its codomain — could be repurposed for each of these two other ways of composing systems!

So this is what I’ve been thinking about recently: “paradigms of composition”. My current definition is that a paradigm of composition consists of a cartesian 2-category of “doctrines”, and a cartesian 2-functor which takes a doctrine to a doubly indexed category of “systems” in that doctrine, indexed by their “interface”. (Cartesian-ness is really there so that this construction preserves pseudo-monoids and then we don’t have to check coherences by hand…) Here are a few examples:

The port-plugging paradigm is defined like this: A port-plugging doctrine is a category $\mathcal{C}$ with finite colimits (“of systems”) with a chosen object $P$ (“a port”). The object $P$ induces a finite colimit preserving functor from finite sets to $\mathcal{C}$ which sends a finite set to the coproduct of $P$. We then define the doubly indexed category of systems in a doctrine by taking the double functor $0 : \ast \to \text{coSpan}(\mathcal{C})$ which picks out the initial object, taking the vertical slice construction of this to get a doubly indexed category indexed by $\text{coSpan}(\mathcal{C})$, and then restricting this along the double functor $\text{coSpan}(\text{Fin}) \to \text{coSpan}(\mathcal{C})$ induced by $P$. Unfolding this definition, we can see that an interface in a doctrine is a finite set of ports, and a system with that interface is a system (object of $\mathcal{C}$) with some “boundary” ports pointed to by that finite set. A interaction pattern between interfaces is a cospan of finite sets, and to have systems interact along this pattern we take the pushout in $\mathcal{C}$, gluing the ports together. Maps of systems are just the maps in $\mathcal{C}$, indexed by their action on ports. So this is a version of the “structured cospan” POV on systems. We can also do this with ports of various types which can only be glued if their types match up.

Another example is the input/output paradigm I talked about at ACT2020 and at some talks at MIT. An input/output doctrine is an indexed category whose base is a category of spaces and whose fibers are categories of bundles, equipped with a section that sends every space to its “tangent bundle”. Composition is done with generalized lenses. My talks about this can be found on my web-page.

Finally, the variable sharing paradigm is constructed similarly (but not perfectly dually) to the port-plugging paradigm. A doctrine in the variable sharing paradigm is a category $\mathcal{C}$ with finite limits. The doubly indexed category of systems is the vertical slice construction of $1 : \ast \to \text{Span}(\mathcal{C})$. A system with interface $I$ for this doctrine is then a map $S \to I$ exposing some variables of the system, and composition is given by pullback along a span which tells us how to share exposed variables.

This brings me back to this blog post. I knew of a “Willems-style” doctrine in this paradigm by taking the doctrine to be the category of Schultz-Spivak behavior types. But having read some of Urs’ writing on the nLab, I expected that Hamiltonian mechanics be a doctrine in the variable sharing paradigm. But I was having some trouble understanding what that really meant.

This blog post explains it to me wonderfully! The reason I was having trouble fitting it into this variable sharing paradigm is because its a bit more complicated than just spans in a category of symplectic manifolds and maps preserving the symplectic form. I wonder if there is a nice paradigm which includes the Hamiltonian and Lagrangian systems as you describe them — composing span-like — as doctrines. Or, perhaps, an expansion of the categories in the diffeological direction which lets them be variable sharing doctrines. I’m excited to read the paper!

Posted by: David Jaz Myers on August 17, 2020 6:01 PM | Permalink | Reply to this

### Re: Open Systems in Classical Mechanics

Hey, this is great! I hope you fit our theories of open Lagrangian and Hamiltonian systems into your grand “theory of theories of open systems”, perhaps polishing them up a bit as you go.

Posted by: John Baez on August 19, 2020 2:46 AM | Permalink | Reply to this

Post a New Comment