Never mind (at least about the Sage help). I found the bug, and it wasn't anything Sage-specific; I was using the variable "v" in two different ways. Note that this mistake could have been discovered by a debugging tool that checks to see whether the coder has redefined an already-defined variable without ever using it. I'm waiting for AI's that partner with human coders, learn about the kinds of mistakes they make, and help them find those mistakes. I'm guessing there are kinds of errors that most coders make, and kinds of errors that are more specific to individual coders. How long do you think I'll have to wait? Jim Propp P.S. Stay tuned for updates about triple-intersections (assuming I don't make more coding errors that I have trouble locating, resulting in my being unable to run experiments). On Wed, Dec 20, 2017 at 9:35 AM, James Propp <jamespropp@gmail.com> wrote:
I either need Sage help, or math help, in order to figure out whether all these fun facts about pairwise intersections extend to triple (and higher order) intersections.
In one-dimension, I can show that the expected length of the intersection of k unit intervals, conditional upon the intersection being nonempty, is 1/k.
It follows (via the additivity of expected values of random variables and the multiplicativity of expected values of independent random variables) that if you take the intersection of k a-by-b rectangles, conditional upon the intersection being nonempty, the intersection has expected perimeter (2a+2b)/k and expected area (ab)/k^2.
This extends easily to parallelograms and parallelohedra, but where I get stuck is thinking about centrosymmetric hexagons.
Can anyone see how to prove (or disprove) that if you take the intersection of three translates of a centrosymmetric hexagon, conditioned upon the intersection being nonempty, the expected perimeter is P/3 and the expected area is A/9, where P and A are the perimeter and area of the hexagon?
Alternatively, can anyone tell me why the following Sage code (for computing the expected number of vertices of the triple intersection) doesn't work?
v = [] h = 866/1000 for i in range(10): s=4*floor(1000000*random())/1000000-2 t=4*floor(1000000*random())/1000000-2 u=4*floor(1000000*random())/1000000-2 v=4*floor(1000000*random())/1000000-2 p1=Polyhedron(vertices=[[-1,0],[-1/2,h],[1/2,h],[1,0],[1/2,- h],[-1/2,-h]]) p2=Polyhedron(vertices=[[-1+s,0+t],[-1/2+s,h+t],[1/2+s,h+t], [1+s,0+t],[1/2+s,-h+t],[-1/2+s,-h+t]]) p3=Polyhedron(vertices=[[-1+u,0+v],[-1/2+u,h+v],[1/2+u,h+v], [1+u,0+v],[1/2+u,-h+v],[-1/2+u,-h+v]]) p12=p1.intersection(p2) if len(p12.f_vector())>1: p123=p12.intersection(p3) if len(p123.f_vector())>1: v.append((p123.f_vector())[1]) sum(v)/len(v)
If I knew how to fix the bug, I think I'd be able to do numerical experiments regarding perimeter and area as well.
Thanks,
Jim Propp