Gas station without pumps

2016 October 16

Lagrangian mechanics for linear electronics

Filed under: Uncategorized — gasstationwithoutpumps @ 13:27
Tags: , ,

This post is a continuation of Having trouble learning Lagrangian mechanics, looking at electronic systems rather than mechanical ones.  Again, this is not intended as a tutorial but a dump of my understanding, to clarify it in my own head, and to get corrections or suggestions from my readers, many of whom are far better at physics than me.

For electronics, I’ll use charge q as my coordinate, with current $i = \dot q$ as its derivative with respect to time.  In all but the simplest circuits, there will be multiple charges or currents involved, which I’ll distinguish with subscripts.

Some notation:

  • \mathcal{L} is the difference between kinetic and potential energy of the system.  The potential energy will be the energy stored in capacitors, \frac{q^2}{2C}, and the kinetic energy the energy in the inductors, L\dot q^2/2.  (Note: that is only self-inductance.  If we have mutual inductance L_{12} between two inductors, we need to use L_{12}\dot q_1\dot q_2 /2 for the kinetic energy—I’m a bit confused by that, as we could have negative kinetic energy.  I rarely use inductors or transformers in my electronics, so I’ve not had to work out my confusion yet.)
  • \mathcal{P} is the power dissipated by the resistors in the system: R{\dot q}^2/2.
  • \mathcal{F} is the vector input to the system needed to make the energy balance work out.  By using charge for each coordinate, the units here will be volts.

With this notation, the basic formula is

\frac{d}{dt}\frac{\partial \mathcal{L}}{\partial \dot q} - \frac{\partial \mathcal{L}}{\partial q} + \frac{\partial \mathcal{P}}{\partial \dot q} = F_{q}~.

Let’s check the units:

  • Potential energy: \frac{\partial}{\partial q} \left(\frac{q^2}{2C}\right)= \frac{q}{C}, which is indeed volts.
  • Kinetic energy: \frac{d}{dt}\frac{\partial  L\dot q^2/2}{\partial \dot q} = L\ddot q, which is also volts.
  • Dissipated power:\frac{\partial R{\dot q}^2/2}{\partial \dot q} = R \dot q, which is again volts (Ohm’s Law).

Now all we need to do is to figure out which q_i or \dot q_i has to be associated with each component of the system, and what voltages the \mathcal{F}_i correspond to.  I think that will be easiest if I have some specific circuits to work with.  Let’s start with a very simple one:

Simple RLC series circuit with a voltage source.

Simple RLC series circuit with a voltage source.

We can use a single coordinate, the charge on the capacitor, q_1, so that the current flow \dot q_1 is clockwise in the schematic. We get the Lagrangian \mathcal{L} = L_1{\dot q_1}^2/2 - \frac{{q_1}^2}{2C_1}~. The power dissipation is \mathcal{P}=R_1{\dot q_1}^2/2, and taking the derivatives gives us \mathcal{F}_1 = L_1 \ddot q_1 + R_1 \dot q_1 + q_1/C, which is the voltage for the voltage source.

For electronics modeling, we often want to look at the ratio of two different voltages in a system, for example, the output of a filter relative to the input to a filter. How do we set that up? Let’s look at a very simple low-pass RC filter:

The upper schematic shows the normal way to represent the low-pass filter. The lower schematic shows it with a voltage source and a voltmeter, with two loops (one of which has no current).

The upper schematic shows the normal way to represent the low-pass filter. The lower schematic shows it with a voltage source and a voltmeter, with two loops (one of which has no current).

The potential energy is just \frac{(q_1+q_2)^2}{2C}, there is no kinetic energy (no inductors), and the dissipation is R{\dot q_1}^2/2. Taking the derivatives of the Lagrangian gives us
\mathcal{F}_1 = \frac{q_1 + q_2}{C} + R \dot q_1 and
\mathcal{F}_2 = \frac{q_1 + q_2}{C}.
In other words, we get the voltage at the voltage source and the voltage at the voltmeter. If we want to do anything with these equations, we need to recognize that the q_2 and \dot q_2 terms are 0 (modeling the voltmeter as a perfect infinite impedance), giving us the usual formulas for the input and output voltage, in terms of the charge on the capacitor: v_{in} = \frac{q_1}{C} + R \dot q_1 and v_{out} = \frac{q_1}{C}.

If we take Laplace transforms, we get V_{in} = Q_1/C + RsQ_1 and V_{out}= Q_1/C, which gives us the transfer function \frac{V_{out}}{V_{in}} = \frac{1}{RCs + 1}, as expected.  (Plug in s=j\omega to get the usual format in terms of angular frequency.)

I could do another, more complicated example, but I think that the idea is clear (to me):

  • Make a charge (and current) coordinate for each current loop in the circuit—including a dummy loop with current 0 wherever you want to measure the voltage.
  • Set up the Lagrangian by adding terms for each inductor (kinetic energy) and subtracting terms for each capacitor (potential energy), and set up the power-dissipation functions by adding terms for each resistor.
  • Take the appropriate derivatives to get the voltages.
  • If needed, eliminate charge terms by using more easily measured voltage terms.

I don’t find this process any simpler than using complex impedances and the usual Kirchhoff laws, but it isn’t much more complicated.  It may be easier to use the Lagrangian formulation than setting up the equations directly when there are mutual inductances to deal with—I’ll have to think about that some more.

Of course, the big advantage I’ve been told about for Lagrangian mechanics is in electromechanical systems, where you model the mechanical part as in Having trouble learning Lagrangian mechanics and the electronic part as in this post, with only a conservative coupling network added to combine the two. It is in setting up the coupling network that I get confused when trying to model electromechanical systems, and I’ll leave that confusion for a later post.


  1. This reveals a common physical misconception from the 19th century, which remains in electrical engineering to this day. This misconception came about due to the overgeneralized analogy to the simple harmonic oscillator. It was later fostered by the Maxwellian view of light as a propagation through a medium. The idea, fostered mostly by Stokes and Kelvin, was that just like seismic waves convey force both longitudinally and transversely, so must the aether. Thus, longitudinal gravitational waves would convey gravity and the transverse electromagnetic waves was light. This has been thoroughly debunked with Michelson experiments and Einstein’s theories.

    In short, we now know that all of the energy in an electrical circuit is potential energy.

    As an exercise, calculate the potential energy of the electrons in a typical circuit. Given their tiny mass (one 2000th of a proton) and their very slow drift velocity (about 10000th of a m/s), you will find very little kinetic energy.

    Comment by Jonathan Keohane — 2016 October 17 @ 08:20 | Reply

    • Perhaps I should put “kinetic” and “potential” energy in quotes for the electronics—they are the terms dependent on \dot q and on q respectively. It may be more of an accounting trick than anything else, but the analogy to mechanical energy holds fairly well.

      Comment by gasstationwithoutpumps — 2016 October 17 @ 08:32 | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: