- Getting To SAGE at UMBC
- General Use of SAGE
- Other Languages in SAGE
- Combinatorics Commands
- Linear Algebra Commands
- Number Theory Commands
- Group Theory Commands

[Prev] [Intro] [Next]

SAGE is a free and open-source symbolic algebra system which allows computations in many fields of mathematics, with particular strength in algebra and number theory. Packages can be written to extend SAGE in areas where the basic language is weak. SAGE is based on the Python language, which may be used to script SAGE commands.

The simplest way to access SAGE is to get an account (currently free) on SageMathCloud.

SAGE is installed on UMBC's `gl.umbc.edu`

servers, which are
accessible across the internet. Any UMBC employee or student has access using
the account name and password they normally use for UMBC e-mail.
Details of logging into this server are here.
Once you have logged in you can run SAGE by typing the command `sage`

followed by pressing the return key. (The version of SAGE run here is
badly out of date and non-functioning as of April 2014.)

SAGE can also be downloaded from `www.sagemath.org`

and installed on any Linux or Macintosh OS/X system.

- SAGE Tutorial [
`http://www.sagemath.org/doc/tutorial/`

] - SAGE Quick Ref - William Stein & P. Jipsen [
`http://wiki.sagemath.org/quickref`

] - SAGE Constructions [
`http://www.sagemath.org/doc/constructions/`

] - SAGE Reference Manual [
`http://www.sagemath.org/doc/reference/`

]

SAGE is designed to be used in either of two ways - through a web-based notebook front end or as a command line application. The simplest installation (and the one currently used on the UMBC servers) is as a command line application, but the richer interface (graphics, etc) is through the notebook interface.

At the SAGE command prompt (which usually looks something
like `sage:`

) type the command to be run, and then press the
`Return`

key to have SAGE evaluate the command. As a simple
example, if you want to add two integers type:

`3 + 12`

Intermediate values can be saved by giving them a name and assigning
them a value with the "`=`

" operator. If the following two
commands are run the second output will be 1:

`thesum = 3 + 12`

thesum - 14

SAGE is very careful about exact values. Exact values are things like
symbols and integers. Thus `pi`

and `sin(3)`

are exact
values and when you evaluate `sin(3)`

you get `sin(3)`

back as an answer. Contrast this with the fact that `3.0`

is an
approximate (floating point) value and thus `sin(3.0)`

evaluates
to the approximate value 0.14122. The `n()`

and `float()`

operators will force a numerical evaluation.

sage: sin(3) sin(3) sage: sin(3.0) 0.141120008059867 sage: float(sin(3)) 0.141120008059867

When you are done with SAGE, either type the command `quit`

or `exit`

or type ^D (type the letter D while holding down the
control key).

There are several ways to find help in SAGE. You can search by
the specific Mathematica command (if you know it). The basic help
request is

.*cmd*?

This only works if *cmd* is a correctly spelled and capitalized
SAGE command.

If you are uncertain about the name of a SAGE command there are at least
two ways to find it. Typing the first few letters of the command and then
`Tab`

will list possible completions. The wildcard *, representing
any string of characters, can be used together with the question mark to get
a list of matching commands.

sage: power_mod? The n-th power of a modulo the integer m. sage: FiniteFi*? FiniteField FiniteFieldElement FiniteFields

A selection of documents are available on the SAGE web site
`www.sagemath.org`

:

When working with SAGE on the web-based notebook interface you can edit a command using the usual mouse, click and type method. If you are using the command line interface for SAGE you can use the left and right arrow keys to move within a line, the up and down arrow keys to recall earlier commands and a number of simple Emacs commands.

The results of the previous command can be referred to as `_`

,
(an underline), two commands ago as `__`

and three commands ago
as `___`

Much of the heavy computation done by SAGE is actually done by other domain specific languages which are distributed and installed together with SAGE. Examples include:

- GAP - Group Theory [
`http://www.gap-system.org/`

] - Maxima - Symbolic manipulation, polynomials, integration, ODEs [
`http://maxima.sourceforge.net/`

] - PARI/GP - Number theory [
`http://pari.math.u-bordeaux.fr/`

] - Singular - Algebraic geometry [
`http://www.singular.uni-kl.de/`

]

In addition to letting SAGE make calls to these languages they can be
called directly from within SAGE or started and run independently.
The SAGE interface to some of these languages is documented at
[`http://www.sagemath.org/doc/reference/interfaces.html`

]
and a simple tutorial is found at
[`http://www.sagemath.org/doc/tutorial/interfaces.html`

].

[Prev] [Intro] [Next]

Robert Campbell 10 March, 2009