# I’m looking for feedback on my computational physics course

**Posted:**June 28, 2012

**Filed under:**Uncategorized 11 Comments

## Overview

This will be my first course in which I use some flavour of standards-based grading. This will also be the first time I have taught a computational physics course (or more accurately a computational thinking for physicists course). I do have some experience helping students develop some computational thinking skills from my Advanced Lab course, but I have never taught a full course dedicated to this topic. Fun!

The idea is that I will be getting them to work in Python and Mathematica in parallel. My main purpose behind this is to help the students see the platform-agnostic computational thinking which underlies their their computational tasks. A side benefit is that I can help Python and Mathematica put aside their differences and work toward a common goal.

This course will be based around a weekly cycle of

- Basic tasks, to be completed in both the Mathematica and Python computing environments; and
- Intermediate and advanced tasks, to be completed using either of the computing environments.

## The grading part of SBG

Students will earn marks for each of the content standards and their final grade will come from points earned by demonstrating appropriate mastery of these standards. I will give the students example tasks that correlate to the standards, but the students will always have the option of performing any computational task that they wish that shows appropriate mastery of the standards.

Approximately 2/3rds of the way through the course, the students will start working on a project which models a complex physical system. I have two standards associated with this project (a physics one and a communication one) and I am planning to either weight these standards more heavily than the others or make them into a set of more fine-grained standards. I really haven’t decided on this.

## Assessing an individual standard

I plan to assess each standard on a 0-4 scale. I’m not in love with my use of the term “completed” below when discussing tasks, but the idea is that the most important thing to me is that their programs do exactly what they are meant to do.

I think that I will be allowing students to partner up which means that I need a mechanism to assess the individual beyond just a working (and properly commented) program. I think that the individual assessment will be for them to orally run me through their properly working program. Students will be given the option of submitting screencasts to do this, but not all students will have access to a computer that has both a mic and Mathematica so I will need to keep the in-person explanations as a method.

Here’s a rough outline of how I plan to assess an individual standard, where each

- 4 – Exceeds expectations (student must make the case that they have exceeded expectations or have successfully completed an advanced task)
- 3 – Meets expectations (student has completed the relevant intermediate tasks or otherwise demonstrated intermediate-level mastery in either environment)
- 2 – Approaches expectations (student has completed the relevant basic tasks or otherwise demonstrated basic-level mastery in both environments)
- 1 – Doesn’t meet expectations (student has completed the relevant basic task or otherwise demonstrated basic-level mastery in one of the environments)
- 0 – Not yet assessed

- Environment is the general term to describe either Mathematica or Python.
- Program is the general term to describe a Python program/script or a Mathematica notebook.
- To get a 3 or 4 you need to have shown proficiency at the 2 level (basic) for both environments. If basic proficiency is only shown for one environment, the score on that standard is reduced by 1.
- To be eligible for reassessments, a 1 must be earned on a given standard within the first two weeks of the standard being opened.
- Right now the connections to physics are not built in, but that is in the long-term goals for the course.

## Very loose weekly plans

We will spend roughly one week on each of the following broad themes.

- Introduction to the environment (functions, variable types)
- Iteration basics and animation (introductory modeling: similar to the early Matter and Interactions VPython stuff)
- File input/output, basics array manipulation and case structures
- Advanced list/array operations and manipulation
- Data visualization and plotting (histograms, scatter-plots, bar charts, error bars, etc)
- Data analysis (basic statistical analyses, fitting)
- Solving complex algebraic equations, integration and differentiation
- Solving differential equations

After the students have started working on their projects we will spend less than half of our class time working on non-project topics.

- Introduction to the physics modeling project
- Monte Carlo methods
- Numerical methods
- Linear algebra
- FFTs

## The standards

These standards are based on a collection of computational physics learning goals that were put together by Andy Rundquist, Danny Caballero and Phil Wagner. I then went around to all the faculty in my own department and asked them what skills they would like to see the students develop as part of this course and folded the common ones in.

There are some standards marked as “[ungraded]”. The idea with these is that they are things which do not seem to be worth assessing for one reason or another, but are things that I still want to highlight for the students as being important.

Onto the standards…

- Environment fundamentals
- [ungraded] I can use online and built-in help resources

- Computer algebra fundamentals
- I can represent and perform common operations with complex numbers and vectors.
- I can use built-in integration and differentiation functions. This includes using assumptions for integration.
- I can access mathematical and physical constants or define these constants globally when not available.
- I can solve algebraic equations. This includes simplifying algebraic results and using a root finder. I can use graphical or other techniques to set appropriate neighborhoods for the root finder.

- Programming fundamentals
- [ungraded] I can assign and clear variables.
- I can write and use robust functions. The important characteristics of a robust function are (1) that they need no access to parameters outside of those which they were passed; (2) they are written such that they can easily be copied into any script or notebook and be used as intended; and (3) they can return information in the form of single parameters, vectors, arrays or other useful objects.
- I can use at least two different iteration methods to accomplish the same task.
- I can use case structures.

