Member-only story

Using Python to Model a Driven RLC Circuit

Rhett Allain
8 min readJan 23, 2025

--

Photo: Rhett Allain. An RLC circuit

The RLC circuit consists of a resistor (R), and inductor (L) and a capacitor (C ). That’s where the “RLC” part comes from. It’s a fairly complicated problem to solve, but it also appears in most introductory level physics textbooks. I mean, I guess that’s fine — the solution requires some rather sophisticated use of differential equations and maybe not really meant for freshmen physics majors. But wait! This problem is perfect to solve as a numerical calculation in python. So, we are going to do exactly that.

Resistors, Inductors, Capacitors

Just a quick physics review before we get to the fun stuff. First, let’s look at the voltage loop rule. This says that if you add up the changes in voltage around a closed loop, you get zero.

With a resistor, the change in potential depends on the value of the current (I). This is often called Ohm’s Law. No problem there. Note: for now, I’m ignoring the sign of the change in potential.

What about a capacitor? I like to think of a parallel plate capacitor with positive charge Q on one side and equal and opposite charge on the other plate. The more charge you have the greater the electric field between the plates. With this, we get the following potential across the capacitor.

--

--

Rhett Allain
Rhett Allain

Written by Rhett Allain

Physics faculty, science blogger of all things geek. Technical Consultant for CBS MacGyver and MythBusters. WIRED blogger.

Responses (2)