Hi Vincent, I don't know what you're checking, but the code in base_RDF.py says
return x>=-1e-6 So no, it is not checking true positivity. Am Dienstag, 13. Oktober 2015 13:50:54 UTC+2 schrieb vdelecroix: > > No need to check, the code is explicitely as I said: > > > def _is_positive(self, x): > return x >= 1e-6 > > Here is an example: > > sage: P = polytopes.regular_polygon(5, base_ring=RDF) > sage: v0,v1,v2,v3,v4 = [v.vector() for v in P.vertices()] > > sage: v = (.5*v0 + .5*v1) - 1e-4*v2 > sage: v in P > False > > sage: v = (.5*v0 + .5*v1) - 1e-7*v2 > sage: v in P > True > > Everything is fine with base_ring=AA (and using exact vectors of course). > > Vincent > > On 13/10/15 08:30, Jan Keitel wrote: > > Hi Vincent, > > > > that's actually not true, have you checked it? > > The code > > > > elif Vobj.is_vertex(): > > return (self.polyhedron()._is_positive( self.eval(Vobj) ) > and > > not self.polyhedron()._is_zero( self.eval(Vobj) ) ) > > > > inside interior_contains in representations.py gives > > > > sage: P = polytopes.regular_polygon(5, base_ring=RDF) > > sage: sage: a_vertex = P.vertices()[0] > > sage: sage: for facet in P.Hrepresentation(): print > > facet.contains(a_vertex), facet.interior_contains(a_vertex) > > True True > > True False > > True True > > True False > > True True > > > > Whether this is the correct way to go is an entirely different question > - > > all I'm saying is that _is_positive checks (with fuzziness) whether that > > the argument is non-negative, but not whether it is non-zero. Maybe that > is > > what should be changed. > > > > Am Dienstag, 13. Oktober 2015 12:19:50 UTC+2 schrieb vdelecroix: > >> > >> On 13/10/15 06:48, Jan Keitel wrote: > >>> In this particular case the problem can probably be resolved by being > >>> a bit stricter with the check in interior_contains: > >>> > >>> Instead of checking > >>> > >>> return self.polyhedron()._is_positive( self.eval(Vobj) ) > >>> > >>> one should have > >>> > >>> return self.polyhedron()._is_positive( self.eval(Vobj) ) > >> > and not > >>> self.polyhedron()._is_zero( self.eval(Vobj) ) > >> > >> This will not solve the problem! _is_positive(x) returns (x >= > -1e-6)... > >> which is exactly the same thing as _is_nonneg(x)... You will also get > >> False positive and True negative, won't you? For example, you can be > out > >> of the polytope but get from _is_positive that you are inside. > >> > >> I would go for: > >> - a warning for non exact rings (using the method .is_exact()) > >> - using _is_positive for non exact rings > >> > >> Though, using intensively _is_positive or _is_nonneg might > significantly > >> slows down the code (it is one more Python function call). > >> > >> Vincent > >> > > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.