More Student Copy Editing

The flip side of student copy editing is that sometimes the response time by an open source author can be very rapid.

A couple weeks ago Hayden Harper asked a question in class about Exercise 21 from Chapter 19 of Tom Judson‘s Abstract Algebra: Theory and Applications. His confusion about the problem boiled down to the smallest element of a Boolean algebra being mistakenly typeset as the numeral zero “0” rather than an upper case letter “O.”

8:13 AM PDT I suggested Hayden send me an email about it. Yes, in class. Yes, now. Finally he could tell I was serious and used his phone to send me the details.


9:37 AM PDT Back in my office after class, I forwarded Hayden’s message to Judson.

11:04 AM PDT The git commit shows Tom made the change official less than 90 minutes later.

Noon PDT Back to my office after my second class, and I got an acknowledgment from Tom, “Fixed!,” which I forwarded to Hayden.

Try that with your commercial text!

Pennies a Day for SageMathCloud

7.4 cents per day to be exact.  That is what the new student course plan for SageMathCloud costs a student at $9 total for four months of members-only hosting, with network access, 1 GB of RAM and 3 GB of disk storage.  As an instructor you get all the advantages of assigning, collecting, marking, and returning assignments with the well-designed course interface.

This is an update of my detailed explanation of how to set up, and use, SageMathCloud to run a course that features computation.  If you have not read that, it would be the best place to start.  A few things have changed, and I have a few new comments, but the vast majority of that post is still applicable.    Skip below to the “Course Plan” section if you are just curious about how the $9 plan works from an instructor’s view.

The course functionality went very smoothly last term.  No one lost any work and generally everything came in on time.  Grading was very easy procedurally, and there is not much I could think of to make grading much more streamlined.  (But then, I have small classes and no TA’s to supervise.)

Abstract Algebra

My upper-division course in abstract algebra continues with regular Sage worksheet assignments from Judson’s open source textbook.  Last semester, I pushed out blank Sage worksheets for them to use for their submitted work, which had boilerplate instructions about the %html magic and exhortations for them to explain their work.  Two students decided they liked to submit Jupyter notebooks instead, which was fine with me.  They named them things like “GradeMe.ipynb”.  The point is, you can have students just make a new worksheet in the folder you push out and have them name it clearly (and with the default sort order by time, it is usually the last thing they have touched so at the top of the file list in their collected folder).

If you grade Jupyter notebooks, you’ll want to know Esc-A and Esc-B for new cell above or below, Esc-M for making a new cell into Markdown format, and then put some HTML for color and size of a div element onto your clipboard manager for quick pasting.

Last semester I strongly advised these students to purchase the $7/month Standard Plan for 3 or 4 months.  So they have done their part as early supporters of SMC.  I support SMC with a $49/month Premium Plan, which has more firepower than I need, though I am slowly becoming addicted to the upgrades.  With 16 members-only project upgrades, and as owner of the student’s course projects, and with a slightly smaller returning group, I was able to give each student a members-only upgrade for the semester (which I will claw back in May).

This is one of the things I really like about the upgrades and quotas – you can distribute them temporarily to collaborators: students, TA’s, research students, and colleagues anywhere.

Linear Algebra

My linear algebra students are mostly new to me.  They will be learning lots of Sage, they will be using a very limited subset of Sage during exams via the Sage Cell Server on their laptops, and they have fourteen proofs to write, and re-write, in LaTeX until they are rock solid.

I have about twenty Sage worksheets I use as demonstrations in class.  The first one was about constructing matrices and getting back reduced row-echelon form, which was a tool they could use on their first exam (two days ago), though they had to row-reduce one simple matrix “by-hand.”  The second one illustrated the dichotomy of linear systems with nonsingular versus singular coefficient matrices.  I put these in a single folder which I push out as an assignment.  Better, as suggested by SMC founder William Stein, is to use a separate folder for each worksheet.  That’ll minimize the chance that an update will overwrite student work.  This has not been a problem yet with my students, as they seem to understand that they need to make copies if they want to experiment.

Feedback from my students years ago suggests they don’t like to see you just step through a canned worksheet.  So I manufacture some things carefully in advance (like singular matrices) and create other things randomly (either at the keboard, or with Billy Wonderley’s random matrix commands in Sage).  I enter many of the commands I need live in class, so they can see me interacting with the system, and I can respond to their suggestions and questions.  So I make an “-inclass” version in advance, do my work there and save it at the end of class.  So the students get a virgin version of the worksheet that is incomplete, and a transcript of the class session.

