(Toric) Geometry in Sage
system:sage


<h2>Very long time ago</h2>
<p><span style="background-color: #ffcc99;">polytope.py</span> (by William Stein) - basic interface to Polymake.</p>
<p>Polymake: not terribly difficult to build, but took half the time and half the size of the whole Sage to do it - no question about making Polymake a standard package.</p>
<h2>&nbsp;</h2>
<h2>&nbsp;</h2>
<h2>Long time ago</h2>
<p><span style="background-color: #ffcc99;">lattice_polytope.py</span> (by A.N.) with the original goal to use PALP conveniently and interactively on single polytopes.</p>
<p>PALP is small and easy to build, was included right away.</p>
<p>Used via files/system calls.</p>

{{{id=1|
%time
simplex = LatticePolytope([(1,0), (0,1), (-1,-1)])
simplex
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\Delta^{2}_{0}</script></html>


CPU time: 0.04 s,  Wall time: 0.07 s
}}}

{{{id=3|
%time
simplex.poly_x("p")
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{l}
\verb|2|\phantom{\verb!x!}\verb|4|\phantom{\verb!xx!}\verb|Points|\phantom{\verb!x!}\verb|of|\phantom{\verb!x!}\verb|P|\\
\phantom{\verb!xxxx!}\verb|1|\phantom{\verb!xxxx!}\verb|0|\phantom{\verb!xxx!}\verb|-1|\phantom{\verb!xxxx!}\verb|0|\\
\phantom{\verb!xxxx!}\verb|0|\phantom{\verb!xxxx!}\verb|1|\phantom{\verb!xxx!}\verb|-1|\phantom{\verb!xxxx!}\verb|0|\\
\phantom{\verb!x!}
\end{array}</script></html>


CPU time: 0.01 s,  Wall time: 0.02 s
}}}

{{{id=4|
%time
simplex.points()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr}
1 & 0 & -1 & 0 \\
0 & 1 & -1 & 0
\end{array}\right)</script></html>


CPU time: 0.00 s,  Wall time: 0.00 s
}}}

{{{id=5|
simplex.nef_x("-N -P -p")
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{l}
\verb|M:10|\phantom{\verb!x!}\verb|3|\phantom{\verb!x!}\verb|N:4|\phantom{\verb!x!}\verb|3|\phantom{\verb!xx!}\verb|codim=2|\phantom{\verb!x!}\verb|#part=1|\\
\phantom{\verb!x!}\verb|P:0|\phantom{\verb!x!}\verb|V:2|\phantom{\verb!xxxxxxx!}\verb|0sec|\phantom{\verb!xx!}\verb|0cpu|\\
\verb|np=0|\phantom{\verb!x!}\verb|d:0|\phantom{\verb!x!}\verb|p:1|\phantom{\verb!xxxx!}\verb|0sec|\phantom{\verb!xxxxx!}\verb|0cpu|\\
\phantom{\verb!x!}
\end{array}</script></html>
}}}

{{{id=6|
simplex.nef_partitions()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left[\text{Nef-partition } \{0, 1\} \sqcup \{2\}\right]</script></html>
}}}

{{{id=7|
simplex.plot3d()
///
}}}

{{{id=8|
simplex.polar().plot3d()
///
}}}

{{{id=28|

///
}}}

<h2>Still long time ago</h2>
<p><span style="background-color: #ffcc99;">polyhedra.py</span> (by Marshal Hampton) - file-based (?) interface to cdd</p>
<p>Allows working with generic polyhedra, i.e. non-integer points, unbounded.</p>
<p>Rewritten by Volker Braun. Rewrite is now gone.</p>
<h2>&nbsp;</h2>
<h2>&nbsp;</h2>
<h2>A few years ago</h2>
<p>Cones for toric geometry - not special cases of polyhedra.</p>
<p>Toric lattices, fans, fan morphisms. Written and cross-reviewed by Volker Braun and A.N.</p>
<p>Most "polyhedral operations" use library interface to PPL (by Volker Braun).</p>

{{{id=9|
N = ToricLattice(2)
N
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}N</script></html>
}}}

{{{id=11|
M = N.dual()
M
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}M</script></html>
}}}

{{{id=79|
M.dual()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}N</script></html>
}}}

{{{id=12|
M.plot()
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=13|
sigma0 = Cone([(1/2,0), (0,2)], lattice=N)
sigma0
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\sigma^{2}</script></html>
}}}

{{{id=14|
sigma0.rays()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(\left(1,\,0\right)_{N}, \left(0,\,1\right)_{N}\right)_{N}</script></html>
}}}

{{{id=15|
sigma0.plot()
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=16|
sigma1 = Cone([(0,1), (-1, -1)])
sigma2 = Cone([(-1,-1), (1, 0)])
Sigma = Fan([sigma0, sigma1, sigma2])
Sigma
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\Sigma^{2}</script></html>
}}}

{{{id=17|
Sigma.rays()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(\left(0,\,1\right)_{N}, \left(1,\,0\right)_{N}, \left(-1,\,-1\right)_{N}\right)_{N}</script></html>
}}}

{{{id=55|
Sigma.cone_lattice().plot()
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=18|
Sigma.plot()
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=19|
Sigma.plot(mode="generators")
///
/home/novoselt/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/geometry/toric_plotter.py:634: DeprecationWarning: use the option 'base_ring' instead of 'field'
See http://trac.sagemath.org/11634 for details.
  result += Polyhedron(vertices=vertices, field=RDF).render_solid(
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=20|
Sigma == FaceFan(simplex)
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{False}</script></html>
}}}

{{{id=21|
Sigma.is_equivalent(FaceFan(simplex))
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}</script></html>
}}}

{{{id=22|
Sigma.is_isomorphic(FaceFan(simplex))
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}</script></html>
}}}

{{{id=80|
Sigma.isomorphism(FaceFan(simplex))
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr}
1 & 0 \\
0 & 1
\end{array}\right) : \Sigma^{2} \to \Sigma^{2}</script></html>
}}}

{{{id=23|
Sigma.is_equivalent(NormalFan(simplex.polar()))
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}</script></html>
}}}

{{{id=67|
fm = FanMorphism(2*identity_matrix(2), Fan([sigma0]), Sigma)
fm
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr}
2 & 0 \\
0 & 2
\end{array}\right) : \Sigma^{2} \to \Sigma^{2}</script></html>
}}}

{{{id=24|
NormalFan(lattice_polytope.octahedron(3)).plot(mode="generators")
///
}}}

{{{id=29|
for i in sorted(toric_plotter.options().items()):
    print i
///
('font_size', 14)
('generator_color', 'blue')
('generator_thickness', None)
('generator_zorder', -3)
('label_color', 'black')
('label_zorder', -1)
('lattice_filter', None)
('mode', 'round')
('point_color', 'black')
('point_size', None)
('point_zorder', -2)
('radius', None)
('ray_color', 'purple')
('ray_label', 'u')
('ray_thickness', 3)
('ray_zorder', -4)
('show_generators', True)
('show_lattice', None)
('show_rays', True)
('show_walls', True)
('wall_alpha', 0.4)
('wall_color', 'rainbow')
('wall_label', '\\sigma')
('wall_zorder', -5)
('xmax', None)
('xmin', None)
('ymax', None)
('ymin', None)
('zmax', None)
('zmin', None)
}}}

{{{id=30|
toric_plotter.options(wall_alpha=1)
///
}}}

{{{id=31|
Sigma.plot()
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=32|
toric_plotter.reset_options()
///
}}}

{{{id=33|

///
}}}

