1. Volker Braun
  2. Toric varieties paper


Toric varieties paper / Toricvarieties.tex





%%%%%%%%%%%%%%%%%%%%%[ Title Page ]%%%%%%%%%%%%%%%%%%%%%%%%%%
%       arXiv:yymm.nnnn [hep-th]
%       \\
%      DIAS-STP 10-nn
    Toric Geometry in the Sage CAS
        \textsc{Volker Braun${}^1$ and Andrey Novoseltsev${}^2$}
        ${}^1$\textit{Dublin Institute for Advanced Studies}\\
        \textit{10 Burlington Road}\\
        \textit{Dublin 4, Ireland}\\[3ex]
        Email: \texttt{vbraun@stp.dias.ie}
        ${}^2$\textit{Department of Mathematical and Statistical Sciences}\\
        \textit{University of Alberta, Canada}\\[3ex]
        Email: \texttt{novoselt@ualberta.ca}
    Very abstract



\item tab completion
\item help
\item worksheet vs. command line vs. Sage\TeX
\item \url{http://wiki.sagemath.org/quickref}
\item \url{http://sagemath.org/help-video.html}

\section{An Overview}

Let us take the blow-up of $\CP^2$ as an example of a toric
surface. This surface is already known to Sage. We assign it to the
variable \lstinline{dP8} by typing
  sage: dP8 = toric_varieties.dP8()
  sage: dP8
The result is a \textbf{C}repant \textbf{P}artially-\textbf{R}esolved
(not necessarily smooth) Fano toric variety. These are the toric
varieties whose rays span a reflexive polyhedron. Note that, as a
general rule, the mathematical objects in Sage only print a brief
textual representation instead of every painstaking detail. We can
query some of its properties via
  % sage: dP8.dimension()       %\label{cmd:dimension}%
  % sage: dP8.is_smooth()       %\label{cmd:is_smooth}%
  % sage: dP8.Delta_polar()     %\label{cmd:Delta_polar}%
  % sage: dP8.fan()             %\label{cmd:fan}%
  sage: dP8.dimension()     #@\label{cmd:dimension}
  sage: dP8.is_smooth()     #@\label{cmd:is_smooth}
  sage: dP8.Delta_polar()   #@\label{cmd:Delta_polar}
  sage: dP8.fan()           #@\label{cmd:fan}
The commands on lines~\ref{cmd:dimension}, \ref{cmd:is_smooth},
and~\ref{cmd:fan} work for every toric variety, but the (reflexive)
lattice polytope $\Delta^\ast$ is only associated to CPR Fano toric
varieties. This is an example of the object oriented nature of Sage:
The CPR Fano objects derive from generic toric varieties. The base
class contains, amongst other things, the fan. The derived class
inherits all of this and adds 
\item new data, namely the reflexive polyhedron, and
\item new methods,\footnote{In object-oriented programming, a
    \emph{method} is a subroutine contained in a object. Objects
    contain both subroutines and data. The analog of a function call
    \lstinline{f(x)} is the method call \lstinline{x.f()}.} for
  example \lstinline{dP8.Delta_polar()}.
Now, there are at least three distinct ways of dealing with toric
varieties: The gluing of affine charts
$\mathop{\mathrm{Spec}}(\sigma^\dual \cap M)$~\cite{Fulton}, as a real
torus fibration over a convex polyhedron~\cite{dasilva2001lsg}, and
via the Cox homogeneous coordinates~\cite{Cox:1993fz}. In the Sage
package, we generally follow the latter, and define
  sage: dP8.coordinate_ring()

\subsection{Cones and Fans}

Let us inspect the fan closer:
  sage: fan = dP8.fan()
  sage: fan(dim=1)
  sage: fan.ngenerating_cones()
  sage: fan.graph(axes=False)
The graphical output of the last command is shown in
\autoref{fig:dP8fan}. Finally, let us examine a cone of the fan:
  sage: cone = fan.generating_cone(0); cone
  sage: cone in fan(codim=0)
  sage: cone.rays()
  sage: ray = cone.ray(0); ray
  sage: ray[0]
Intersection of two cones:
  sage: cone.faces()
  sage: sigma1, sigma2 = cone.facets()
  sage: cone.facets()
  sage: sigma1.intersection(sigma2)

    dP8_graph = toric_varieties.dP8().fan().graph(axes=False)
  \caption{The fan of the degree-$8$ del Pezzo surface.}

\subsubsection{A Fourfold}

  sage: cones = [(0,1,2,3), (0,1,2,6), (0,1,3,4), (0,1,4,5), (0,1,5,6), (0,2,3,4), (0,2,4,5), (0,2,5,6), (1,2,3,6), (1,3,4,5), (1,3,5,6), (2,3,4,5), (2,3,5,6)]
  sage: rays = [(1,0,0,0), (0,1,0,0), (0,0,1,0), (0,0,0,1), (1,-1,-1,0), (-1,0,0,-1), (-1,1,1,-1)]
  sage: X = ToricVariety(Fan(cones,rays), 'y3, y5, y6, y7, y1, y2, y4')
  sage: X.Stanley_Reisner_ideal()
  sage: J1=X.divisor(6)
  sage: J2=X.divisor(1)
  sage: J3=X.divisor(3)
  sage: J1.c1()


\subsection{Cones and Fans}

\subsection{Toric Varieties}


\section{Implementation Details}


\subsection{Installing Sage}

You can either download a binary (already compiled) archive of Sage at
\url{http://sagemath.org/download.html}, or download the source code
from \url{http://sagemath.org/download-source.html} and compile it
yourself. At the time of writing, Sage 4.5.2 is the newest
version. Compilation is easy, on any supported flavor of UNIX you can
just issue
\begin{lstlisting}[style=SageInput, language=bash, numbers=none]
  [user@localhost ~]$ tar xf ~/Download/sage-4.5.2.tar
  [user@localhost ~]$ cd sage-4.5.2
  [user@localhost sage-4.5.2]$ 
  [user@localhost sage-4.5.2]$ make
Note that compilation will take somewhere between an hour and days,
depending on your computer. 

\subsection{More Toric Varieties Code}

At the time of writing, not all toric varieties code is included in
the official Sage release. You can see the current status on the Sage
trac web page at

If you just want to try out\footnote{If you plan on contributing to
  the Sage toric varieties library, on the other hand, we encourage
  you to use a Mercurial queue and add all patches to it
  individually.}  the newest version, you can install a
\emph{Mercurial bundle}\footnote{An archive of multiple patches for
  the Mercurial revision control system.} by typing
\begin{lstlisting}[style=SageInput, numbers=none]
  sage: hg_sage.unbundle('http://trac.sagemath.org/sage_trac/raw-attachment/ticket/9604/toricvarieties.hg')
at the Sage command line. This will add more toric varieties code to
your copy of the Sage library source code, but you still need to
rebuild the library. For this, quit sage (either Ctrl-D or
``\texttt{exit}''), and \textbf{b}uild and \textbf{r}un by issuing
``\texttt{sage -br}''




Using Sage\TeX, one can use Sage to compute things and put them into
your \LaTeX{} document. For example, there are
$\sage{number_of_partitions(1269)}$ integer partitions of $1269$.
You don't need to compute the number yourself, or even cut and paste
it from somewhere.

Here's some Sage code:

    sage: R.<x> = ZZ[]
    sage: type(R.an_element())
    <type 'sage.rings...Polynomial_integer_dense_flint'>
    sage: R.<x,y> = ZZ[]
    sage: type(R.an_element())
    <type 'sage.rings...MPolynomial_libsingular'>
    sage: R = PolynomialRing(ZZ, 'x', implementation='NTL')
    sage: type(R.an_element())
    <type 'sage.rings...Polynomial_integer_dense_ntl'>

    f(x) = exp(x) * sin(2*x)

The second derivative of $f$ is

  \frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}} \sage{f(x)} =
  \sage{diff(f, x, 2)(x)}.

Here's a plot of $f$ from $-1$ to $1$:

\sageplot{plot(f, -1, 1)}

%%% Local Variables:
%%% mode: TeX-pdf
%%% End: