
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  (c)  William Stein
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{beamer}
\usepackage{beamerthemesplit}
\usepackage{graphicx}
\newcommand{\page}[1]{\frame{#1}}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{graphicx} 
\usepackage{pstricks} 
\usepackage{color}
\definecolor{dbluecolor}{rgb}{0,0,0.6}
\definecolor{dredcolor}{rgb}{.5,0.0,0.0}
\definecolor{dgreencolor}{rgb}{0,0.4,0}
\definecolor{blue}{rgb}{.02, .02, .908}
\newcommand{\dred}{\color{dredcolor}\bf}
\newcommand{\dblue}{\color{dbluecolor}\bf}
\newcommand{\dgreen}{\color{dgreencolor}\bf}
%\newcommand{\dred}{\bf}
%\newcommand{\dblue}{\bf}
%\newcommand{\dgreen}{\bf}

\usepackage{xspace}  % to allow for text macros that don't eat space 
\newcommand{\SAGE}{{\color{blue}\sf SAGE}\xspace}
\newcommand{\sage}{\SAGE}

\newcommand{\graph}[1]{\includegraphics[width=0.45\textwidth]{#1}}

\title{SAGE: Software for Algebra and Geometry Experimentation}
\author{William Stein}
\date{February 26, 2006\vspace{4ex}\\\includegraphics[width=1.5in]{icon-5}}
\bibliographystyle{amsalpha}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\defn}[1]{{\em #1}}
% ---- SHA ----
\DeclareFontEncoding{OT2}{}{} % to enable usage of cyrillic fonts
  \newcommand{\textcyr}[1]{%
    {\fontencoding{OT2}\fontfamily{wncyr}\fontseries{m}\fontshape{n}%
     \selectfont #1}}
\newcommand{\Sha}{{\mbox{\textcyr{Sh}}}}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\Vis}{Vis}
\DeclareMathOperator{\HH}{H}
\DeclareMathOperator{\Ker}{Ker}
\DeclareMathOperator{\ord}{ord}
\renewcommand{\H}{\HH}
\newcommand{\hra}{\hookrightarrow}
\newcommand{\isom}{\cong}
\newcommand{\ds}{\displaystyle}
\renewcommand{\t}[1]{\begin{center}{\large{\dblue #1}}\end{center}}


\begin{document}

\page{
\maketitle
}

\begin{frame}
\t{Reminders!!}
\begin{enumerate}
\item Turn on my iRiver recorder.
\vfill
\item Thank the organizers!  Lauter and Klassen.
\vfill
\item I'm originally from the Northwest (Oregon), and
I'm moving here next month.
\end{enumerate}
\end{frame}

\begin{frame}[fragile]
\vfill
\t{The \sage Mailing List on Thursday, Feb 2, 2006}
\vfill
Dear SAGE community.\vspace{2ex}

My name is Tiziano and I'm from Italy.  I'm 
writing this mail first of all because I would 
like to thank you all for SAGE.  It's something 
the world was really missing.\vspace{2ex}

[Every free computer algebra system I've tried 
has] {\dred ``reinvented many times the wheel without 
being able to build the car.''}
\vspace{2ex}
\vfill
{\Large Goal of \SAGE:  {\bf Build the car.}}
\begin{center}
\includegraphics[height=0.3\textheight]{car}
\qquad\qquad\includegraphics[height=0.3\textheight]{tire_pile}
\end{center}
\end{frame}

\begin{frame}[fragile]
\t{Another Email...}
\begin{verbatim}
Dear William,

[...] I think that you are doing a superb work 
with Sage, and thank you for it.

Best,

Henri [Cohen (GP/PARI founder)]
\end{verbatim}
\begin{center}
\includegraphics[width=0.3\textwidth]{cohen}
\end{center}
\end{frame}


\page{
  \t{My Story}
\begin{itemize}
\item {\dred 1997-98: Hecke} and interpreter in C++ (based on other code); for
modular forms research with Buzzard and Mazur.
\item {\dred 1998: D. Kohel:} ``too bad you have to write interpreter''; vast amount of 
Magma code
\item {\dred 1998: A. Steel:} 2 days in Berkeley teaching me Magma
\item {\dred 1999-2004:} I wrote {\dblue heaps} of Magma code (3
Sydney visits), and tried to convert everyone I met to using it.
\item {\dred 2000: M. Stoll} --``Magma -- Everything under one roof'' 

\item {\dred 2004:  Frustration}: Magma is closed source, closed development
  model, and expensive; authorship issues; no user-defined objects; hard
to save/load data (no eval command) --
  not a {\dblue mainstream} programming language.
\end{itemize}
}

\page{
\begin{itemize}
\item {\dred S. Hillion} (Berkeley) --  Love using Python in my job.

\item {\dred Nov 2004: Gonzalo Tornaria (Austin)} -- ``if I come up with a new algorithm
  what should I implement it in?''

\item {\dred Jan 2005: D. Joyner} -- winter AMS meeting; SAGE born 

\item {\dblue One year} of work with many people:\\
David Kohel, David Joyner, 
Iftikhar Burhanuddin, John Cremona, 
Martin Albrecht, Wilson Cheung,
Alex Clemesha, Neal Harris, Naqi Jaffery, 
David Kirkby,
Jon Hanke, Gregg Musiker,
Kyle Schalm, Steven Sivek, 
Justin Walker, Mark Watkins, 
Joe Wetherell, Karim Belebas,
John Tate, and many others...

\item {\dblue Feb 4--5: SAGE Days} at UCSD

\item {\em Many more contributors now!}  Gonzalo Tornaria, Kiran Kedlaya,
  Justin Walker, Steve Linton, ... and I'm getting new code (and
  offers of support) from people I've never heard of constantly.
\end{itemize}
}

\begin{frame}[fragile]
\t{SAGE Days 2006}
\includegraphics[width=\textwidth]{pics/img_1107}

\end{frame}

\begin{frame}[fragile]
\t{SAGE Has {\Huge 3} {\dred Distinct} Complementary Goals}
\vfill
\begin{enumerate}
\item {\dblue Distribution} of free open source mathematics software.
\vfill

\item {\dblue New computer algebra system} (very structural like Gap and Magma;
object-oriented; user extensible; do things right).
\vfill

\item {\dblue Better way to use} all your favorite ({\dred commercial} or free) 
mathematics software {\em together}.
\end{enumerate}
\vfill
\end{frame}


\page{
\t{1. Distribution of Free Open Source Software}
\begin{itemize}
\item {\dred Free self-contained} distribution of the very best
open source math software that has an
{\em active} community.
\vfill
\item \sage tarball: about 40MB; {\em all} GPL or compatible;
{\bf you} can change anything, rebuild, make any changed 
versions available, can fork \sage and make your 
own variant.  
\vfill
\item Type {\tt sage -sdist <version>} to make distro from your local
modified version of sage.  Type {\tt sage -bdist <version>} to make
a binary.
\end{itemize}
}

\begin{frame}
\t{Does Open Source Matter for Math Research?}
\small
``You can read Sylow's Theorem and its proof in Huppert's book in the
library [...]  then you can use Sylow's Theorem for the rest of your
life free of charge, but for many computer algebra systems license
fees have to be paid regularly [...].  You press buttons and you get
answers in the same way as you get the bright pictures from your
television set but you cannot control how they were made in either
case.
\vspace{2ex}

With this situation {\dred two of the most basic rules of conduct in
  mathematics are violated}: In mathematics {\dblue information is passed on
free of charge} and {\dblue everything is laid open for checking}. Not applying
these rules to computer algebra systems that are made for mathematical
research [...]  means {\dred moving in a most undesirable direction}.
Most important: Can we expect somebody to believe a result of a
program that he is not allowed to see? ''

\vspace{2ex}

-- J. Neub\"user in {\bf\LARGE 1993} (he started GAP in 1986).
\end{frame}

\page{
\t{The \SAGE Website}
\begin{center}
\includegraphics[width=0.7\textwidth]{website}
\end{center}
}


\page{
\t{Not-included With \SAGE and Why}
\begin{enumerate}
\item {\dblue NZMATH} -- provides inspiration (but not included)
\item {\dblue Macaulay2} -- supported but not included; working with
  Dan Grayson right now to make it part of SAGE.
\item {\dblue Gnuplot} -- screwy license (e.g., I wanted to change C source
so paths not hard coded, but this is not allowed!)
\item {\dblue KASH} -- closed source (but {\dgreen FREE} and {\em very} powerful)
\item {\dblue Magma} -- expensive and closed source ({\dgreen the 
dominant system} in 
arithmetic geometry)
\item {\dblue Mathematica / Maple} -- expensive and closed source 
\item {\dblue MATLAB} -- not supported, since I don't have it.
\end{enumerate}
But {\dred using these} from \sage is supported!
}

\begin{frame}[fragile]
\t{2. A New Computer Algebra System}
\begin{verbatim}
$ ls
algebras    databases  __init__.py  modular  schemes
all.py      edu        interfaces   modules  sets
categories  ext        libs         monoids  structure
coding      functions  matrix       plot     tests
crypto      groups     misc         rings    version.py

$ cat */*.py */*/*.py */*.pyx */*/*.pyx |sort|uniq|wc -l
52764        

$ cat */*.py */*/*.py */*.pyx */*/*.pyx |sort|uniq|grep "sage: " | wc -l
5888         <-------- INPUT TEST CODE
\end{verbatim}
\end{frame}

\page{
\t{3. Cooperation -- ``Everything Under One Roof''}
\SAGE has many interfaces ({\dblue bold included} with \sage):\mbox{}

\begin{itemize}
\item {\dblue GAP} -- groups, discrete math
\item {\dblue Singular} -- polynomial computation
\item {\dblue PARI/GP} -- number theory
\item {\dblue Maxima} -- symbolic manipulation
\item {\dblue mwrank, ec, simon, sea} -- elliptic curves
\item Macaulay2 -- commutative algebra (e.g., over $\Z$)
\item Gnuplot -- 2d and 3d graphics
\item KANT/KASH -- very sophisticated algebraic number theory
\item Magma -- vast high-quality research math environment
\item Maple -- symbolic, educational
\item Mathematica -- symbolic, numerical, educational
\item Octave  -- numerical
\end{itemize}
}

%sage: (-2006).factor(algorithm="kash")
%-1 * 2 * 17 * 59
\begin{frame}[fragile]
\t{$-2006 = -1\cdot 2\cdot 17 \cdot 59$}
\begin{verbatim}
sage: (-2006).factor()
-1 * 2 * 17 * 59
sage: gap(-2006).FactorsInt()
[ -2, 17, 59 ]
sage: pari(-2006).factor()
[-1, 1; 2, 1; 17, 1; 59, 1]
sage: maxima(-2006).factor()
-2*17*59
sage: kash(-2006).Factorization()
[ <2, 1>, <17, 1>, <59, 1> ], extended by: ext1 := -1
sage: magma(-2006).Factorization()
[ <2, 1>, <17, 1>, <59, 1> ]
sage: maple(-2006).ifactor()
-``(2)*``(17)*``(59)
sage: mathematica(-2006).FactorInteger()
{{-1, 1}, {2, 1}, {17, 1}, {59, 1}}
\end{verbatim}
\end{frame}

\page{
\t{Non-math \sage Components}
\begin{enumerate}
\item {\dblue IPython}: Wonderful Interactive Shell
\item {\dblue Python}: A {\dred Mainstream} Programming Language (many books;
numerous excellent tutorials; constantly being improved by 
dozens of developers)
\item {\dblue Pyrex}: {\dred Compiled} Python-Like Extension Language
\item Saving and Loading Objects ({\dblue ZODB} and {\dblue cPickle})
\end{enumerate}
}

\page{
\t{1. IPython: Wonderful Interactive Shell}
\vspace{2em}
\begin{center}
\includegraphics[width=0.4\textwidth]{pics/img_1084}
\vfill
\end{center}
Under very active development (especially parallel version); widely
used by applied math/physics people.
}

\page{
\t{2. Python: A Mainstream Programming Language}
\begin{itemize}
\item 1991: Guido van Rossum--Dutchman (now at Google)
\item {\dblue Numerous libraries} available for networking, 
graphics, video game programming, numerical analysis, etc.
\item Designed to be a {\dblue gluing language} (unlike many languages), 
i.e., easier to use code from other languages.
\item {\dblue Easy to read} other people's code (unlike, e.g., Perl, C++)
\item {\dblue Free} and {\dred open source} (unlike, e.g., Java)
\item From Python Advocacy FAQ:
\begin{itemize}
    \item  Run Web sites
    \item  Write GUI interfaces
    \item  Control number-crunching code on supercomputers
    \item  Build test suites for C or Java code
  \end{itemize}
\end{itemize}
}

\begin{frame}
\begin{center}
\includegraphics{guido}\\
Guido van Rossum
\end{center}
\end{frame}

\begin{frame}[fragile]
\t{3. Pyrex: Compiled Python-Like Extension Language}
\begin{verbatim}
          def factorial(n):
              cdef mpz_t f
              cdef int i
              cdef char* s
          
              mpz_init(f)
              mpz_set_si(f, n)
          
              for i from 2 <= i <= n:
                  mpz_mul_si(f, f, i)

              s = mpz_get_str(NULL, 32, f)
              r = int(s,32)
              free(s)
              return r
\end{verbatim}
\end{frame}

\begin{frame}
\t{Pyrex is {\dred CRUCIAL} to Success of \SAGE}
\vfill
\begin{enumerate}
\item Written by {\dred Greg Ewing} of New Zealand.
\vfill
\item Code converted to  C code that
is {\dred compiled by a C compiler}.
\vfill
\item Can use any Python functions and objects from
Pyrex and any C libraries.
\vfill
\item {\dred Time-critical} \sage code gets implemented
in Pyrex, which is (as fast as) C code, but easier
to read (e.g., since all variables and scopes are explicit).
\end{enumerate}
\end{frame}

\begin{frame}[fragile]
\t{Pyrex Works}
\begin{verbatim}
sage: time n=factorial_pure_python(100000)
CPU times: user 78.72 s, sys: 2.64 s, total: 81.37 s
sage: time v=pari('prod(n=1,100000,n)')
CPU times: user 18.89 s, sys: 0.19 s, total: 19.08 s
sage: time n=factorial_ZZ(100000)
CPU times: user 8.56 s, sys: 2.22 s, total: 10.79 s
magma: time n := Factorial(100000);     # MAGMA V2.12-10
Time: 9.030
sage: time n = factorial(100000)     # Pyrex (first try)
CPU times: user 6.93 s, sys: 0.00 s, total: 6.93 s
------------------
(PARI/MAGMA tricks...)
sage: time n = pari('100000!')
CPU times: user 1.06 s, sys: 0.03 s, total: 1.08 s
magma: time n := &*[1..100000];     # 
Time: 0.850
\end{verbatim}
\end{frame}

\begin{frame}[fragile]
\t{4. Saving and Loading Objects}

Almost any individual object in \sage can easily be loaded and saved
in a compressed format, as can sessions.  This requires almost
{\dblue no programmer support}, even for very complicated objects.
\begin{verbatim}
sage: E = EllipticCurve([1,2,3,4,5])
sage: time v = E.anlist(10^5)
CPU times: user 1.03 s, sys: 0.22 s, total: 1.25 s
Wall time: 1.59
sage: E.save('E')
sage: quit
Exiting SAGE (CPU time 0m1.45s, Wall time 0m25.36s).

$ sage
sage: F = load('E')
sage: time v = F.anlist(10^5)
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
sage: save_session, load_session, ...
\end{verbatim}
\end{frame}

\page{
\t{Help System}
\begin{enumerate}
\item {\tt function?} gives documentation about function (extracted
from source code)
\vfill
\item {\tt function??} gives the {\bf source code} of function
\vfill
\item Because Python is so readable, {\tt function??} is incredibly
useful and users frequently use it. 
\vfill
\item {\tt help(module or object)} gives man-page like docs
\vfill
\item {\dred TO DO:} full text search (Steven Sivek?)
\end{enumerate}
}


\begin{frame}
\t{Attribution}
\begin{itemize}
\item Whenever possible, files, function docs, and the reference
manual {\dblue state clearly who the author is}.
\item All new code submitted to \sage must be under a GPL compatible
      license.  Author may optionally keep copyright.
\item {\dgreen Citation:}
  William Stein and David Joyner, \emph{SAGE: System for algebra and geometry
  experimentation}, Communications in Computer Algebra  (SIGSAM Bulletin) (July
  2005), {\tt http://sage.sourceforge.net/}.
\item {\dblue VERY Important!} Always cite the underlying backends used
by \sage for your work, e.g., GAP, Singular, PARI, Kash, etc.  Ask in
\sage forum and/or use {\tt function??} to view source.

\end{itemize}

\end{frame}


\begin{frame}[fragile]
\t{Example 1: Bernoulli Numbers}
Easy to compare timings in different systems...
\begin{verbatim}
sage: a = maple('bernoulli(1000)')    # Wall time: 9.27
sage: a = maxima('bern(1000)')        # Wall time: 5.49
sage: a = magma('Bernoulli(1000)')    # Wall time: 2.58
sage: a = gap('Bernoulli(1000)')      # Wall time: 5.92
sage: a = mathematica('BernoulliB[1000]') #W time: 1.01
  calcbn (http://www.bernoulli.org)   #      Time: 0.06
sage: a = gp('bernfrac(1000)')        # Wall time: 0.00?!
\end{verbatim}

The above led to a paper I'm writing with Kevin McGown.

\vfill
{\small (NOTE: Mathematica 5.2 is much faster than Mathematica 5.1
at computing Bernoulli numbers, and the timing is almost
identical to PARI (for $n>1000$), though amusingly Mathematica 5.2 is
{\em slow} for $n\leq 1000$!)}
\end{frame}


\begin{frame}[fragile]
\t{Example 2: Elliptic Curves $L$-series}
\begin{verbatim}
sage: E = EllipticCurve('37a'); E
Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field
sage: E.Lseries(1.1)  --> 0.032330449021518493
sage: E.Lseries(1)    --> 0.00000000000000000
sage: plot([float(E.Lseries(float(n)/20)) for n in range(10,30)])
sage: L = EllipticCurve('389a').Lseries
sage: plot([float(L(float(n)/20)) for n in range(10,30)])
\end{verbatim}
\begin{center}
\includegraphics[width=0.42\textwidth]{37a-lser}
\qquad
\includegraphics[width=0.4\textwidth]{L389a}
\end{center}
\end{frame}

\begin{frame}[fragile]
\t{Example 2 (continued): Complex $L$-series}
\begin{verbatim}
sage: E = EllipticCurve('389a')
sage: E.Lseries_extended(1+I,  50)
-0.33297168182616760 + 0.37317660446124179*I
sage: E.Lseries_extended(1+0.2*I,  50)
-0.029679202996999034 + 0.0034727623999086183*I
\end{verbatim}
\begin{center}  
\includegraphics[height=0.6\textheight]{389A-lser}
\end{center}
\end{frame}

\begin{frame}[fragile]
\t{Example 3: Birch and Swinnerton-Dyer}
\begin{verbatim}
sage: E = EllipticCurve('37a')
sage: E.sha_an()           --> 1
sage: E.non_surjective()   --> []
sage: E.sha_an()           --> 1
sage: E.regulator()        --> 0.051111408239999996
sage: E.gens()             --> [(0 : 0 : 1)]
sage: E.heegner_discriminants(50)  --> [-3, -4, -7, -11, -40, -47]
sage: E.heegner_index(-7)  # Kolyvagin ==> Sha trivial
[0.999990645298, 1.00000935475]  
sage: E.q_expansion(5)     
            --> q - 2*q^2 - 3*q^3 + 2*q^4 + O(q^5)
sage: E.simon_two_descent ()
(1, 1, [(0 : 108 : 1)])
sage: E.sea(next_prime(10^30)) 
1000000000000001426441464441649
\end{verbatim}
\end{frame}


\page{
\t{Summary: Cool Features of \SAGE}
\begin{enumerate}
\item {\dred Mainstream} programming language
\item {\dred Save and load} individual data and sessions
\item DVI and HTML {\dred logging}
\item Easy-to-use {\dred compiled} extension language (can easily use C libraries).
\item {\dred attach, load}; even works with compiled code.
\item All {\dred examples} in documentation {\dred tested}
\end{enumerate}
}


\begin{frame}
\t{To Do}
MUCH is left to do.   I hope {\dred YOU} will help!
\vfill
\begin{enumerate}
\item Much {\dred new code} still needs to be written for plotting,
  algebraic geometry, linear algebra, number theory, etc.,
  especially when no open source implementations exist.  \vfill
\item {\dred Optimization} --- parts of \sage are currently very slow.
\vfill
\item Many excellent {\dred free packages} 
need to be included, e.g., genus2reduction,
sympow, Rubinstein's L-functions package.
\vfill
\item {\dred Documentation!}  Examples!  More Documentation!
Even more examples!
\item {\dred Package Distribution:}  rpm, msi, deb, pkg, etc.  Need
user support.  The {\tt sage-mindist-*.*.*.tar} package is supposed
to make this easier. 
\item {\dred STR: Sage Technical Reports:} (Unusual?) Journal; 
refereed, widely mirrored, subsequent traditional journal publication.
\end{enumerate}
\vfill
\end{frame}


\end{document}

