
An Introduction to the Sage Project
William Stein
Very Brief History of Sage
- 2005 -- I started the Sage project to provide an open source alternative to Magma for number theory research.
- 2007 -- Sage won the Trophees du Libre; this spun into lots of publicity and newspaper articles all over the world.
- Hundreds of other people subsequently got involved in Sage's development, and the scope of the project has widened to cover all mathematical computation. There is interest from all areas of mathematics, physics, engineering, etc. (Developer mailing list has 1171 subscribers and about 50 messages/day... and sage-support has 1703 subscribers.)
- Mission Statement: Create a viable free open source alternative to Magma, Maple, Mathematica, and Matlab.
What is Sage?
- Sage = Python + Math
- A unified self-contained distribution of open source free mathematical software.
- Nearly a half million lines of new Python (and Cython) 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.
And now a short demo...
Sage can do basic arithmetic with exact fractions:
{{{id=1|
2 + 2
///
4
}}}
{{{id=16|
2^3
///
8
}}}
{{{id=17|
7/8 + 2/3
///
37/24
}}}
Very big numbers: In less than a second, Sage exactly computes $(10^6)!$, which has over 5 million digits.
{{{id=12|
time n = factorial(10^6)
///
Time: CPU 0.67 s, Wall: 0.70 s
}}}
{{{id=14|
n.ndigits()
///
5565709
}}}
{{{id=6|
factor(2010)
///
2 * 3 * 5 * 67
}}}
{{{id=20|
time m = n * n
///
Time: CPU 0.29 s, Wall: 0.29 s
}}}
Sage does Calculus:
{{{id=8|
f(x) = sin(x)^2*cos(x)*exp(x)
show(f)
///
\newcommand{\Bold}[1]{\mathbf{#1}}x \ {\mapsto}\ e^{x} \sin\left(x\right)^{2} \cos\left(x\right)
}}}
{{{id=9|
plot(f, 0, 2)
///
}}}
{{{id=5|
show(integrate(f, x))
///
\newcommand{\Bold}[1]{\mathbf{#1}}x \ {\mapsto}\ -\frac{3}{40} \, e^{x} \sin\left(3 \, x\right) + \frac{1}{8} \, e^{x} \sin\left(x\right) - \frac{1}{40} \, e^{x} \cos\left(3 \, x\right) + \frac{1}{8} \, e^{x} \cos\left(x\right)
}}}
Sage can do graph theory:
{{{id=24|
graph_editor(graphs.FlowerSnark())
///
}}}
Sage can draw 3d plots:
{{{id=10|
var('x,y')
b = 2.2
(plot3d(sin(x^2-y^2),(x,-b,b),(y,-b,b), opacity=.9) +
plot3d(0, (x,-b,b), (y,-b,b), color='red'))
///
}}}
Sage can plot Yoda:
{{{id=4|
from scipy import io
x = io.loadmat(DATA + 'yodapose.mat', struct_as_record=True)
from sage.plot.plot3d.index_face_set import IndexFaceSet
V = x['V']; F3 = x['F3']-1; F4 = x['F4']-1
Y = (IndexFaceSet(F3, V, color = Color('#00aa00')) +
IndexFaceSet(F4, V, color = Color('#00aa00')))
Y = Y.rotateX(-1)
Y.show(aspect_ratio = [1,1,1], frame = False, figsize = 4)
///
}}}
{{{id=3|
///
}}}
Sage also does numerical linear algebra, numerical optimization, statististic (R is in Sage), exact linear algebra, number theory, cryptography, group theory, combinatorics, and anything anybody has ever written in Python.
{{{id=25|
///
}}}