More than just a coding project

I don’t remember what triggered my interest in harmonographs, but a few months ago, I started to build one – not a physical one, which would be fun too, but an online simulation. I had just decided to learn JavaScript, and this seemed a good project to provide the necessary motivation.

http://andygiger.com/science/harmonograph/harmonograph-frame.html

I got a lot more than that out of the project, though. I did learn a whole lot of JavaScript and how to make it work on a web page using HTML events (what?) and the HTML5 canvas element (err…). And it was a great refresher of my HTML skills in general. But more significantly, it made me revisit my highschool physics and mathematics, which was interesting.

First of all, in my initial and brief research into harmonographs I learnt quite a bit about the history of drawing machines and the many different kinds of harmonographs and related devices. But I soon decided that, for my online simulation, I would stick to the three-pendulum rotary harmonograph that had inspired me in the first place.

The key elements of a harmonograph are the pendulums that make the pen and paper move so harmoniously. So, to write my simulation, I needed to figure out how pendulums move. I hadn’t thought about damped harmonic oscillators (huh?) for a long time, so it took me quite a while to get to grips with the pendulum formula again.

Once I had the pendulums figured out, I had to grapple with the geometry of the arms that connect two of the pendulums to the pen. I found a solution from someone who had used a lot of Pythagoras for that, but I preferred to work it out myself with trigonometry instead. That took some effort, but was also very satisfying once I got it right.

So, in the end, what started as a simple coding project turned out to be a (re)learning experience in physics and mathematics as well as programming. And, maybe because I hadn’t really foreseen that, it was all very enjoyable and rewarding. You can play around with the final product here.

If you are keen to embark on a coding project (with likely side benefits) yourself but don’t quite know how, why not come down to the Science Centre this Friday, for the “Code for Fun, Code for All” event? You will get to try different aspects of coding, including scratch programming, computer sensing and hardware control, and sorting things with algorithms. (more info)

 

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s