For their proof-writing, the LaTeX editing and compilation is excellent, and I’ve used this as the rationale for required them to sign up for the course plan.  I spent about 10 minutes each of the first four class days, building up a demo/scratch LaTeX document with most of the basic features I thought they would need.  So I pushed out in their assignment a progression: DayOne.tex, DayTwo.tex, DayThree.tex, DayFour.tex.  Be sure to teach them about “commenting out” lines to locate compilation problems.

Before their first proofs were due, I had them make a test document, where the only requirement was that it had some math.  Of course, they were very creative with such loose guidelines.  I wanted them to get the result out as a PDF, saved locally, and emailed to me.  They submit their proofs on paper, since I have an elaborate system for the rewrites which I have failed at organizing electronically once already.  I’ve had trouble in the past with students who could not download and print a PDF before the first due date, so I get that out of the way with this mock exercise.

I had thought to hold “LaTeX Office Hours” the evening before their first LaTeX’ed proofs were due.  Timing was wrong, but I could conceivably have been at home after dinner, and as owner of their projects I could pop in and edit their LaTeX in SMC over the network, while they watched and let them also edit simultaneously.  Turned out fine, all their LaTeX looked quite good and only one student had a real question.

Course Plan

Make a course (see my previous post for details).  One update: if you know your student’s email addresses in advance, you can set up all their projects in advance by adding them with a single comma-separated list of addresses.  So as I suggested before, require your students to use their canonical school address when they make an account, and strongly suggest they use some variant of their real name, since that is what you will see.  If you add a student late by name, you will not see their email address in your list, so you may want to routinely use email as the identifier.

Now in your course “Settings”, find the first box, “Require students to upgrade (students pay)”.  Then set a date by which they must pay.  Be sure to customize the email invitation (off to the right) – I missed it the first time.  Done.  It is that easy.

I set the end of the trial period to be our “Last Day to Drop Without Record” day, which is about two weeks in to the semester.  60% have paid already.  I believe it is very clear in the student view how much time is left, and I’ll give them one in-class reminder tomorrow.

The setup is really flexible.  David Roe asked on the sage-cloud list:   What happens for students who don’t pay the $9?  Will they still be able to access their projects with a free “membership”?

William Stein replied:  No.  However:

  1. They could of course copy the files out to another project.
  2. They do get full access again (for free) when the course is over.
  3. You can set a start time at any point in the future (the default is one week).
  4. As the instructor, you can change the start time or remove the students-must-pay restriction instantly at any time with a click.  This takes effect immediately.

Maybe your school does not allow you to require extra fees of students.  There is an option for “Upgrade all student projects (you pay)”, which did not exist when I set up my Abstract Algebra course, so I do not yet have any experience with it, but it should be straightforward.

Jupyter Notebooks, XBox Controllers and Mathematics

At Sage Days 70, Sylvain Corlay showed some Jupyter notebooks using an XBox gamepad controller as an input device.  I couldn’t resist.

First hurdle: a wireless controller (my son’s) with an add-on USB cable is not the same thing as a “wired controller.”  So I ordered a new one.  Work says they’ll reimburse me (“instructional supplies”).

Three lines of code, plug your controller into a USB port and you’re good to go. 4 variable inputs from the two joysticks, two more variable inputs (the triggers are on 6 and 7, untested) and 13 binary buttons (10, 11 seem unused).  I think this is mostly code in your browser, Firefox or Chrome (I did this all in Chrome).  Perhaps see gamepad.js for more.
Second hurdle: Sylvain has public code showing how to connect a regular iPython slider to react to the controller, but there is some subtle issue so the iPython interact does not behave as you would like.  So finally, I figured out to (a) read the controller input values (easy), (b) display text in Text() widgets (not hard), (c) create a matplotlib PNG image as a byte string and display it in an Image() widget (StackOverflow to the rescue), (d) specify a routine to react to any change in the controller’s state (understand Sylvain’s example code).

Third hurdle: every time I changed the plot update routine, I had to restart the kernel or my changes were not evident.  I’m sure there is a better way.

As a demonstration, I created a sine curve, parameterized by amplitude, frequency, horizontal shift and vertical shift.  So the two joysticks (“four axes”) control all the parameters.  With 500 points for each curve, the display updates smoothly, though seems to lag just a bit.  The equation of the current plot is specified as LaTeX and rendered with MathJax in the notebook.
sine-four-param-demoThe notebook is here:
(which you will want to download with “Save Link As…” or similar)

I had to justify missing two days of class to travel to Sage Days, so when I got home I told my classes I’d get a demo together.  I asked a student in each of my classes to control a version of the notebook, before I did anything and with no explanation of which joystick controlled which property.  It was fun to see them experiment in front of the class to see how it behaved.