<h2>Recent additions by Volker Braun</h2>
<p>New rewrite of generic polyhedra allowing different backends: currently PPL and cddlib.</p>
<p>Triangulations (with and without optional package TOPCOM).</p>
<p>Integral points.</p>
<p><span style="background-color: #ffcc99;">ppl_lattice_polytope.py</span> - not as featurefull as LatticePolytope but much faster.</p>
<h2>&nbsp;</h2>
<h2>&nbsp;</h2>
<h2>Future (this week?..)</h2>
<p>Clean up LatticePolytope code to make backend change possible.</p>
<p>Unify its interface with Cone and Fan, including plotting.</p>
<h2>&nbsp;</h2>
<h2>&nbsp;</h2>
<h2>Toric Geometry</h2>

{{{id=26|
P2 = ToricVariety(Sigma)
P2
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathbb{X}_{\Sigma^{2}}</script></html>
}}}

{{{id=34|
P2.plot()
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=35|
P2.coordinate_ring()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\Bold{Q}[z_{0}, z_{1}, z_{2}]</script></html>
}}}

<p>Default ring is $\mathbb{Q}$, assumed ring is $\mathbb{C}$, arbitrary one should work in principle.</p>

{{{id=36|
P2.inject_variables()
///
Defining z0, z1, z2
}}}

{{{id=38|
P2.subscheme(z0 + z1^2)
///
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_43.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("UDIuc3Vic2NoZW1lKHowICsgejFeMik="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "/tmp/tmp6svYg2/___code___.py", line 3, in <module>
    exec compile(u'P2.subscheme(z0 + z1**_sage_const_2 )' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "/home/novoselt/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/schemes/toric/variety.py", line 1887, in subscheme
    return AlgebraicScheme_subscheme_toric(self, polynomials)
  File "/home/novoselt/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/schemes/generic/algebraic_scheme.py", line 2148, in __init__
    polynomials)
  File "/home/novoselt/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/schemes/generic/algebraic_scheme.py", line 937, in __init__
    self.__polys = A._validate(polynomials)
  File "/home/novoselt/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/schemes/toric/variety.py", line 944, in _validate
    raise ValueError("%s is not homogeneous on %s!" % (p, self))
ValueError: z1^2 + z0 is not homogeneous on 2-d toric variety covered by 3 affine patches!
}}}

{{{id=39|
P2.subscheme(z0 + z1)
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\text{Closed subscheme of } \mathbb{X}_{\Sigma^{2}} \text{ defined by } z_{0} + z_{1}</script></html>
}}}

{{{id=81|
P2.subscheme([z0, z1, z2]).dimension()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}-1</script></html>
}}}

{{{id=40|
A2 = AffineToricVariety(sigma0)
f = A2.hom(fm, P2)
f
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{l}
\verb|Scheme|\phantom{\verb!x!}\verb|morphism:|\\
\phantom{\verb!xx!}\verb|From:|\phantom{\verb!x!}\verb|2-d|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\\
\phantom{\verb!xx!}\verb|To:|\phantom{\verb!xxx!}\verb|2-d|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\phantom{\verb!x!}\verb|covered|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|3|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|patches|\\
\phantom{\verb!xx!}\verb|Defn:|\phantom{\verb!x!}\verb|Defined|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|sending|\phantom{\verb!x!}\verb|Rational|\phantom{\verb!x!}\verb|polyhedral|\phantom{\verb!x!}\verb|fan|\phantom{\verb!x!}\verb|in|\phantom{\verb!x!}\verb|2-d|\phantom{\verb!x!}\verb|lattice|\phantom{\verb!x!}\verb|N|\phantom{\verb!x!}\verb|to|\phantom{\verb!x!}\verb|Rational|\phantom{\verb!x!}\verb|polyhedral|\phantom{\verb!x!}\verb|fan|\phantom{\verb!x!}\verb|in|\phantom{\verb!x!}\verb|2-d|\phantom{\verb!x!}\verb|lattice|\phantom{\verb!x!}\verb|N.|
\end{array}</script></html>
}}}

