1. Volker Braun
  2. Toric varieties paper

Source

Toric varieties paper / Toricvarieties.tex

\documentclass[12pt]{article}

\include{Preamble}

\makeatletter
\renewcommand{\sagestr}[1]{\ST@sage{str(#1)}}
\makeatother



\lstdefinelanguage{Sage}[]{Python}
  {morekeywords={False,sage,True},sensitive=true}
\lstdefinelanguage{SageOutput}[]{}
  {morekeywords={False,True},sensitive=true}
\lstdefinestyle{DefaultSageInputOutput}{
  identifierstyle=,
  name=sagecommandline,
  xleftmargin=5pt,
  numbersep=5pt,
  aboveskip=0pt,
  belowskip=0pt,
  breaklines=true,
  numberstyle=\footnotesize,
  numbers=right
}
\lstdefinestyle{DefaultSageInput}{
  language=Sage,
  style=DefaultSageInputOutput,
  commentstyle={\ttfamily\color{dgreencolor}},
  keywordstyle={\ttfamily\color{dbluecolor}\bfseries},
  stringstyle={\ttfamily\color{dgraycolor}\bfseries}
}
\lstdefinestyle{DefaultSageOutput}{
  language=SageOutput,
  style=DefaultSageInputOutput,
  commentstyle={\ttfamily\color{dgreencolor}},
  keywordstyle={\ttfamily\color{dbluecolor}},
  stringstyle={\ttfamily\color{dgraycolor}}
}
\lstdefinestyle{SageInput}{
  style=DefaultSageInput,
  basicstyle={\fontsize{11pt}{11pt}\ttfamily\bfseries}
}
\lstdefinestyle{SageOutput}{
  style=DefaultSageOutput,
  basicstyle={\fontsize{11pt}{11pt}\ttfamily}
}
\definecolor{dbluecolor}{rgb}{0.01,0.02,0.7}
\definecolor{dgreencolor}{rgb}{0.2,0.4,0.0}
\definecolor{dgraycolor}{rgb}{0.30,0.3,0.30}




\begin{document}
%%%%%%%%%%%%%%%%%%%%%[ Title Page ]%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{titlepage}
  \vspace*{-2cm}
  \VersionInformation
  \hfill
  \parbox[c]{5cm}{
    \begin{flushright}
%       arXiv:yymm.nnnn [hep-th]
%       \\
%      DIAS-STP 10-nn
    \end{flushright}
  }
  \vspace*{\stretch1}
  \begin{center}
    \Huge
    Toric Geometry in the Sage CAS
  \end{center}
  \vspace*{\stretch1}
  \begin{center}
    \begin{minipage}{\textwidth}
      \begin{center}
        \textsc{Volker Braun${}^1$ and Andrey Novoseltsev${}^2$}
        \\[3ex]
        ${}^1$\textit{Dublin Institute for Advanced Studies}\\
        \textit{10 Burlington Road}\\
        \textit{Dublin 4, Ireland}\\[3ex]
        Email: \texttt{vbraun@stp.dias.ie}
        \\[3ex]
        ${}^2$\textit{Department of Mathematical and Statistical Sciences}\\
        \textit{University of Alberta, Canada}\\[3ex]
        Email: \texttt{novoselt@ualberta.ca}
      \end{center}
    \end{minipage}
  \end{center}
  \vspace*{\stretch1}
  \begin{abstract}
    Very abstract
  \end{abstract}
  \vspace*{\stretch1}
\end{titlepage}
\tableofcontents


\newpage


\section{Introduction}
\label{sec:intro}

Mention:
\begin{itemize}
\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}
\end{itemize}






\section{An Overview}
\label{sec: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
\begin{sagecommandline}
  sage: dP8 = toric_varieties.dP8()
  sage: dP8
\end{sagecommandline}
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}%
\begin{sagecommandline}
  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}
\end{sagecommandline}
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 
\begin{itemize}
\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()}.
\end{itemize}
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
\begin{sagecommandline}
  sage: dP8.coordinate_ring()
\end{sagecommandline}




\subsection{Cones and Fans}
\label{sec:fans}


Let us inspect the fan closer:
\begin{sagecommandline}
  sage: fan = dP8.fan()
  sage: fan(dim=1)
  sage: fan.ngenerating_cones()
  sage: fan.graph(axes=False)
\end{sagecommandline}
The graphical output of the last command is shown in
\autoref{fig:dP8fan}. Finally, let us examine a cone of the fan:
\begin{sagecommandline}
  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]
\end{sagecommandline}
Intersection of two cones:
\begin{sagecommandline}
  sage: cone.faces()
  sage: sigma1, sigma2 = cone.facets()
  sage: cone.facets()
  sage: sigma1.intersection(sigma2)
\end{sagecommandline}



\begin{figure}
  \centering
  \begin{sagesilent}
    dP8_graph = toric_varieties.dP8().fan().graph(axes=False)
    dP8_graph.axes(False)
    dP8_graph.set_aspect_ratio(1)
  \end{sagesilent}
  \sageplot[scale=0.7]{dP8_graph}
  \caption{The fan of the degree-$8$ del Pezzo surface.}
  \label{fig:dP8fan}
\end{figure}


\subsubsection{A Fourfold}

\begin{sagecommandline}
  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()
\end{sagecommandline}





\section{Reference}
\label{sec:reference}

\subsection{Cones and Fans}
\label{sec:fan}

\subsection{Toric Varieties}
\label{sec:toricvar}






\appendix

\section{Implementation Details}
\label{sec:implementation}




\section{Installation}
\label{sec:install}


\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
\end{lstlisting}
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
\url{http://trac.sagemath.org/sage_trac/ticket/9604}. 

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')
\end{lstlisting}
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}''





\newpage


\bibliographystyle{utcaps} 
\renewcommand{\refname}{Bibliography}
\addcontentsline{toc}{section}{Bibliography} 
\bibliography{Volker.bib}

\end{document}














%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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:

\begin{lstlisting}[]
    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'>
\end{lstlisting}


\begin{sageblock}
    f(x) = exp(x) * sin(2*x)
\end{sageblock}

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: