Visualizing Eigenvectors with GlowScript

I owe this post entirely to my mathematics colleague Ethan Smith and his recent work on visualizing eigenvectors in a plane. This work is based in turn on the paper by Schoenfeld. I’ve taken the visualization to 3D with the help of GlowScript and Trinket.

I was instantly interested in this project becuase I’m looking for ways to bring concepts from linear algebra (e.g. matrices, eigenvalues, tensors, etc.) into introductory claculus-based physics courses. I want to do this in a way that fosters the need for modern computation and visualization of geometric properties.

The concept here is very simple. You create a three dimensional distribution of unit vectors. I chose a spherically symmetric distribution. There’s really no necessity to use unit vectors as far as I can see; it just makes the numbers easier to manage. You then operate on each of these vectors with a linear transformation, represented by a matrix multiplication. The transformed vectors are visualized with arrows with their tails at the tips of the unit vectors. The transformation’s eigenvectors are immediately visible by inspection as the vectors represented by arrows collinear with the arrows representing the original unit vectors.

Unfortunately, I can’t embed trinkets in this blog, so I’ll have to make do by providing a link. When you click the link below, the trinket will open in a new browser window. You should see the GlowScript/VPython code on the left and the visualization on the right. The original unit vectors are white and the transformed vectors are blue (arbitrary color choices). You’re looking for the blue arrows that are collinear with white arrows. Those are the transformation’s eigenvectors. You can experiment with changing the number of unit vectors. More importantly, you’re encouraged to experiment with different transformation to see the effects of different eigenvalues. (I will come back later and include a screenshot here.)

Click this link to open the eigenpictures trinket.

The default matrix has eigenvalues of 1, 2, and 1 and the visualization makes spotting the eigenvectors quite simple.

I think this could have applications in introductory physics for visualizing inertia tensors. They can be represented as ellipsoids whose axes are the eigenvalues. I look forward to exploring this idea, and I thank Ethan Smith for showing me this.


Matter & Interactions II, Week 8

This week was devoted entirely to programming for chapter 17 on magnetic fields. At least two students had difficulties with lists, which was surprising they’d used them in a previous chapter. It was like they’d never seen them before. Must be something in the water.

Next week is basically a waste of time becuase thee are only two class days, and only one for which this class will meet. Monday will be a normal day but Tuesday will run as a Friday. Strange? It’s an artifact of the fantasy world I inhabit during the week.

More later.

Matter & Interactions II, Week 2

This week was yet another partial week. Between weather and holidays, we’ve not yet had a full week of classes. Such is life I guess.

This week, we looked at the electric field of a static particle and the electric field of a fixed dipole on the dipole’s axis and on the perpendicular bisector of the axis. I really with introductory textbooks would introduce the full expression, in coordinate-free form of course, for a dipole field. I think it would go along way toward reinforcing introductory understanding of vectors. We already present a particle’s field in coordinate free form, but why not a dipole’s field? No one that I know of has taken the plunge. That includes me unfortunately. Maybe someday.

We spent all of Thursday (the course meets M-Th 10:00 a.m. -11:20 a.m.) working with GlowScript, our main programming environment this semester. I demonstrated how to define a new function, sgn() in this case. I’m rather surprised that it’s not internally defined by default, but it’s trivial to add to one’s program.

There’s not much else to say about this week. It’s all about laying a good foundation for the coming chapters. That’s important, but alas not always exciting.


Matter & Interactions I, Week 6

Note that I’m writing this one week late.

This week we focused on getting used to GlowScript by doing all of the computational activities in chapter 1 of the textbook. Most everyone did fine. One student in particular is having significant difficulty because he is not a native English speaker. He tells me he wants to stay in the course though, and I certainly encouraged him to do so for as long as he feels comfortable.

Students continued to work their way through the chapter 1 WebAssign problem sets. It’s slow going though, because they, like my astronomy students, have been conditioned to do something for a teacher’s mark and not for the benefit of learning it as a foundation for future things. I wish there were a less painful way of undoing that conditioning. As usual, students are waiting till the weekends to work on the WebAssign sets and that’s generating a lot of frustration. On the other had, it also causes the to see what they don’t yet understand that in that respect, it’s meeting my goals.

Although nothing really exciting happened this week feedback, questions, and constructive criticism are welcome.