Lab 1: Introduction to Sage

Please read all of the instructions before getting started.

Goal

The goal of this lab is to introduce you to Sage, which is a free open-source mathematics software system licensed under the GPL whose goal is to provide a viable alternative to (the very expensive!) Mathematica, Maple, Magma, and Matlab.

What is Sage?

The following is taken from http://www.sagemath.org/tour.html:

Sage is built out of nearly 100 open-source packages and features a unified interface. Sage can be used to study elementary and advanced, pure and applied mathematics. This includes a huge range of mathematics, including basic algebra, calculus, elementary to very advanced number theory, cryptography, numerical computation, commutative algebra, group theory, combinatorics, graph theory, exact linear algebra and much more. It combines various software packages and seamlessly integrates their functionality into a common experience. It is well-suited for education and research. The user interface is a notebook in a web browser or the command line. Using the notebook, Sage connects either locally to your own Sage installation or to a Sage server on the network. Inside the Sage notebook you can create embedded graphics, beautifully typeset mathematical expressions, add and delete input, and share your work across the network.

Why use Sage?

Sage is free!

  • Downloading free
  • Installing free
  • Copying free
  • Bug fixes free
  • Future versions free
  • Support is free

Sage is open-source!

  • No hidden algorithms (if you are so inclined you can “lift the hood and look inside”)
  • Can study implementation
  • Can correct, improve, contribute to Sage

Instructions

This lab should be completed in groups of 2-3.

First, each member of your group will need to sign up for a free Sage Notebook account. To do this, go to http://prep.sagenb.org (Sage recommends that you use Firefox). I suggest you keep this page open as a different tab in your browser so that you can refer back to the instructions if necessary. If you already have a username and password, sign in now. If you do not have a Sage account yet, select "Sign up for a new Sage Notebook account" (located on the right half of your screen) and follow the on-screen instructions.

Once you are logged into the Sage Notebook server, you will be in your "Home" directory, which should be empty if you just created your account. I have published a worksheet called "Introduction to Sage (Calculus)." There are two ways to access this file, but for this lab, only one member of your group needs to follow these instructions for accessing the file.

  1. The first way is the fastest, but can be confusing to use if you are not already logged into the Sage server. Click on this link: http://prep.sagenb.org/home/pub/64/. The file you are looking at is a static copy of the worksheet that I published, but I want you to play with this worksheet and be able to edit it. To do this, click on "Edit a copy" in the upper left hand corner. (If you were not logged in, you would have to select "Log in to edit a copy".)
  2. The second way to access this file is by browsing the worksheets that are published on the Sage server. To do this you need to click on "Published", which is located in the Sage menu bar in the top right corner of the page (assuming you are in your "Home" directory). You will see an entire list of published worksheets. If you see the one you want, you can just click on it. Alternatively, you can search for it by title or restrict to all the files published containing a keyword or username. Again, you will have to click on "Edit a copy".

Before you actually do anything with this worksheet, I want you to share it with me and the other members of your group. Click "Save & Quit" in the upper right hand corner. This will return you to your "Home" directory. Now, click on "Share now" in the middle column for your newly created worksheet. Type in the Sage usernames of the members of your group (separated by commas). My Sage username is dcernst.

Note: If you typed in an incorrect username, you will not get a warning.

Your task is to read along while clicking "evaluate" (or clicking "shift+enter") on each of the Sage cells. As you read, you should try to figure out what is going on. In some future labs you will be required to mimic what you see here, so really pay attention to what works and what doesn't. Feel free to edit the content of the cells and add new cells to experiment.

Getting Help

If you need help, you can always contact me, or even better, post a question in the course forum. In addition, there are some useful links on the Sage help page.

Due Date

This lab is due by 5PM on Friday, September 17.