{{{id=41|
f.as_polynomial_map()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{l}
\verb|Scheme|\phantom{\verb!x!}\verb|morphism:|\\
\phantom{\verb!xx!}\verb|From:|\phantom{\verb!x!}\verb|2-d|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\\
\phantom{\verb!xx!}\verb|To:|\phantom{\verb!xxx!}\verb|2-d|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\phantom{\verb!x!}\verb|covered|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|3|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|patches|\\
\phantom{\verb!xx!}\verb|Defn:|\phantom{\verb!x!}\verb|Defined|\phantom{\verb!x!}\verb|on|\phantom{\verb!x!}\verb|coordinates|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|sending|\phantom{\verb!x!}\verb|[z0|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z1]|\phantom{\verb!x!}\verb|to|\\
\phantom{\verb!xxxxxxxx!}\verb|[z1^2|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z0^2|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|1]|
\end{array}</script></html>
}}}

{{{id=49|
for factor in reversed(f.factor()):
    factor.as_polynomial_map()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{l}
\verb|Scheme|\phantom{\verb!x!}\verb|morphism:|\\
\phantom{\verb!xx!}\verb|From:|\phantom{\verb!x!}\verb|2-d|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\\
\phantom{\verb!xx!}\verb|To:|\phantom{\verb!xxx!}\verb|2-d|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\\
\phantom{\verb!xx!}\verb|Defn:|\phantom{\verb!x!}\verb|Defined|\phantom{\verb!x!}\verb|on|\phantom{\verb!x!}\verb|coordinates|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|sending|\phantom{\verb!x!}\verb|[z0|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z1]|\phantom{\verb!x!}\verb|to|\\
\phantom{\verb!xxxxxxxx!}\verb|[z0^2|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z1^2]|
\end{array}</script></html>

<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{l}
\verb|Scheme|\phantom{\verb!x!}\verb|morphism:|\\
\phantom{\verb!xx!}\verb|From:|\phantom{\verb!x!}\verb|2-d|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\\
\phantom{\verb!xx!}\verb|To:|\phantom{\verb!xxx!}\verb|2-d|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\phantom{\verb!x!}\verb|covered|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|3|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|patches|\\
\phantom{\verb!xx!}\verb|Defn:|\phantom{\verb!x!}\verb|Defined|\phantom{\verb!x!}\verb|on|\phantom{\verb!x!}\verb|coordinates|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|sending|\phantom{\verb!x!}\verb|[z0|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z1]|\phantom{\verb!x!}\verb|to|\\
\phantom{\verb!xxxxxxxx!}\verb|[z1|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z0|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|1]|
\end{array}</script></html>

<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{l}
\verb|Scheme|\phantom{\verb!x!}\verb|morphism:|\\
\phantom{\verb!xx!}\verb|From:|\phantom{\verb!x!}\verb|2-d|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\phantom{\verb!x!}\verb|covered|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|3|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|patches|\\
\phantom{\verb!xx!}\verb|To:|\phantom{\verb!xxx!}\verb|2-d|\phantom{\verb!x!}\verb|toric|\phantom{\verb!x!}\verb|variety|\phantom{\verb!x!}\verb|covered|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|3|\phantom{\verb!x!}\verb|affine|\phantom{\verb!x!}\verb|patches|\\
\phantom{\verb!xx!}\verb|Defn:|\phantom{\verb!x!}\verb|Defined|\phantom{\verb!x!}\verb|on|\phantom{\verb!x!}\verb|coordinates|\phantom{\verb!x!}\verb|by|\phantom{\verb!x!}\verb|sending|\phantom{\verb!x!}\verb|[z0|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z1|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z2]|\phantom{\verb!x!}\verb|to|\\
\phantom{\verb!xxxxxxxx!}\verb|[z0|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z1|\phantom{\verb!x!}\verb|:|\phantom{\verb!x!}\verb|z2]|
\end{array}</script></html>
}}}

{{{id=42|
print P2
///
2-d toric variety covered by 3 affine patches
}}}

{{{id=43|
P2 = CPRFanoToricVariety(Delta_polar=simplex)
print P2
///
2-d CPR-Fano toric variety covered by 3 affine patches
}}}

