-
-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve triangulate and volume methods for polytopes over inexact rings #30699
Comments
comment:1
Ok. Traced it back:
in How is one supposed to check this? Is there a good way to check whether the scalar product of two vectors is positive, which considers their norm etc. in case of inexactness? |
comment:2
this is a notoriously tricky problem. I'm inclined to close it as "won't fix, use exact arithmetic instead". |
comment:3
here is a link to CGAL manual (CGAL was developed by computational geometry specialists, no reasons to expect we can beat them): In a nutshell, you need exact predicates, even if you work with floating point data. Meanwhile:
so indeed some simplices there are very thin. |
comment:5
Ok. I agree with you that if we really want to support triangulation for reals, then we should do via some other package. I also don't think this is a priority. (Note that I solved #29176 by using In the meantime: How about changing backend to I really don't like the traceback and it is not documented that we do not expect this to work. So naturally people will file a bug report. Replying to @dimpase:
|
comment:6
Documenting this, perhaps printing a warning, is a good idea. To me, the whole idea of doing inexact computations like this in a naive way is a bit problematic. IMHO it's a legacy of the times where such computations were too slow in exact arithmetic. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:10
More on the thin simplices in comment:3. Start with the points from the initial report:
Construct the corresponding polytope over
Plotting it reveals a polyhedron with six quadrilateral faces:
Changing the base ring to the rationals splits some of the faces:
The simplex from comment:3 corresponds to one of those split faces:
To see all the simplices, first triangulate:
Plot all the simplices together:
Or individually; two of them are very flat and correspond to faces of P:
|
comment:11
I propose to repurpose this ticket to:
The improvement could consist in
|
This comment has been minimized.
This comment has been minimized.
comment:12
I changed the summary and milestone. Revert if you disagree. |
comment:13
It makes no sense to talk about facets of polyhedron over an inexact ring.
3-dimensional facet of a 3-dimensional polytope, yeah, cool ?! (I guess Sage should You can plot it, as per comment:10, and get an approximate picture of it, but the reality is more like it has 9 facets, only 4 of them 4-gons:
|
comment:14
The combinatorics are fine. As mentioned earlier ‘cdd‘ computes the incidence matrix just fine (in many scenarios) and we now use this instead of recomputing. Faces should just be set up with the correct dimension from the combinatorics. That is a two line fix, which should be done. Of course we cannot beat the backend. If the backend fails, we can't do anything (which is not the case here). |
comment:15
Replying to @kliem:
No, my point is that you can't really talk about combinatorics here - as you need a new definition of what an "approximate facet" is. That the backend thinks that there 4 vectors with RDF coordinates are coplanar only makes sense if your affine hyperplanes are actually pairs of sufficiently close parallel hyperplanes. There are no real facets in the RDF world, only these "thick" facets. |
comment:16
‘cdd‘ takes care of those things and figures out an incidence matrix for it. As for the volume, center or center of mass, it does not make a difference wether vertices are are coplanar or not. Anyway, I don't exactly get your point. Do you disagree with the direction the ticket goes? Do you want to point out that no matter how much we work, inexact polyhedra will remain inperfect? |
comment:17
Replying to @kliem:
I doubt that
I am not sure. I'd rather be on a safe side and error out if the dimension is wrong.
IMHO the volume is computed by triangulating first, and this step may fail. |
comment:18
Replying to @dimpase:
This is why we compute everything twice with
Of course the answer is wrong, if we require that points are exactly coplanar.
As explained above for the volume you can just change to |
comment:19
Does the consistency of cdd output guarantees that the answer mathematically makes sense, e.g. does not violate Euler formula? My point is that Sage should not silently lead the user up the garden path into a place with facets of wrong dimension and all that. |
comment:20
As mentioned earlier, this wrong dimension of facets is simply because we compute the dimension by the rank of a matrix corresponding to the vertices of a face. This computation assumes exactness, which No, the consistency does not guarantee Euler's formular to hold. It could easily end up with a combintorial type, that does not have a realization at all. This is the risk of using inexact data. There is two ways to deal with it:
I think, we have already agreed on, that the first approach should be used for volume etc and that we will simply not support triangulation for the second approach (unless it accidentally works). I would even go so far, as to completely ban triangulations at least for inexact non-simplicial polytopes, because it will likely contradict with the combinatorics that I would personally never work with inexact polyhedra, but I can see that they sometimes arise and sometimes you want a good guess, what this polyhedron actually is. What is it, you are suggesting?
|
comment:21
Setting new milestone based on a cursory review of ticket status, priority, and last modification date. |
The
volume
andtriangulate
methods for polytopesover inexact rings can fail with
ZeroDivisionError
.For example, define the following polytope:
Trying to triangulate it or to compute its volume,
we get a zero division error:
The problem happens inside the method
placing_triangulation
ofPointConfiguration
. Specifically, in the following line:This line produces a list with different ordering in different sage sessions. So you may need to run the above code more than one time to reproduce the problem.
(The bug was reported by Günter Rote. It appeared when he was trying to compute the volume of the polytope P given above.)
Original discussion:
To get the volume, a workaround is suggested by comment:3 below:
This ticket proposes to catch the
ZeroDivisionError
andfail with in informative error message and a suggestion
to work over the rationals.
CC: @kliem @jplab @mkoeppe @dimpase @slel
Component: geometry
Keywords: PointConfiguration, triangulation, volume
Issue created by migration from https://trac.sagemath.org/ticket/30699
The text was updated successfully, but these errors were encountered: