# finite simplicial complexes, projective spaces, facets, giving strange output

The code

n=2; x=simplicial_complexes.RealProjectiveSpace(n);
fcts=x.facets(); out=file('P'+str(n)+'.txt','w');
for a in fcts: out.write(str(a)+'\n')
out.close();


writes a nice result in the file P2.txt:

(0, 2, 3)
(0, 3, 4)
(0, 1, 5)
(0, 4, 5)
(2, 3, 5)
(1, 2, 4)
(0, 1, 2)
(1, 3, 4)
(1, 3, 5)
(2, 4, 5)


This works for $n=1,\ldots,4$. However, for $n=5$, the file contains

((1, 5, 6), (1, 6), (1, 3, 5, 6), (6,), (2,), (2, 4))
((1, 2, 4, 6), (5,), (1, 4), (3, 5), (4,), (1, 4, 6))
((3, 4, 6), (1, 3, 4, 5, 6), (4, 6), (1, 3, 4, 6), (6,), (2,))
((1, 5, 6), (1, 2, 3, 4, 5, 6), (1, 3, 5, 6), (1,), (1, 5), (1, 3, 4, 5, 6))
((1, 6), (1, 3, 5, 6), (1,), (1, 2, 3, 5, 6), (1, 3, 6), (4,))
((1, 2), (3,), (3, 5, 6), (1, 2, 4), (3, 5), (2,))
((1, 2), (1,), (3,), (3, 6), (1, 2, 4), (1, 2, 4, 5))
((1, 2), (1,), (1, 2, 3, 6), (4, 5), (1, 2, 6), (4,))
((2, 3, 4), (2, 3, 4, 5), (1, 2, 3, 4, 5), (2, 3), (6,), (2,))
((1, 3, 4, 5), (1, 3, 4, 5, 6), (5,), (3, 5), (2,), (3, 4, 5))
...


What am I doing wrong here? Why don't I get a list of 5-dimensional simplices? I would like to obtain only the facets of the first 10 projective spaces.

edit retag close merge delete

1

That's because the vertices are no longer integers, but rather tuples of integers.

( 2020-01-14 13:22:16 +0200 )edit

@FrédéricC Not even that, since some tuples end in a comma, not an integer. Anyway, how can I get maximal simplices which have integers for vertices?

( 2020-01-14 15:45:17 +0200 )edit
2

Tuples with only one element have a final comma in python :

  sage: tuple([4])
(4,)

( 2020-01-14 17:21:15 +0200 )edit
1

"I would like to obtain only the facets of the first 10 projective spaces." Please look at the documentation. When n is at least 5, there will be (n+2)!/2 facets in Sage's triangulation of n-dimensional real projective space. When n=10, this will produce over 200 million facets.

( 2020-01-14 17:50:04 +0200 )edit

Sort by » oldest newest most voted

If you want vertices to be given as integers rather than (in the case of RP^5) tuples, you can create a dictionary to translate vertices to integers:

RP5 = simplicial_complexes.RealProjectiveSpace(5)
d = {y:x for x,y in enumerate(RP5.vertices())}


(By the way, Sage constructs such a dictionary already for its own uses, so you can replace the second line with d = RP5._vertex_to_index. This is not an advertised feature, so knowing how to construct your own dictionary for this translation is useful.)

Then you can use that dictionary to translate the actual facets to tuples of integers:

[tuple(d[v] for v in f) for f in RP5.facets()]


As I noted in a comment, this will get unwieldy pretty quickly, as the dimension goes up.

more