- Arrays and lists
- I can manipulate and slice arrays/lists. Slicing an array means to pick out columns or rows from larger arrays. Manipulation of an array includes transposing the array, replacing elements, and adding columns/rows to existing arrays
- [The wording needs work on this one] I can operate on entire arrays/lists instead of having to operate on the individual elements of the array/list.

- Numerical techniques
- I can write my own code (not call existing functions) to perform numerical integration with varying levels of precision (Trapezoidal rule, Simpson rule)

- Solving differential equations
- I can solve ODEs (1st Order, 2nd Order and Coupled) analytically. I can determine if an analytic solution exists.
- I can solve ODEs numerically. I can set initial conditions and the domain of the solution.
- I can solve a Partial Differential Equation and specify the boundary conditions appropriately.

- Data manipulation, input and output
- I can import data from a text file which has a standard format (e.g., comma-separated or tab-separated values).
- I can export data to a text file which has a standard format.
- I can filter and sort data.

- Plotting data, quantities and functions
- I can plot 1D and 2D continuous functions and discrete data. This includes being able to superimpose multiple plots on the same canvas (e.g., visual comparisons between data and models).
- I can use graphical solutions to solve problems, such as simultaneous equations problems.
- I can modify the important parameters needed to make a graph “nice”. This includes setting axis limits, adding axis labels, changing line or point styles, making semi-log and log-log plots, plotting error bars.
- I can create and interpret 2D, 3D, and density/image/false-colour plots.
- I can create vector-field plots.
- I can plot solutions to ODEs and PDEs.

- Data Analysis
- I can compute the average, standard deviation, median, etc., of a data set.
- I can fit a model (function) to data using weighted and unweighted chi-square minimization. I can extract the best fit parameters and their errors. I can use reduced chi-square and the scatter of the residuals to evaluate the “goodness of fit”.
- I can perform a Fast Fourier Transform (FFT). This includes being able to account for the Nyquist frequency, normalization of the FFT, converting a FFT into a power spectrum or spectral density and performing an inverse FFT.

- Monte-Carlo methods
- I can use Monte-Carlo methods to model systems which involve random processes.
- I can use Monte-Carlo methods to perform error propagation.
- I can use Monte-Carlo methods to perform integration

- Animation
- I can animate a physical system.

- Linear algebra
- I can perform typical matrix operations such as addition, multiplication, transposition, etc.
- I can find eigenvalues and eigenvectors.
- I can perform matrix decomposition and reduction

- Mathematica-specific standards
- [ungraded] The “/.” command.
- I can use the Manipulate command.
- I can use patterns as part of recursion and case.

- Documentation (Portfolio-based: the student must choose and submit their three best examples for each documentation standard)
- I can document the use of a function. This is specific to only the details of what goes in and out of the function, not the nuts and bolts of what the function does.
- I can use sectioning and big-picture documentation to communicate the overall use of a program as well highlighting and describing the purpose of the major sections of the program.
- I can use documentation to clearly explain how a complex chunk of code (such as a function) works.

- Project [these are to be expanded into multiple or more heavily weighted standards]
- I can model a complicated physical system.
- I can write an effective project report using LaTeX.

Some issues with the above standards

- Some of the linear algebra stuff overlaps with some of the computer algebra stuff (vectors and matrices).
- I would like the standards to be similar in scope to each other, but they are nowhere near that right now.

## The feedback I am looking for

I would love to hear any and all feedback you might have, either in the comments below, or you can comment on a google-docs version of this post that I made publicly commentable. Some specific things I have in mind are…

**What are the most important or least important standards on the list?** If you have any opinions on which ones seem less essential or which ones seem absolutely essential, I would love to hear about it.

**How can I improve my proposed assessment of the standards?** Do you have any suggestions for alternate ways of assessing the standards at the individual level for work done by a group in this context?

## Not this round

I have a very heavy teaching load in the fall (3 new-to-me upper-division courses) so I am trying to figure out appropriately sized chunks of ambition for each. I have lots of ideas for each course, but there is no way that I am going to find the time to do a decent job of everything I have in mind. With that in mind, you will notice that there is no emphasis on sense-making or interpretation in the standards or in the way the standards are assessed. I think Danny Caballero and colleagues are doing some fantastic work with this at CU, and I really want to fold these thing into the course in the future, but for this round these are going to have to be things that I bring up repeatedly in class, but don’t explicitly build into the course. Baby steps Ives. Baby steps.

Hi Joss,

Using both Python and Mathematica is either genius or a disaster waiting to happen. For this course, I am guessing to is more the former.

How many students do you expect to be enrolled?

Bret

