[top] [TitleIndex] [WordIndex]

# Math 480b: Programming for the Working Mathematician

## Course Description

We’re going to try to give you a view of the parts of the computer science world that we think are the most important for mathematics. We’ll be using the programming language Python, and the math software system Sage. Our goal is for you to all leave this course with the feeling that you now know much more about how to use a computer to help you attack mathematical problems, and enough “programming culture” to know what tools and techniques are available to make that easier.

Of course, this is a Herculean task. Computer science is its own discipline for a good reason – there’s a whole world of amazing and interesting things to learn, and there’s no way we could cover it all in a quarter. This means that we won’t be able to give you all the details of anything we’re doing; instead, we’ll have to settle for giving you the highlights, providing references if you want to know more, and trying to give you the chance to “get your feet wet” and learn about it all firsthand.

## Course Info

The syllabus is here.

## Schedule and Lectures

• Introductory stuff: introduce ourselves, talk about course structure, etc. Introduce Python as a calculator, mention that they should go home and try to get Python installed. Tell everyone to go home and read their first Python program (collatz.py).

• Walk through our first Python program, introducing basic syntax and language constructs. Ask students to guess at how it works. Talk through the program line-by-line, and at least hint at what each piece is for.
• Continue deconstructing our first Python program, and discuss peer grading system.
• A quick crash course in the basics of using a UNIX-like command line. Introduce the notion of hierarchical filesystems.
• Introduce the Sage Notebook, and then make sure everyone's successfully installed Python.
• First HW is due -- talk about what we expect from the students in terms of how they should grade one another. After that, try to write a simple function (factorial) in several ways, each based on a different "natural" definition of factorial.
• 4/12 Python Basics, I

• Start introducing the basics of programming in Python. Talk about lists and strings, explain how to find out more about the methods available on each. Added after the fact: we also talked about list comprehensions, map/filter, and import.

• Continue touring basics of Python. We followed our nose through several other parts of Python, including files, more on strings, and print. Mention how much is available in the Python standard library, and use some of the parts of the os module. Start talking about line endings.

• Putting together bits and pieces of what we've done in the previous two classes, write a simple program to convert files back and forth from DOS to UNIX line endings. Talk about types and isinstance. Make sure to mention os.path.isdir, os.walk, and shutil.copy. Introduce reduce.

• Start off with ~5 minutes about the project. Introduce Sage, and give a brief overview of the architecture of Sage. Ondrej Certik is in town, so save 15 minutes at the end for Ondrej to provide a quick introduction to Sympy.

• Take a few more minutes to describe the notebook in more detail. Talk about @interact, and give several examples showing how easy it is to use, introducing Python decorators in the process.

• Talk a bit about classes in general, highlighting several basic facts everyone should know about object-oriented programming. Introduce the __ methods in Python, and explain how to use them to customize the behavior of your classes.

• 4/26 Digging In, I

• Start talking about Python in more depth. Talk about doctesting, dictionaries, and use the Python standard library to do something interesting with, e.g., web scraping.
• 4/28 Digging In, II

• More on Python: exceptions and exception handling, differences between Python 2 and Python 3. Odds and ends.
• 4/30 Sage Datatypes

• Introduce some of the more interesting datatypes provided by Sage, such as matrices, graphs, and types for arbitrary-precision arithmetic.
• 5/3 TBD

• 5/7 Cython

• 5/10 TBD

• 5/12 TBD

• 5/17 Matrices

• 5/19 Solving linear systems: Worksheet at 480.sagenb.org and Worksheet at tutorial.sagenb.org

• 5/21 Numpy

• 5/28 Contributing to Sage, part 2
• 5/31 MEMORIAL DAY (no class)
• 6/2 Student Presentations
• 6/4 Student Presentations
• 6/7 This is unlikely to be necessary: Student Presentations (final exam slot)

## Handouts

Your grade will be determined by 50% project and 50% homework. Specific project details are coming soon.

## Assignments

Assignments should be submitted by email to whoever your assigned grader is for that assignment. (If it's less than two days before the HW is due, and you haven't yet received your grader assignment, e-mail Craig and remind him to send those out.) You can also cc [email protected] if you'd like to have a backup, in the event that your grader doesn't receive your assignment.

Graded assignments should be submitted by email to [email protected].

If you're looking for a good link to install something, you might find one here. If you find a useful link somewhere, let us know and we'll post it.

• Emacs:
• On Linux, you should use your distribution's package manager, or try here.

• On Mac OSX, there are a number of choices, but this is my favorite.

• On Windows, this is one choice, though there may be better ones. This page seems to have a lot of google juice, so maybe that's a good sign?

• VIM: I'd start here. Someone forwarded along this interesting visual tutorial, originally from here.