{{{id=44|
P2.plot()
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=45|
P2.fan().rays().column_matrix()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr}
1 & 0 & -1 \\
0 & 1 & -1
\end{array}\right)</script></html>
}}}

{{{id=46|
simplex.vertices()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr}
1 & 0 & -1 \\
0 & 1 & -1
\end{array}\right)</script></html>
}}}

{{{id=47|
AH = P2.anticanonical_hypersurface()
AH
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\text{Closed subscheme of } \mathbb{P}_{\Delta^{2}} \text{ defined by } a_{0} z_{0}^{3} + a_{1} z_{1}^{3} + a_{6} z_{0} z_{1} z_{2} + a_{2} z_{2}^{3}</script></html>
}}}

{{{id=48|
simplex.polar().point(6)
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,0\right)</script></html>
}}}

{{{id=68|
AH.ambient_space() is P2
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{False}</script></html>
}}}

{{{id=69|
AH.ambient_space().coordinate_ring()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{Frac}(\Bold{Q}[a_{0}, a_{1}, a_{2}, a_{6}])[z_{0}, z_{1}, z_{2}]</script></html>
}}}

{{{id=51|
P2.anticanonical_hypersurface(monomial_points="all")
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\text{Closed subscheme of } \mathbb{P}_{\Delta^{2}} \text{ defined by } a_{0} z_{0}^{3} + a_{9} z_{0}^{2} z_{1} + a_{7} z_{0} z_{1}^{2} + a_{1} z_{1}^{3} + a_{8} z_{0}^{2} z_{2} + a_{6} z_{0} z_{1} z_{2} + a_{4} z_{1}^{2} z_{2} + a_{5} z_{0} z_{2}^{2} + a_{3} z_{1} z_{2}^{2} + a_{2} z_{2}^{3}</script></html>
}}}

{{{id=50|
P2P = CPRFanoToricVariety(Delta=simplex, coordinate_points="all")
P2P.plot(generator_color="red", wall_alpha=0.2, ray_thickness=1, generator_thickness=5)
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=52|
P2P.anticanonical_hypersurface(monomial_points="all")
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\text{Closed subscheme of } \mathbb{P}_{\Delta^{2}_{0}} \text{ defined by } a_{2} z_{2}^{3} z_{3}^{2} z_{4} z_{5}^{2} z_{8} + a_{1} z_{1}^{3} z_{3} z_{4}^{2} z_{7}^{2} z_{9} + a_{3} z_{0} z_{1} z_{2} z_{3} z_{4} z_{5} z_{7} z_{8} z_{9} + a_{0} z_{0}^{3} z_{5} z_{7} z_{8}^{2} z_{9}^{2}</script></html>
}}}

{{{id=54|
D = 1/2*P2P.divisor(prod(P2P.gens()))
D
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{2}\mathrm{V}\left(z_{0}\right) + \frac{1}{2}\mathrm{V}\left(z_{1}\right) + \frac{1}{2}\mathrm{V}\left(z_{2}\right) + \frac{1}{2}\mathrm{V}\left(z_{3}\right) + \frac{1}{2}\mathrm{V}\left(z_{4}\right) + \frac{1}{2}\mathrm{V}\left(z_{5}\right) + \frac{1}{2}\mathrm{V}\left(z_{7}\right) + \frac{1}{2}\mathrm{V}\left(z_{8}\right) + \frac{1}{2}\mathrm{V}\left(z_{9}\right)</script></html>
}}}

{{{id=71|
D.is_Cartier()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{False}</script></html>
}}}

{{{id=70|
D.is_QQ_Weil()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}</script></html>
}}}

{{{id=56|
D.cohomology_class()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left[ \frac{3}{2} z_{2} + z_{3} + \frac{1}{2} z_{4} + z_{5} + \frac{1}{2} z_{8} \right]</script></html>
}}}

