Thursday, October 29, 2026

Plotting the power dissipated in a charging RC circuit

This semester I'm teaching the recitation session for the second-year physics course on electricity and magnetism, which is basically an hour a week dedicated to helping students go over the concepts they encountered that week and help work through problems (sort of like a group tutoring session). I also taught it last semester, and we've caught up to an unresolved question I had from the same point in the curriculum.

We've been covering RC circuits, which are simple DC circuits with a resistor (the R) and a capacitor (the C) in line with a driving voltage (a battery, for simplicity). They're wired in such a way that you can move a switch to charge them, and then switch it to discharge; while charging, the charge on the capacitor fills up until its potential difference reaches that of the battery (at which point no more current can flow), and while discharging that charge flows away, dissipating as heat through the resistor. Both follow an exponential curve, which can be adjusted by changing the resistance and capacitance of the system (their product RC has units of seconds, and is known as the time constant of the system, how long it takes for the charge to rise or fall ~63% of the remaining way towards being full or empty).

Anyway, while the textbook we're using had some plots of the charge and current in RC circuits charging and discharging, it also mentioned what the power in the circuit was mathematically (the product of two competing exponential terms) but didn't provide a diagram. I've wanted to plot it myself to see what it looks like since last spring. I could do it using Python and matplotlib, I just never got around to it.

Enter Typst! I've been writing up the problems we cover in the recitation session in Typst so that students have a record they can go back to, and as mentioned in an earlier post it can include diagrams and plots. I started coding up the equations for charge, current, and voltage as a function of time to make some plots to serve as a reminder, and realized I could also encode the equation for the power dissipated in the circuit while charging, which comes out to be

\[P(t) = \left(\frac{V^2}{R}\right)(e^{-t/RC})(1 - e^{-t/RC}).\]

Here's what I included; the third plot shows how the above equation looks.

Anyway, I just wanted to share my discovery. Typst continues to impress me with its ease of use and accessibility. I gave a short introductory talk about it to some of my classes this week, since they're doing a lot of writing of lab reports and it could be useful. Being introduced to \(\LaTeX\) in college was an important milestone in my life and I think learning Typst has the potential to be as revolutionary for them if they're continuing on in STEM fields (or even if they aren't, since Typst can be used for any kind of writing). One of my colleagues even asked me this week if I could do a short presentation on it for his class so they could use it for their (math-heavy) homework. I think it's safe to say I've found my latest obsession at this point, so we'll see where it goes from here. A hui hou!

Sunday, October 18, 2026

A new computer! (Sort of)

I was thinking recently that it's been about a year since I moved, only to find when I checked today that it has, in fact, been exactly one year.

It's also been about a month at this point and I haven't mentioned it yet due to being busy, but I'm writing this on a new computer. Well…sort of. A friend of mine recently upgraded his computer out of need (and when it became clear the RAM pricing crisis isn't ending anytime soon), and had a spare motherboard, CPU, and 48 GB of RAM from 2020 which he donated to me. It's DDR4 RAM, which is a generation behind the current standard, but also a generation ahead of the 24 GB of DDR3 RAM I had before. I was just beginning to bump into some constraints with that much RAM, so doubling it has been nice.

It's also an AMD motherboard and CPU (Ryzen 7 5800), in place of my old Intel i5-4690K. I've been intending to switch from Intel to AMD for several years now if I ever had the chance, so this worked out well. While Intel definitely had the advantage in processors for some years, AMD has been steadily closing the gap more recently, especially in areas that mattered to me: AMD processors tend to have more cores and do better at crunching through parallelizable tasks like encoding video. (Both are plenty fast enough for the games I play.) I did do one test where I rendered a short video on my old CPU and the new one, but the photo I took of the time on the old CPU was blurry so I can't say exactly how much faster the new one is (though it is definitely faster; in single-core performance it's rated 4.8 GHz compared to 3.5 GHz for my old CPU).

Near the end of September I took my computer apart and performed the delicate motherboard replacement surgery. It passed mostly without incident, other than needing to make sure various pieces were actually wedged in their sockets good and tight. A CPU cooling fan came along with everything, and since I had no idea if my 2014 watercooling pump would fit in a 2020 motherboard I opted for the fan. One of the four little plastic stand-offs holding the brace for it was missing, so I measured it, went down to my workshop, and cut a new one out of a bit of old dowel with a few minutes' work.

The newly-made part…

…installed and keeping those braces off the motherboard.

As far as I can tell it's doing fine. Not that my computer ever ran particularly loud, but I haven't noticed any big differences in noise – if anything, the new fan might be quieter.

Overall it's been good. I haven't noticed any mind-blowing differences, but things generally do feel a bit snappier. I'll need to get back to video-making or otherwise find some way to stress-test it and see how it performs. We'll see what happens! It's a busy semester for me. A hui hou!