Thursday, April 2, 2015

Teaching students Mathematica

Abstract: Mathematica has amazing capabilities, and my students have started to harness its power to investigate and create mathematics.

This Spring 2015 semester I am teaching MATH 213: Math with Mathematica. I last taught this course in Fall 2009, and this was the last time it was taught at Queens College. Back then I had less experience with Mathematica and I tried to base the class around a course packet written by the previous instructors. Moreover, it was my third semester at Queens College, so I was still learning the ability level of the students. By the end of that semester I was a bit disappointed by the amount of material that we had covered, I was discouraged by the performance on the assessments, and I realized that I did not find the course packet as motivating as I had hoped. On the other hand, I was happy that the students had gained some ability with Mathematica and I enjoyed the diversity of projects that my students had created. With these thoughts in mind, I revised the syllabus at the beginning of this semester. In this post, I'll talk about the program Mathematica, the course setup, and the beginning of this semester.

Mathematica is a computer program that one can use to do simple and very complex mathematical calculations, to write and run complex computer programs, and to generate mathematical structures algorithmically. There are a number of different competitors to Mathematica, including Maple, MATLAB, and SageMath. SageMath is open source and would be my second choice, especially since a number of researchers in my field use and contribute to it. There are three important reasons why I choose Mathematica to teach to my students and for my own research. (I switched from Maple around 2007.) First, the syntax of the commands is very natural to a mathematician. When you want to plot the graph of a function where x ranges from 0 to 10, then you type Plot[f[x],{x,0,10}]. Second, the documentation that accompanies the program in its Documentation Center is excellent. Not only does it provide the syntax and the options that are allowed for each built-in command, there are scores of examples highlighting each of the capabilities of the command along with some "Neat examples" to see what is possible with advanced techniques. The Documentation Center also gives suggested related commands which makes it easy to explore all the things that Mathematica can do. (It's the same principle behind getting lost in Wikipedia.)

The last capability that takes the cake and keeps me from switching away is Mathematica's amazing visualization capability. Not only is it easy to generate and analyze data, it is possible to easily visualize large amounts of data instantly and dynamically, and export it in a flash. Do you want a histogram? a scatterplot? 3D charts? Mixed with its mathematical backbone, this allows for some great visualization of mathematical objects, not to mention visualization of the amazing amount of curated information that is available for direct import from the Wolfram servers --- including up-to-date and historic financial, geographic, demographic, scientific, etc. data. (If you've ever played with Wolfram Alpha, you have some idea of the scope.) I especially love the Manipulate command, which introduces sliders allowing for an easy and instantaneous change of one or multiple parameters, such as size of 3D objects, or time-frame of demographic data, or list of chemical compounds, etc. I have created a number of animated gifs using Mathematica that you can see on my webpage and in this gallery. (One of them has received over 35,000 views on Google+)

Now about my MATH 213 class. My goal at the beginning of the semester is to hook the students on Mathematica and give them the basic building blocks that they'll need as they progress through the semester. I have found that these classes have a wide range of ability levels, and as such work best when the course is run using tutorials. I put in a large amount of time creating a tutorial for each class focusing on multiple related topics. The students follow along in class; when they run into issues they can either talk to their neighbors or I am able to provide assistance. The quality and self-sufficiency of the tutorials is important so that I can address the concerns of the fifteen students in the class and I am not spread too thin. (This is a lesson I learned the hard way when I first tried to teach Maple to Mathematical Modeling students as a post-doc in 2006.) Throughout the tutorials are sets of Comprehension Questions where the students work to master the presented concepts by creating or modifying Mathematica code. One issue that I have run into is that a number of students often do not come to class because the class is early (8:45am at a commuter school) and the tutorials are available online. (Perhaps they do not need or think they need assistance?) To make the classes more relevant and instructive, I have started requesting that students post a question about recent tutorials to the discussion board; I start class each day responding to these questions, which leads on some interesting tangents into the intricacies of Mathematica.

The class assessments include three major projects and in-class quizzes that happen after every few tutorials. The first two quizzes were only on paper and were 20-30 minutes each. The first quiz focused on the creation and modification of lists (the key data structure in Mathematica) while the second quiz focused on the creation and application of functions and patterns. The most recent quiz (on the creation and manipulation of 2D and 3D primitives) ended up needing one hour and allowed the use of computers to generate specific 2D and 3D graphics and debug non-working code. I am happy with these quizzes (even if I am less than happy about the students' grades) because they are testing if the students have internalized Mathematica's syntax and understand how certain commands work. For instance, I will ask students to write a paragraph explaining how a certain command works (syntax, inputs, outputs), and to understand what a written command will output.

The projects are the most important part of this class. I feel that students learn best when they are motivated by an end goal that is student-driven and faculty-guided. On campus we have a faculty group devoted to Experiential Learning; these projects fit into that framework. For their first project this semester, students were asked to create their own Mathematica tutorial that helps students with coursework from another class. Full project details are here. Behind this project is the idea that students will be able to use basic knowledge of Mathematica to understand a topic from another math class that they found difficult. Not only will they get more practice in this complex topic, but they are also learning how to use Mathematica to solve their own problems. Moreover, they must work to convey their understanding in complete sentences, which is an important step in the learning process. Ideally we would upload and publish these tutorials to a centralized server and make them available to current students in those classes, but maybe that will be one of the requirements in a future iteration of the class.

For this and future projects, I give the students a detailed timeline and set of expectations that the students had to follow. I find it very important to give detailed specifications because I give the students complete freedom in choosing their topic. Once they determine the subject, I help them refine the scope of the project so that it is feasible to be done in the given time frame and is neither too difficult or too simple. I ask the students to prepare and present a five-minute presentation of their projects to the class, and gather feedback from their classmates for them to revise their projects one more time before submission for grading. A few of the projects from students this semester included understanding conservative vector fields from Multivariable Calculus), solving differential equations, and understanding the cycloid curve. I enjoyed the many comments from students about how amazed they are about the capabilities of Mathematica, and how they now use it in their other classes.

I will stop writing here and devote the next blog post to discussing the second project which involves creating and printing 3D mathematical art. Write you next time!

This is the first blog post that I am writing as part of the Queens College Teaching Circle blog; it is cross-posted on my personal teaching blog, Math Razzle.