{{{id=57|
P = D.polyhedron()
P
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\verb|A|\phantom{\verb!x!}\verb|2-dimensional|\phantom{\verb!x!}\verb|polyhedron|\phantom{\verb!x!}\verb|in|\phantom{\verb!x!}\verb|QQ^2|\phantom{\verb!x!}\verb|defined|\phantom{\verb!x!}\verb|as|\phantom{\verb!x!}\verb|the|\phantom{\verb!x!}\verb|convex|\phantom{\verb!x!}\verb|hull|\phantom{\verb!x!}\verb|of|\phantom{\verb!x!}\verb|3|\phantom{\verb!x!}\verb|vertices|</script></html>
}}}

{{{id=58|
P.plot()
///
<html><font color='black'><img src='cell://sage0.png'></font></html>
}}}

{{{id=59|
P2.Stanley_Reisner_ideal()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(z_{0} z_{1} z_{2}\right)\Bold{Q}[z_{0}, z_{1}, z_{2}]</script></html>
}}}

{{{id=75|
R = P2.coordinate_ring()
prod(R.ideal([f for f, m in e.factor()]) for e in P2.Stanley_Reisner_ideal().gens())
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(z_{2}, z_{1}, z_{0}\right)\Bold{Q}[z_{0}, z_{1}, z_{2}]</script></html>
}}}

{{{id=74|
P1xP1 = toric_varieties.P1xP1()
P1xP1.Stanley_Reisner_ideal()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(s t, x y\right)\Bold{Q}[s, t, x, y]</script></html>
}}}

{{{id=76|
R = P1xP1.coordinate_ring()
prod(R.ideal([f for f, m in e.factor()]) for e in P1xP1.Stanley_Reisner_ideal().gens())
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(t y, t x, s y, s x\right)\Bold{Q}[s, t, x, y]</script></html>
}}}

{{{id=77|
P1xP1.fan().primitive_collections()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left[\verb|frozenset([0,|\phantom{\verb!x!}\verb|1])|, \verb|frozenset([2,|\phantom{\verb!x!}\verb|3])|\right]</script></html>
}}}

{{{id=61|
P2P.Stanley_Reisner_ideal()
///
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(z_{0} z_{2}, z_{1} z_{2}, z_{2} z_{4}, z_{2} z_{7}, z_{2} z_{8}, z_{2} z_{9}, z_{0} z_{3}, z_{1} z_{3}, z_{3} z_{5}, z_{3} z_{7}, z_{3} z_{8}, z_{3} z_{9}, z_{0} z_{4}, z_{4} z_{5}, z_{4} z_{7}, z_{4} z_{8}, z_{4} z_{9}, z_{0} z_{1}, z_{1} z_{5}, z_{1} z_{8}, z_{1} z_{9}, z_{0} z_{5}, z_{5} z_{7}, z_{5} z_{9}, z_{0} z_{7}, z_{7} z_{8}, z_{8} z_{9}\right)\Bold{Q}[z_{0}, z_{1}, z_{2}, z_{3}, z_{4}, z_{5}, z_{7}, z_{8}, z_{9}]</script></html>
}}}

{{{id=73|
raise RuntimeError("You are out of your RAM!")
R = P2P.coordinate_ring()
prod(R.ideal([f for f, m in e.factor()]) for e in P2P.Stanley_Reisner_ideal().gens())
///
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_75.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cmFpc2UgUnVudGltZUVycm9yKCJZb3UgYXJlIG91dCBvZiB5b3VyIFJBTSEiKQpSID0gUDJQLmNvb3JkaW5hdGVfcmluZygpCnByb2QoUi5pZGVhbChbZiBmb3IgZiwgbSBpbiBlLmZhY3RvcigpXSkgZm9yIGUgaW4gUDJQLlN0YW5sZXlfUmVpc25lcl9pZGVhbCgpLmdlbnMoKSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "/tmp/tmpzzhDXm/___code___.py", line 2, in <module>
    raise RuntimeError("You are out of your RAM!")
RuntimeError: You are out of your RAM!
}}}

{{{id=78|

///
}}}