Is this a bug in Polyhedron class (RDF vs AA)?

39 views
Skip to first unread message

jplab

unread,
Oct 12, 2015, 11:47:02 AM10/12/15
to sage-support
Hi everyone,

Is the following behavior normal:

sage: P = polytopes.regular_polygon(5)
sage: a_vertex = P.vertices()[0]
sage: for facet in P.Hrepresentation(): print facet.contains(a_vertex), facet.interior_contains(a_vertex)

True False
True True
True False
True True
True True
sage: P = polytopes.regular_polygon(5, base_ring=RDF)
sage: a_vertex = P.vertices()[0]
sage: for facet in P.Hrepresentation(): print facet.contains(a_vertex), facet.interior_contains(a_vertex)

True True
True True
True True
True True
True True

Doing this containment test in RDF seems to break. I guess that there are many methods that depend on the containment methods that also break then?


Nathann Cohen

unread,
Oct 12, 2015, 11:57:09 AM10/12/15
to sage-support
Hellooooooo,

Is the following behavior normal:

Well... In the first case you work on an exact ring, and in the second case you compare the output of >= and > on an inexact ring.

I do not know if there is something wrong somewhere, but I do not expect float computations to be exact either, so I do not know...

Nathann

Vincent Delecroix

unread,
Oct 12, 2015, 4:21:12 PM10/12/15
to sage-s...@googlegroups.com
Yeap. This is exactly it. You have vertices over an inexact ring and
equations over an inexact ring. You should not expect anything beyond
the precision of the ring. Including subtle difference between < and <=.

sage: 0.9 == 0.3 + 0.3 + 0.3
False
sage: 0.9 > 0.3 + 0.3 + 0.3
True

jplab

unread,
Oct 13, 2015, 3:07:25 AM10/13/15
to sage-support
Hi,

Thank you for your quick answer!

Ok, that makes sense. I have a follow-up question. I will put it on sage-devel as it is related to the implementation of a ticket.

Best,
JP
Reply all
Reply to author
Forward
0 new messages