Brendan’s Adventures in Python

It would be a lie to say I’ve never done much programming, and I don’t like lying.

I learned bits and pieces of HTML in high school to customize my profile page (RIP Sodahead), and I learned some more in college to create a finding aid for one of my library jobs. I also dragged my feet and struggled to learn the fairly basic Mathematica required for physics classes.

But my main programming experience came from research. I used MATLAB to analyze data and create figures like this beauty:

Fun fact about me: I love this figure so much that my master’s thesis is dedicated to it.

More seriously—and more relevantly for this post—I found backdoor ways of making MATLAB do animations and displaying something like a movie, which it was most certainly not built to do.

Long story short: There’s a thing moving through fluid. We watched it with four high-speed cameras, built the object in a computer, and matched the one we built with the one on the cameras.

But that only went so far, and then I graduated and set it aside. In the last few years, if I needed an animation, I used PowerPoint.

Then, about two or three years ago, inspired in part by creators like 3Blue1Brown and the frequency with which Matt Parker says “Python” (that list of links took far too long to compile), I tried downloading Python to see what I could do with it. That experience was frustrating and unproductive to say the least.

Nothing made any sense and I firmly didn’t understand what I was doing. I could get some of the most basic things to work, but nothing more advanced—certainly not enough to do anything interesting. I also made the mistake, understandable at the time, of trying to learn from the ground up. So I started by learning how to make lists and move numbers around, which was dull enough that it made all the frustrations even more frustrating. I think I got as far as changing filenames before everything constantly breaking became intolerable. I gave up, set it aside, and went back to PowerPoint.

But then, at the beginning of this month, Rhett Allain posted this video on Reddit. I’ve always looked up to Rhett’s articles in Wired, and seeing him use Python so effectively in that video was the kick I needed to try it again. The tab with that video remained open for a couple days while I tried and tried again and tried a third time and tried some more to install something that should be far easier than it is, but eventually everything was working as desired. The trick, I learned, is that when you see an error, just keep uninstalling the things that throw the error until there’s nothing left to uninstall. Then try again, rinse, and repeat. (Note: This does not constitute actual advice. Although it did, in a sense, work for me.)

I set about following Rhett’s guide and it, delightfully, worked. After that, I was off to the races. Everything was (mostly) beautiful and nothing (some things) hurt. I added another mass on a spring below his and learned how to make sliders to adjust the initial positions of both masses, then went back and made a bunch of other simulations and toys to expand my horizons as I went.

It’s been going well so far and I’m having a lot of fun, but now I have the problem where I have a lot of good projects on my computer and the only one looking at them is me. I wanted to change that and share what I’ve been working on. To that end, I’ve added an Educational Resources page to this site with links to all the projects that I’ve put onto Trinket. They’re all available to use by educators and anyone else seeking to develop some physical intuition.

I’ll keep updating that page as I make more, and I’m open to new ideas to add to my growing list. I hope people find them useful. They certainly are fun to make.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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