MAA 2010 Sage Tutorial

4461 days ago by comphy

 

MAA 2010 Sage Tutorial

Seattle University

Rob Beezer, Mike Hansen, and William Stein

 


 

PLAN

  1. Quick introduction to Sage
  2. Everybody successfully signs up for a Sage notebook account on http://tutorial.sagenb.org and does a few simple calculations with Sage.
  3. Some Basics of using Sage and the Sage Notebook.
  4. Tour of the http://sagemath.org website: google search, try sage online button, online documentation, library, download, devel map 
  5. Workshop participants come up with some sample questions (e.g., compute the determinant of a matrix, plot a certain function, etc.), and Rob, Mike, and William explain how to solve them, leading everyone step-by-step through the solution.
  6. Tutorial: Linear Algebra 
  7. Tutorial: Plotting
  8. Tutorial: Symbolic Expressions
  9. Tutorial: Discrete Mathematics 
  10. Tutorial: Statistics
 
       

1. Quick Introduction to Sage

History

  • I started the Sage project in 2005 to provide an open source alternative to Magma for number theory research
  • About 200 other people subsequently got involved, and the scope of the project has widened to cover all of mathematical computation. There is interest from all areas of mathematics, physics, engineering, etc.  (Devel mailing list has 1171 subscribers.)
  • Mission Statement: Create a viable free open source alternative to Magma, Maple, Mathematica, and Matlab.

What is Sage?

  • A unified self-contained distribution of open source mathematical software.
  • Nearly a half million lines of new code that implements new capabilities and algorithms.
  • A "cloud" application like GMail or Google Docs: http://sagenb.org  (currently about 30,000 users);  Sage also runs in the same way on your desktop.
  • Sage addresses all areas of math, and like mathematics, Sage is huge, deep, and extremely sophisticated, which can be daunting.
 
       

2. Try Sage Now!

  1. Use Firefox or the Safari web browser to visit the webpage http://tutorial.sagenb.org
  2. Click on "Sign up for a new Sage Notebook account" on the right side of the screen.
  3. Fill out the form.
  4. Go back to http://tutorial.sagenb.org and login (if you see "Please enable cookies or delete all Sage cookies and localhost cookies in your browser and try again." then clear the cookie cache in your browser by going to Safari->Preferences->Security->Show Cookies, then enter "sage" and click "Remove All"). 
  5. Once you log in, click "New Worksheet".
  6. Enter a title for the new worksheet: "Test"
  7. In the first input box (below the File, Action, Data, and Sage menus), enter "2 + 2" then press either Shift+Enter or click the evaluate link

WARNING: Java is probably mis-configured on Firefox in this computer lab, so some 3d graphics won't work if you use Firefox.  Overall though, Firefox is by far the best browser for using Sage.

 
       

3. Some Basics of Sage and the Sage Notebook

  1. Type Shift + Enter to evaluate a cell.   An input cell can have multiple lines of input.
  2. Insert a new compute cell between two existing cells by clicking on the blue line that appears.
  3. Insert a new text cell by shift clicking.  You can put math (like $x^3 - \alpha x + \sqrt{2}$) by just putting it in dollar signs, as in LaTeX.
  4. If foo is a function, enter foo? to get help.
  5. If obj is an object, type obj.<tab key> to find out what you can do with obj.
  6. When you type into Sage, you're (basically) writing in the (mainstream object-oriented) programming language Python.
factorial? 
       
factorial
factorial
 
       
 
       

4. Tour of the http://sagemath.org website: google search, try sage online button, online documentation, library, download, devel map

 
       
 
       

5. Workshop participants come up with some sample questions...

2+3 
       
5
5