Light, Mirrors, and Lenses

Oh, my!

Optics can feel like a topic without a home. The two pillars of physics are mechanics and electromagnetism. If you had to pick one, optics fits with electromagnetism—but that’s mainly because it certainly doesn’t fit into mechanics. Optics is too specific to fit neatly in either category. It’s too general and historically important to be dropped from the curriculum.

Nevertheless, optics has a few things going for it—including nice visuals. Drawing ray diagrams for mirrors and lenses is straightforward and fun, and interacting with them is even better. That’s what I’m keeping in mind while I build these.


Parabolic Mirror
Light from infinitely far away gets focused by a parabolic mirror. See that in action with this quick graphing interactive.

View here, with access to the code here.

Reflection From Adjustable Mirrors
We go from an adjustable parabolic mirror to a mirror that can have any of a variety of functional shapes. You can really get a sense of why spherical mirrors are close enough to ideal for most purposes: Near the base, they really do focus almost as well as parabolic mirrors do. Also, I’m well aware that these graphs are oddly offset from the sliders. Believe me, I’m aware.

View here, with access to the code here.

Prettier and Improved Reflection from Adjustable Mirrors
Similar to the one above, but with two major differences. First, it’s prettier. (See that little laser pointer with the light coming out of it? That’s the sort of quality content you can expect from this blog.) Second, the mirrors are even more adjustable. They can be flipped upside down! The reflections aren’t quite as precise as I would want (it thinks a surface is perpendicular well before I’d say it is), but so it goes. Also the hemispherical mirror can’t be flipped upside-down in this program – I’ll admit, I got excited about my next idea and so I left a couple things mostly but not entirely finished here.

View here, with access to the code here.

Many Rays, Many Mirrors
The idea that I got excited about. Choose the shape of your mirror (it’s even more adjustable than the last program) and choose the number of parallel rays coming down to hit it. This one really gives you a sense of the ray diagram that would be drawn for each given shape. It still has the precision problem, which becomes particularly frustrating for me with the hemispherical mirror. But, again, so it goes. This is another one where the version on the computer works better than the one on Trinket.

View here, with access to the code here.

Mirrored Room
You have a light source surrounded by four walls. Bounce away! (The program only knows how to go from the bottom wall to one of the sides to the top to the other side and back to the bottom, cycling through that up to ten times. I couldn’t be bothered to make it more general than that. It seemed hard.)

View here, with access to the code here.

Lenses to come! They’re harder to code than mirrors, but they’re in the works.

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 )

Facebook photo

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

Connecting to %s