polytope.py (by William Stein) - basic interface to Polymake.
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.
lattice_polytope.py (by A.N.) with the original goal to use PALP conveniently and interactively on single polytopes.
PALP is small and easy to build, was included right away.
Used via files/system calls.
{{{id=1| %time simplex = LatticePolytope([(1,0), (0,1), (-1,-1)]) simplex /// CPU time: 0.04 s, Wall time: 0.07 s }}} {{{id=3| %time simplex.poly_x("p") /// CPU time: 0.01 s, Wall time: 0.02 s }}} {{{id=4| %time simplex.points() /// CPU time: 0.00 s, Wall time: 0.00 s }}} {{{id=5| simplex.nef_x("-N -P -p") /// }}} {{{id=6| simplex.nef_partitions() /// }}} {{{id=7| simplex.plot3d() /// }}} {{{id=8| simplex.polar().plot3d() /// }}} {{{id=28| /// }}}polyhedra.py (by Marshal Hampton) - file-based (?) interface to cdd
Allows working with generic polyhedra, i.e. non-integer points, unbounded.
Rewritten by Volker Braun. Rewrite is now gone.
Cones for toric geometry - not special cases of polyhedra.
Toric lattices, fans, fan morphisms. Written and cross-reviewed by Volker Braun and A.N.
Most "polyhedral operations" use library interface to PPL (by Volker Braun).
{{{id=9| N = ToricLattice(2) N /// }}} {{{id=11| M = N.dual() M /// }}} {{{id=79| M.dual() /// }}} {{{id=12| M.plot() ///
}}}
{{{id=13|
sigma0 = Cone([(1/2,0), (0,2)], lattice=N)
sigma0
///
}}}
{{{id=14|
sigma0.rays()
///
}}}
{{{id=15|
sigma0.plot()
///
}}}
{{{id=16|
sigma1 = Cone([(0,1), (-1, -1)])
sigma2 = Cone([(-1,-1), (1, 0)])
Sigma = Fan([sigma0, sigma1, sigma2])
Sigma
///
}}}
{{{id=17|
Sigma.rays()
///
}}}
{{{id=55|
Sigma.cone_lattice().plot()
///
}}}
{{{id=18|
Sigma.plot()
///
}}}
{{{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(
}}}
{{{id=20|
Sigma == FaceFan(simplex)
///
}}}
{{{id=21|
Sigma.is_equivalent(FaceFan(simplex))
///
}}}
{{{id=22|
Sigma.is_isomorphic(FaceFan(simplex))
///
}}}
{{{id=80|
Sigma.isomorphism(FaceFan(simplex))
///
}}}
{{{id=23|
Sigma.is_equivalent(NormalFan(simplex.polar()))
///
}}}
{{{id=67|
fm = FanMorphism(2*identity_matrix(2), Fan([sigma0]), Sigma)
fm
///
}}}
{{{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()
///
}}}
{{{id=32|
toric_plotter.reset_options()
///
}}}
{{{id=33|
///
}}}
New rewrite of generic polyhedra allowing different backends: currently PPL and cddlib.
Triangulations (with and without optional package TOPCOM).
Integral points.
ppl_lattice_polytope.py - not as featurefull as LatticePolytope but much faster.
Clean up LatticePolytope code to make backend change possible.
Unify its interface with Cone and Fan, including plotting.
}}}
{{{id=35|
P2.coordinate_ring()
///
}}}
Default ring is $\mathbb{Q}$, assumed ring is $\mathbb{C}$, arbitrary one should work in principle.
{{{id=36| P2.inject_variables() /// Defining z0, z1, z2 }}} {{{id=38| P2.subscheme(z0 + z1^2) /// Traceback (most recent call last): File "
}}}
{{{id=45|
P2.fan().rays().column_matrix()
///
}}}
{{{id=46|
simplex.vertices()
///
}}}
{{{id=47|
AH = P2.anticanonical_hypersurface()
AH
///
}}}
{{{id=48|
simplex.polar().point(6)
///
}}}
{{{id=68|
AH.ambient_space() is P2
///
}}}
{{{id=69|
AH.ambient_space().coordinate_ring()
///
}}}
{{{id=51|
P2.anticanonical_hypersurface(monomial_points="all")
///
}}}
{{{id=50|
P2P = CPRFanoToricVariety(Delta=simplex, coordinate_points="all")
P2P.plot(generator_color="red", wall_alpha=0.2, ray_thickness=1, generator_thickness=5)
///
}}}
{{{id=52|
P2P.anticanonical_hypersurface(monomial_points="all")
///
}}}
{{{id=54|
D = 1/2*P2P.divisor(prod(P2P.gens()))
D
///
}}}
{{{id=71|
D.is_Cartier()
///
}}}
{{{id=70|
D.is_QQ_Weil()
///
}}}
{{{id=56|
D.cohomology_class()
///
}}}
{{{id=57|
P = D.polyhedron()
P
///
}}}
{{{id=58|
P.plot()
///
}}}
{{{id=59|
P2.Stanley_Reisner_ideal()
///
}}}
{{{id=75|
R = P2.coordinate_ring()
prod(R.ideal([f for f, m in e.factor()]) for e in P2.Stanley_Reisner_ideal().gens())
///
}}}
{{{id=74|
P1xP1 = toric_varieties.P1xP1()
P1xP1.Stanley_Reisner_ideal()
///
}}}
{{{id=76|
R = P1xP1.coordinate_ring()
prod(R.ideal([f for f, m in e.factor()]) for e in P1xP1.Stanley_Reisner_ideal().gens())
///
}}}
{{{id=77|
P1xP1.fan().primitive_collections()
///
}}}
{{{id=61|
P2P.Stanley_Reisner_ideal()
///
}}}
{{{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 "