Wolfram Computation Meets Knowledge

Q&A with Harvard Professor Oliver Knill

Last month, students in the midterm review session of Harvard’s Math 21a class received a lesson in Mathematica they would not soon forget. Professor Oliver Knill coded a 3D-animated Miley Cyrus swinging on a wrecking ball to the beat of her song (by the same name). Knill used the same principles of mathematics that his class was reviewing for the midterm—and now he just may be the coolest professor ever.

Wrecking ball

We snagged Professor Knill as soon as we found out, and we were lucky enough to have him agree to answer a few questions for us! Here, he gives us a little insight into how he uses Mathematica for both code and creativity—and generates memorable lessons for his students in the process.

Q: Hello, Oliver, thank you so much for taking this opportunity to talk with us about your experience using Mathematica as a teaching tool. Why don’t you start off by telling us a little bit about yourself and how you came to use Mathematica in the classroom?

A: In my undergraduate years at ETH Zürich, I was a course assistant for a course using the computer algebra systems Macsyma, REDUCE, and Cayley (now Magma). My mentor was Roman Maeder, then a professor at ETH and also one of the early Mathematica developers and author of several books on Mathematica. As graduate students, we had access to early versions of Mathematica, and I have been using it since for teaching and research.

Using it in the classroom was not easy at first. In 1993, at my first teaching position at Caltech, I had to carry around a heavy portable laptop and use a special device on the overhead projector to display the screen. Now, every classroom is equipped with projectors, and using technology for illustration has become routine. Mathematica is a good choice because it is easy to learn. Students with no programming background can pick it up quickly.

Q: We were very impressed by your recent (and rather edgy) use of Mathematica! What inspired you to come up with the idea, and how did you go about coding it?

A: In a language like Mathematica, one can produce illustrations quickly. For a midterm review, I wanted to demonstrate how quadrics can be used to build up objects. It’s possible to do an animation in 3–4 hours from scratch because of the way programs are built up. At every moment one has a working project.

One of the benefits of a high-level programming language like Mathematica is fast developing time. This applies in particular to animations done for educational settings. So, in order to illustrate quadrics for my multivariable calculus course, I animated part of a Miley Cyrus video with a couple of surfaces.

That “Wrecking Ball” video had received an astounding 12.3 million views in 24 hours, and of course, most of the students had seen it. By the way, the initial artistic close-up shot in the video was clearly inspired by other music videos, like Sinead O’Connor.

Back to the animation. Of course, a ray tracer like POV-Ray would have produced more realistic pictures, but it also would have taken more programming time. Development in Mathematica is fast because one can build up complex structures using simple building blocks that are easy to animate. The code below was written in a couple of hours and is pretty self-explanatory. One rule I always follow, whether using Mathematica for scientific experiments or illustrations or animations, is to always keep a running prototype. This allows me to finish a product, even if time is up. Having had no time for tears and ears initially, they are added now as hyperbolic paraboloids or ellipsoids.


Download CDF

Of course, it’s always possible to simplify and streamline code. While this costs time, it can in the long-term save time. You see for example that ArcTan[Tan[t]] implements a sawtooth function. It could have been done more elegantly with the built-in function SawtoothWave[x].

One can also see how to access graphics objects like surfaces given by ParametricPlot3D. An example is “Ear“. To access the graphics part, like for scaling, translating, or coloring, work with Ear[[1]], then at the end put everything together with Graphics3D.

Setting global options also helps to simplify code. I did not want to use any mesh features throughout the clip, so this was defaulted to be false.

Q: You seem to really know how to connect with your students. Do you have any advice for other professors and educators looking to incorporate Mathematica into their teaching plans?

A: We have a long tradition at Harvard of using Mathematica. It had been used before I came here 13 years ago. Having a culture is important, and of course also having a site license so that students and teachers can use the software. But it is also important not to overuse any technology. Every tool has its sweet spot, and finding this can be personal and depend on the setup.

With respect to the course I’m teaching, Mathematica projects have always been light and on the creative side, so that projects can be completed with moderate effort in the order of magnitude of a few hours. Still, one has to be able to dedicate time to help the class. Last year, we had our students build Mathematica objects for 3D printing. Thanks to a grant from the Elson Family Arts Initiative, we were able to print some of them.

Download this post as a Computable Document Format (CDF) file.


Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.


  1. Very neat! This makes me want to go out and teach my own awesome class.