All the math here is just the sine function from numpy.  I’m really looking forward to using the Jupyter server in SageMathCloud, and having all the mathematics and plotting code from Sage available to control via the ipywidgets Controller() object. (I did this with Jupyter notebook server 4.0.6 installed locally, while SageMathCloud is at 4.0.4.)

THANKS to Sylvain for several patient emails while I got this sorted.

Grading in SageMathCloud

(There is an update to this post, which you should read after this one.)

I’ve been assigning Sage assignments for several years in my (standard) undergraduate abstract algebra course. (They are all available now in Judson’s open source text.)  Mid-term last Spring I switched over to using the new “course” functionality in SageMathCloud (SMC).  William Stein and several of his colleagues and students have greatly improved SMC over the summer and courses work really well now.

Today I graded my class’ second assignment.  (The first was just procedural so we made sure their accounts were all in place and we knew the workflow.)  It was the least painless grading session I’ve ever had.  Very smooth and efficient.  “Low friction,” in today’s parlance.  So here is a guide on getting started and how it all works (and why I like it so much).


Have your students signup for a free account.  But most important – have them use their real name and have them use their principal university email address with a canonical domain name (e.g.  You’ll search for them later via the email address, and the names they enter themselves will show up in score reports, etc.

I have an entire SMC project I creatively call “Courses.”  I pay the $7 monthly fee to be on a members-only server without all the free accounts around competing for resources.  It has lots of top-level subdirectories organized by semesters.  Make a new SMC “course” file inside of a new top-level directory in your project’s file system.  Mine is named 2015-Fall/Math433.course.  Open your new course and add a title and description via the “Settings” tab (wrench icon, not gear).  Then find a search box for “adding” new students under the student tab and off to the right.  (Do not confuse this with the box for “finding” — this is local to your course and you do not have any students yet to find.)  It is easy for me to get a comma-delimited list of my students from our administrative systems (this is about the only easy thing to do there).  Manufacture such a list and dump it all at once into the add box.  Real names will come up for all the students who have followed your signup instructions and you can add them to your course (select several, or all).  You’ll then get a very easy-to-manage list of students under the students tab.

Your students will also each then get a new project automatically in their project list.  It has your course name and their real name in the title.  You are the owner of the project, and they are a junior partner, a “collaborator.”  This gives you a lot of power to help them remotely and to look at their work in-progress (for each student on your list there is a button that you can use to open their project).  Snapshots of student projects can sometimes be very helpful (as the student cannot change them since they are not the owner).


I made another top-level directory for my current abstract algebra course to contain assignments and demos the student will see, with a name the students will recognize as their course (e.g. Math433F15).  Making this at the top-level will make a better experience for the students, see below.

For each new assignment, make a subdirectory for just that assignment (eg Chapter02).  You can put lots of things in this folder that will all go to all of the students.  But be sure to put in a mostly empty Sage worksheet.  For example I called mine 02-Math433-turnin.sagews.

In this worksheet I put a header (using HTML with an “h2” tag) with the course name, chapter, etc.  Then I put in some basic instructions, based on my experience doing these kinds of assignments with Sage Notebooks.  Here it is, modulo wrestling with WordPress:

Work the exercises for the chapter in this file. It will be collected automatically after the 6 AM deadline on the day it is due.

  • Work the problems in order.
  • Clearly label which part of your work is for which problem (or subproblem).

When a question asks for an explanation, provide a well-written response. That means complete sentences, correct grammar and spelling, and you address the question that was asked. In SageMathCloud you can format your writing nicely. Follow the directions below and while editing you will get some buttons above your worksheet to help with formatting, or you can just type in the formatting codes yourself with some help from the editor (which you can configure in your user settings). Notice that you can use \(\mathrm{\LaTeX}\) syntax to get nice typesetting of any mathemtics you want to use.

  • Use %html on the first line of cell all by itself to have a cell interpret HTML formatting.
  • Run the cell to see what it looks like. Double-click in the cell to go back to editing.
  • Similarly, %md will allow you to write in Markdown syntax.
  • For $\mathrm{\LaTeX}$, use single dollar signs, or use \( and \), which is preferable.
  • For displayed mathematics (centered on a line of its own) you can use double dollar-signs or \[ and \], which is preferable.

Now, back in your course file, hit the “Assignments” tab.  Use the search box in the top right to select the folder with your “-turnin” file and other materials.  Once you choose this folder, set the “Due Date.”  Then you will be able to use the “Assign to…” button to push a copy of the folder out to all your students.  (Using a top-level directory in your project means the students get a short path to their assignments in their projects.)

Students will see a copy of the folder in their project for the course.  It will have an additional small text file, DUE_DATE.txt, that contains the due date you set.  Instruct your students to do their Sage assignment in the “-turnin” worksheet and to NOT change the filename or move it.


You need to manually collect the assignment, but it is a one-click operation with the “Collect from…” button.  Do it.  Now you get a “Grade” button for each student in your list.  This will give you a file list that is a copy of the folder at the time you collected it, and a text file with the student’s name as the filename, so you don’t lose track of whose work you are looking at.  You can open the “-turnin” worksheet, or any other file.

I make comments on the student’s worksheet, and sometimes copy their code and show them an edited version that I might think is helpful.  I do comments in HTML, you could use Markdown.  I have a template in my clipboard buffer, so comments are clearly visible (red and big). It begins with the line %html and is followed on the next line by a div element with the attribute style="color:red; font-size:141%".  I paste and then fill the div with my comments.

Done with a student’s work, back in your course file, you can enter the grade, which is any string you please – a number, a letter grade, or a short comment.  Under the “Settings” tab of your course, you can get all your grades in CSV format (to import into a spreadsheet), or in a file of Python data structures.  Be sure to “Return” the graded version of the assignment to the students.  They will get a new folder with the graded versions.


This may be TL;DR but the one-time setup is pretty easy, making an assignment goes quickly and grading is very streamlined.  Everything is where you need it and you have good tools at your disposal at each step.  And your students just need to make an account and do their work.  Zero setup and no technical hurdles.  I’m sure the course functionality will change rapidly (for the better), so if you are finding this months later, look around for updates.

I strongly encourage students to sign up for memberships (at $7/month) because I tell them that overloaded free servers are not an excuse for not completing the assignment.  But I think it is also important for them to recognize that this service has value and should be supported (and their textbook is free!).  Remind them to go to their project’s settings (wrench icon), click on “Adjust Project Quotas” and then use the “Member hosting” checkbox.  When they stop paying, their project will go back to being on the free servers, so they never lose their work or the ability to interact with it.

I know William is working on other models for class accounts, so be in touch with him through the “help” email address if your university wants to support all the students in a course with one payment.

Recognize that this environment supports many different types of technical courses.  Besides Sage, there is R, Jupyter notebooks, full Ubuntu Linux terminals with a complete file system, and a wide variety of installed Python packages for science and engineering.  And don’t forget there is a robust LaTeX installation, with semi-live preview and reverse search for compilation errors, which is great for students new to writing mathematical documents.  Sage worksheets use CodeMirror for editing, with goodies like syntax highlighting and tag completion, so it is also a good environment for programming, and other similar work.


SMC is also great for working with your students.  I’ve got some experiments lined up and will report again soon.

African Institute of Mathematical Sciences, 2012

I am at the African Institute of Mathematical Sciences this January, in Muizenberg, South Africa (near Capetown).  I am teaching a 3-week course on Algebraic Graph Theory.  I thought I might use this vehicle for some regular travel news, but now my trip is half-done and this is the first post.

Nothing too extraordinary to report.  Course is going well.  It has been good to be back and renew old acquaintances (staff and alumni), as well as meet and work with the new students.  I’ve been on two hikes so far, an afternoon trip up nearby 500-meter Muizenberg Peak, and the other an epic day-long walk across a wide swath of Table Mountain National Park.

Some photos follow – let me know if you’d like to see more.

Combinatorial Potlatch 2011

The 2011 edition of the Combinatorial Potlatch was yesterday at Seattle University, which I organized along with Nancy Neudauer.  David Neel handled all of the local arrangements.

William Stein gave an overview of Sage, with some combinatorial tidbits.  There were the usual “oohs” and “aahs” when he generated a random matrix and then produced its LaTeX code in one extra step.  Josh Laison gave a very nice talk on obstacle numbers of graphs with great visuals and an on-the-fly clicker change in mid-talk.  Peter Winkler wrapped up with more great visuals (cartoons, almost!) for an entertaining talk about a cop pursuing a drunk on a graph.

It was nice to see some new faces, such as Shannon Overbay over from Spokane, and some regulars from farther afield, such as John Gimbel down from Alaska.

I never have any graduate students to supervise, but many of my students go on to a graduate degree.  Sometimes they even get their PhD in combinatorics. And both were present for the Potlatch.  David Neel took the UPS combinatorics course the first time it was offered and studied under Bogart at Dartmouth, while Jane Butterfield did a summer research project with me and is finishing up her thesis in graph theory at the University of Illinois.  Photo below, and more from the conference are here.

Neel, Beezer, Butterfield

David Neel, Rob Beezer, Jane Butterfield, Seattle, Nov 19, 2011