#13194: Inconsistency in polytope nfacets.
-------------------------------+--------------------------------------------
Reporter: mmarco | Owner: mhampton
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.2
Component: geometry | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-------------------------------+--------------------------------------------
Changes (by vbraun):
* keywords: polytope, facets, fan =>
* type: defect => enhancement
Old description:
> There is some inconsistency in the name of the method that provides the
> number of facets of a polytope. The polytope class provides the
> .n_facets() method. On the other hand, the NormalFan function calls the
> .nfacets() method, that doesn't exist:
>
> {{{
> sage: R.<x,y,z>=ZZ[]
> sage: f=x*R.random_element()+y*R.random_element()+z*R.random_element()
> sage: Q=f.newton_polytope()
> sage: NormalFan(Q)
> ---------------------------------------------------------------------------
> AttributeError Traceback (most recent call
> last)
>
> /home/mmarco/sage-5.0/<ipython console> in <module>()
>
> /home/mmarco/sage-5.0/local/lib/python2.7/site-
> packages/sage/geometry/fan.pyc in NormalFan(polytope, lattice)
> 626 (N(0, 1), N(-1, 0))
> 627 """
> --> 628 rays = (polytope.facet_normal(i) for i in
> range(polytope.nfacets()))
> 629 cones = (vertex.facets() for vertex in polytope.faces(dim=0))
> 630 fan = Fan(cones, rays, lattice=lattice, check=False)
>
> AttributeError: 'Polyhedron_QQ_ppl' object has no attribute 'nfacets'
>
> }}}
>
> I don't know if it is meant to be n_facets or nfacets, but it should be
> consistent.
New description:
It would be nice if face/normal fans could be constructed from a generic
(QQ-)polytope and not just from a lattice polytope:
{{{
sage: R.<x,y,z>=ZZ[]
sage: f=x*R.random_element()+y*R.random_element()+z*R.random_element()
sage: Q=f.newton_polytope()
sage: NormalFan(Q)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
/home/mmarco/sage-5.0/<ipython console> in <module>()
/home/mmarco/sage-5.0/local/lib/python2.7/site-
packages/sage/geometry/fan.pyc in NormalFan(polytope, lattice)
626 (N(0, 1), N(-1, 0))
627 """
--> 628 rays = (polytope.facet_normal(i) for i in
range(polytope.nfacets()))
629 cones = (vertex.facets() for vertex in polytope.faces(dim=0))
630 fan = Fan(cones, rays, lattice=lattice, check=False)
AttributeError: 'Polyhedron_QQ_ppl' object has no attribute 'nfacets'
}}}
--
Comment:
`NormalFan` takes a lattice polytope as argument, not any QQ-polytope:
{{{
sage: NormalFan(Q.lattice_polytope())
Rational polyhedral fan in 3-d lattice N
}}}
Having said that, it would be nice if any polytope would work.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13194#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.