Polyhedron with real vertices

25 views
Skip to first unread message

Victor Miller

unread,
Apr 10, 2013, 12:29:39 PM4/10/13
to sage-s...@googlegroups.com
I've found that if l is a list of points with float coordinates, then

Polyhedron(vertices=l)

gives a long trace back error message (see below for example).  At the very least it should give something short like asking the user to specify a base_ring argument.  Even better, would be to infer a base_ring from the list of vertices.  T he traceback below is from a sagenb.org notebook.

Victor

l = [[0.8,-0.5],[0.3,0.3]]
P0 = Polyhedron(vertices=l)
       
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_15.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("UDAgPSBQb2x5aGVkcm9uKHZlcnRpY2VzPWwp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpcYyKji/___code___.py", line 2, in <module>
    exec compile(u'P0 = Polyhedron(vertices=l)
  File "", line 1, in <module>
    
  File "/sagenb/sage_install/sage-5.4-sage.math.washington.edu-x86_64-Linux/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 691, in wrapper
    return func(*args, **kwds)
  File "/sagenb/sage_install/sage-5.4-sage.math.washington.edu-x86_64-Linux/local/lib/python2.7/site-packages/sage/geometry/polyhedron/constructor.py", line 287, in Polyhedron
    return Polyhedron_QQ_ppl(ambient_dim, Vrep, Hrep, minimize=minimize)
  File "/sagenb/sage_install/sage-5.4-sage.math.washington.edu-x86_64-Linux/local/lib/python2.7/site-packages/sage/geometry/polyhedron/base.py", line 126, in __init__
    self._init_from_Vrepresentation(ambient_dim, vertices, rays, lines, **kwds)
  File "/sagenb/sage_install/sage-5.4-sage.math.washington.edu-x86_64-Linux/local/lib/python2.7/site-packages/sage/geometry/polyhedron/backend_ppl.py", line 72, in _init_from_Vrepresentation
    d = lcm([denominator(v_i) for v_i in v])
  File "/sagenb/sage_install/sage-5.4-sage.math.washington.edu-x86_64-Linux/local/lib/python2.7/site-packages/sage/misc/functional.py", line 324, in denominator
    return x.denominator()
  File "element.pyx", line 332, in sage.structure.element.Element.__getattr__ (sage/structure/element.c:3475)
  File "misc.pyx", line 204, in sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1509)
AttributeError: 'sage.rings.real_mpfr.RealLiteral' object has no attribute 'denominator'


Volker Braun

unread,
Apr 10, 2013, 2:10:48 PM4/10/13
to sage-s...@googlegroups.com
Works for me. I guess the sagenb.org version isn't quite up to speed....

sage: Polyhedron([[0.8,-0.5],[0.3,0.3]])
A 1-dimensional polyhedron in RDF^2 defined as the convex hull of 2 vertices
Reply all
Reply to author
Forward
0 new messages