An Introduction to the Sage Project

William Stein


Very Brief History of Sage

 

What is Sage?

 

Tour of the http://sagemath.org website

 

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| /// }}}