# Visualizing Eigenvectors with GlowScript

**Posted:**April 17, 2017

**Filed under:**Motivations |

**Tags:**computation, eigenvectors, GlowScript, introductory physics, linear algebra, programming, visualization, VPython Leave a comment

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 I, Week 1

**Posted:**August 22, 2016

**Filed under:**Course Log, Goals, Motivations, Understanding |

**Tags:**concepts, critical thinking, GlowScript, introductory physics, LaTeX, teaching, VPython Leave a comment

This is the first post of a series of sixteen in which I will attempt to describe the weekly goings on in my introductory calculus-based physics course. You probably already know that I use Matter & Interactions for this course, and I have since 1999. In fact, I was the first instructor in North Carolina to adopt M&I back when it was still considered to be in “beta testing” outside of Carnegie-Mellon University, where Chabay and Sherwood were working at the time. To my knowledge, my institution was the first community college to adopt M&I, and I’m told by Sherwood that our adoption of M&I influenced NCSU‘s decision to adopt it for their intro course.

My intro calculus-based physics course meets four days per week for a total of six contact hours each week. This year, as last year, it meets M-Th 10:00-11:20. This time has proven to be very convenient…not too early and not too late in the day. This semester’s enrollment is eight students, which is down from the past two years. It is also the first all male class in approximately three years. All eight current students plan to go into some form of engineering.

As in the past, the first week was dedicated to tech setup. Students set up their WebAssign accounts, and created accounts at both GlowScript.org and Overleaf. That’s a lot of online stuff to keep track of, but we will use it all in this course. The big innovation this year is teaching LaTeX, and Overleaf is the best solution I have come across. It works online, so it requires nothing to be installed locally (which is good because I can’t update my iMacs in my classroom). It also works on tablets as well as notebooks and desktops so as far as I can tell it’s completely platform agnostic. We spent most of the first week learning the basics of LaTeX. Specifically, we saw how to use the most common math commands and constructs (exponents, subscripts, fractions, roots, inline math mode, display math mode, parentheses, trig functions, and Greek letters). The remaining time was spend demonstrating, as opposed to learning, GlowScript and VPython. We will, of course, come back to VPython and GlowScript later. I felt that LaTeX took precedent this time because my expectation is that all homework will be done in LaTeX via Overleaf and I wanted students to get used to it. I gave students a ZIP file containing everything they need to get started creating LaTeX documents with my mandi package. Note that the version my students get is usually a small increment ahead of the CTAN version. They give me feedback on new features before I push an update.

Next week, we begin with special relativity.

I welcome comments, feedback, and constructive criticism.