Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit f809935

Browse files
committed
trac 18957 fixing some details
1 parent 125f822 commit f809935

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/sage/geometry/polyhedron/base_QQ.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def ehrhart_polynomial(self,engine=None,variable='t',verbose=False,
285285
EXAMPLES:
286286
287287
To start, we find the Ehrhart polynomial of a three-dimensional
288-
``simplex``, first using ``engine``='latte'. Leaving the engine
288+
``simplex``, first using ``engine='latte'``. Leaving the engine
289289
unspecified sets the ``engine`` to 'latte' by default::
290290
291291
sage: simplex = Polyhedron(vertices=[(0,0,0),(3,3,3),(-3,2,1),(1,-1,-2)])
@@ -355,7 +355,7 @@ def ehrhart_polynomial(self,engine=None,variable='t',verbose=False,
355355
if engine is None:
356356
# set default engine to latte
357357
engine = 'latte'
358-
if engine is 'latte':
358+
if engine == 'latte':
359359
poly = self._ehrhart_polynomial_latte(verbose, dual,
360360
irrational_primal, irrational_all_primal, maxdet,
361361
no_decomposition, compute_vertex_cones, smith_form,
@@ -365,7 +365,7 @@ def ehrhart_polynomial(self,engine=None,variable='t',verbose=False,
365365
# TO DO: replace this change of variable by creating the appropriate
366366
# polynomial ring in the latte interface.
367367

368-
elif engine is 'normaliz':
368+
elif engine == 'normaliz':
369369
return self._ehrhart_polynomial_normaliz(variable)
370370
else:
371371
raise ValueError("engine must be 'latte' or 'normaliz'")
@@ -462,12 +462,13 @@ def ehrhart_quasipolynomial(self, variable='t', engine=None, verbose=False,
462462
3 dimensional permutahedron fixed by the reflection
463463
across the hyperplane `x_1 = x_4`::
464464
465-
sage: subpoly = Polyhedron(vertices = [[3/2, 3, 4, 3/2],
465+
sage: verts = [[3/2, 3, 4, 3/2],
466466
....: [3/2, 4, 3, 3/2],
467467
....: [5/2, 1, 4, 5/2],
468468
....: [5/2, 4, 1, 5/2],
469469
....: [7/2, 1, 2, 7/2],
470-
....: [7/2, 2, 1, 7/2]], backend = 'normaliz') # optional - pynormaliz
470+
....: [7/2, 2, 1, 7/2]]
471+
sage: subpoly = Polyhedron(vertices=verts, backend='normaliz') # optional - pynormaliz
471472
sage: eq = subpoly.ehrhart_quasipolynomial() # optional - pynormaliz
472473
sage: eq # optional - pynormaliz
473474
(4*t^2 + 3*t + 1, 4*t^2 + 2*t)
@@ -526,9 +527,9 @@ def ehrhart_quasipolynomial(self, variable='t', engine=None, verbose=False,
526527
if engine is None:
527528
# setting the default to 'normaliz'
528529
engine = 'normaliz'
529-
if engine is 'normaliz':
530+
if engine == 'normaliz':
530531
return self._ehrhart_quasipolynomial_normaliz(variable)
531-
if engine is 'latte':
532+
if engine == 'latte':
532533
if any(not v.is_integral() for v in self.vertex_generator()):
533534
raise TypeError("the polytope has nonintegral vertices, the engine and backend of self should be 'normaliz'")
534535
poly = self._ehrhart_polynomial_latte(verbose, dual,
@@ -562,12 +563,13 @@ def _ehrhart_quasipolynomial_normaliz(self, variable='t'):
562563
The subpolytope of the 3 dimensional permutahedron fixed by the
563564
reflection across the hyperplane `x_1 = x_4`::
564565
565-
sage: subpoly = Polyhedron(vertices = [[3/2, 3, 4, 3/2],
566+
sage: verts = [[3/2, 3, 4, 3/2],
566567
....: [3/2, 4, 3, 3/2],
567568
....: [5/2, 1, 4, 5/2],
568569
....: [5/2, 4, 1, 5/2],
569570
....: [7/2, 1, 2, 7/2],
570-
....: [7/2, 2, 1, 7/2]], backend = 'normaliz') # optional - pynormaliz
571+
....: [7/2, 2, 1, 7/2]]
572+
sage: subpoly = Polyhedron(vertices=verts, backend='normaliz') # optional - pynormaliz
571573
sage: eq = subpoly._ehrhart_quasipolynomial_normaliz() # optional - pynormaliz
572574
sage: eq # optional - pynormaliz
573575
(4*t^2 + 3*t + 1, 4*t^2 + 2*t)

src/sage/geometry/polyhedron/base_ZZ.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ class Polyhedron_ZZ(Polyhedron_QQ):
3434
"""
3535
_base_ring = ZZ
3636

37-
def __getattribute__(self,name):
37+
def __getattribute__(self, name):
3838
r"""
3939
TESTS:
4040
41-
A lattice polytope doesn't have a Ehrhart quasipolynomial because it
41+
A lattice polytope does not have a Ehrhart quasipolynomial because it
4242
is always a polynomial::
4343
4444
sage: P = polytopes.cube()
@@ -52,7 +52,7 @@ def __getattribute__(self,name):
5252
if name in ['ehrhart_quasipolynomial']:
5353
raise AttributeError(name)
5454
else:
55-
return super(Polyhedron_ZZ,self).__getattribute__(name)
55+
return super(Polyhedron_ZZ, self).__getattribute__(name)
5656

5757
def __dir__(self):
5858
r"""
@@ -362,7 +362,7 @@ def ehrhart_polynomial(self, engine=None, variable='t', verbose=False, dual=None
362362
EXAMPLES:
363363
364364
To start, we find the Ehrhart polynomial of a three-dimensional
365-
``simplex``, first using ``engine``='latte'. Leaving the engine
365+
``simplex``, first using ``engine='latte'``. Leaving the engine
366366
unspecified sets the ``engine`` to 'latte' by default::
367367
368368
sage: simplex = Polyhedron(vertices=[(0,0,0),(3,3,3),(-3,2,1),(1,-1,-2)])
@@ -398,7 +398,7 @@ def ehrhart_polynomial(self, engine=None, variable='t', verbose=False, dual=None
398398
399399
Now we find the Ehrhart polynomials of the unit hypercubes of
400400
dimensions three through six. They are computed first with
401-
``engine``='latte' and then with ``engine``='normaliz'.
401+
``engine='latte'`` and then with ``engine='normaliz'``.
402402
The degree of the Ehrhart polynomial matches the dimension of the
403403
hypercube, and the coefficient of the leading monomial equals the
404404
volume of the unit hypercube::

0 commit comments

Comments
 (0)