# Sage Math Reference

Sage Reference Home
Python Primer
Basic Mathematics
Functions
Plotting
Linear Algebra

### Sage Resources

It is very possible that some of the information here is out of date, and it is absolutely incomplete. The following links would be much more useful: In class, we'll be using CoCalc, the online version of Sage. Resources for CoCalc can be found here:

### What is Sage?

From the sagemath.org website:
SageMath is a free open-source mathematics software system licensed under the GPL. It builds on top of many existing open-source packages: NumPy, SciPy, matplotlib, Sympy, Maxima, GAP, FLINT, R and many more. Access their combined power through a common, Python-based language or directly via interfaces or wrappers.
Put simply, Sage is among the most powerful and sophisticated mathematical software - and it's free! Not only that, but you can contribute. If there's a feature you find missing, you can write your own code to be included in the software that's available to mathematicians everywhere. Sage is built on Python, so some basic Python knowledge is helpful.

• Sage first appeared in 2005, and was developed by William Stein, a mathematician at the University of Washington.
• Sage contains a wide number of mathematics packages to accomplish just about any task. Most of these packages were written specifically for Sage, while others were included from other open source software such as GAP, Maxima, and Magma.
• New versions of Sage are released frequently, so new updates are never far behind. Releases are dated at most one month apart.
• SageMathCloud was released in 2013, and already has over 30,000 users. It can be used to run Sage/Python code, as well as code written in R, C++, Java, Perl, Ruby, among others. There is also a full LaTeX editor. Now called CoCalc.
• Files and projects created in SageMathCloud can be shared and collaborated on in real time.

### Using Sage

There are several options for using Sage:

The advantage here is that you can use your own computer's power to perform computations even if you don't have an internet connection, but you still have access to Sage's server if your machine is online. A disadvantage is that Sage is difficult to install on a Windows machine - Mac and Linux users should have no problem, so if you have a Mac or would like to experiment with Linux, I would highly recommend installing Sage locally. Again, it's free, and is fairly "lightweight" in terms of disk usage and system requirements.

If you'd like to install Sage, go to the Sage website and click Download. You'll be presented with a list of possible servers from which to download the package. Choose one closest to you (any in North America should be fine), and install as usual.

#### Sage Cells

This is a very useful, often overlooked option, though it's not meant for large projects or work that needs to be saved. Sage 'cells' can be embedded in any web page, like this one. Click the 'Evaluate' button below to find the value of $$f(x) = 3x^2-\sqrt{x}+1$$ when $$x = 4$$. Note, you may have to accept the terms of use the first time you run a cell on your machine - you will not need to keep doing this.

The cell isn't 'programmed' to only handle this simple example. Change the text in the cell to any Python or Sage code you like, and evaluate again. Try something as trivial as 1+2, or something like plot(x^3) if you'd like to see a nice picture. There are also many options for customizing the cells, if you plan to use them in your own web pages. The tutorials in these pages will make frequent use of cells.

#### CoCalc

CoCalc (formerly called Sage Cloud) is by far the easiest way to get started with Sage, and is getting better all the time. You'll need an account (free!), and you'll be able to create as many projects and files as you like. The learning curve has flattened out a bit, and CoCalc now includes lots of "helper" features like basic structure and syntax templates, examples of mathematical object definitions and methods, and more. You can use CoCalc for more than Sage too - it's also a great way to try programming in a variety of languages (including basic Python, of course) and even typesetting languages like HTML and LaTeX.

To try Sage right now, go to cocalc.com.