Pessimist, here: I think it might be the latter. Given the list of standards, quite a few of them are going to be much easier in Mathematica than python. Python’s biggest advantage is cost, but that’s clearly not an issue for these students. Take ODE’s. To do it in python, depending on the package, you likely have to convert the equation into multiple single derivative versions, declare your time steps, etc. In MMA, it’s one command. Now, don’t get me wrong, I think they learn a lot doing it the python way. However, if they see how MMA lets them cut corners, they might jump at it. One approach to help that is to have some standards be such that they’re much easier to demonstrate with python. I think the numeric integration standard (with the various rules you’d like them to try) is a good example of that.

Gents.

The class is currently sitting at 13 and probably won’t increase by more than a few by the time the fall term actually starts.

Andy makes some really good points. Honestly I am expecting that most students will use MMA to tackle the more challeging stuff, but that’s AOK by me. We will work through the basic tasks using both environments so that can see that you can accomplish the task in either, but as Andy points out, it will often be much easier in one than the other. Most students will then take the easier choice to tackle the intermediate and above tasks. I will be delighted if I come out the other end of this course feeling that I helped them learn a meta-goal of picking the most appropriate tool for the task.

Also, there are zero expectations that we have to make it through all the standards (which is why I am looking for feedback on where to trim the fat and what must be kept at all costs). The students with whom I have spoken have told me that they would prefer to take a cut in the course’s coverage in exchange for getting to learn to do things in both environments in parallel.

I am excited to come out the other side of this course and get the student feedback that helps me decide if I should continue on with this model or scrap it and stick with one environment.

One thing I like about having students work in two different environments is that with just one environment it would be easy for them to start thinking, “oh, this class is just about Mathematica (or Python).” But really, the class is about computational *thinking*, and the thinking part is independent of whatever programming language you’re using. I would assume (or at least hope) that using two environments at once will help students focus more on the big picture ideas of what the code is trying to do and why, instead of focusing exclusively on the smaller details of how the specific language accomplishes those tasks.

The number one thing I would think might be bad about using two languages is that students have twice as many opportunities to mess up the syntax/get lost in the details/get frustrated with unsuccessful debugging, which, if they get stuck in that for too long will probably detract from their learning. But I would think that you could make basic tasks that are sufficiently simple such that students won’t have too many problems implementing them, and then this won’t really be an issue. So my guess is that using two languages will be worth it.

Hi Becca,

Your comments mirror my thinking on why using the two different environments is potentially worth it, and what the major possible issue would be. Before I had committed to doing it this way I discussed the idea with a handful of my students and they all thought that it would be great to learn to work in the two environments in parallel, so I already have some student buy-in which should help moderate some of the smaller roadbumps.

I think your list of topics leans very heavily toward Mathematica. You also don’t mention what Python packages you will be using. numpy? scipy? matplotlib? … Your choice of packages makes a huge difference here.

You might want to do some problems that are somewhat hard to model analytically, but straightforward numerically (like rigid pendulums that swing more than ±90°).

I found simulating a water rocket to be quite challenging (see http://gasstationwithoutpumps.wordpress.com/2012/06/04/soda-bottle-rocket-simulation-take-2/

)

I completely agree with you that the topics lean heavily toward Mathematica. For the most part they are doable in python, but easier in Mathematica (as Andy points out). As I mentioned, I put them together in consultation with a number of people in the context of “what computational abilities should your typical physics major have?” So they weren’t intended to be more Mathematica-friendly, it just happens that Mathematica is already a great platform for doing the things that my colleagues consider to be important general scientific computation skills.

I really like the idea of straightforward numerically, but hard to model analytically. I don’t have a lot examples under my belt, so your suggestion is very much appreciated.

Look through the computational exercises at the end of each chapter of Matter and Interactions. They are often problems that are straight-forward numerically but challenging analytically.

I don’t understand the argument that the numeric problems are easier in python compared with mma. Sure, you probably learn more doing it in python, but I’ve found even numeric problems to be much easier to do in Mathematica.

Mathematica is expensive, Python is free. I think that you do students a major disservice if you only teach the expensive tools. I’ve no idea how easy or difficult numeric computations are in Mathematica, because I’ve never been willing to pay the license fee for it.

The numeric computations are very easy in Python, so I don’t see how they could be much easier in Mathematica, though.

Right, we’ve already covered the cost issues in lots of these conversations about python and Mathematica. I’m trying to help Joss do a great thing: teach them both without them just running to the easier one (since the school is paying the cost for them anyways). My point about the numeric approach is that it’s not a clear winner for python. Realizing what you’re doing at all stages, though, is likely easier in python, and that’s why I think Joss’s standards about coding various methods by hand is a really good idea. I’ve had students do that as well, in Mathematica, but I don’t do a good job of having them learn enough from that as I think I think I move too quickly into the packaged routines (most notably: NDSolve).