Ask Your Question
1

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

asked 2020-01-14 08:34:00 +0100

Leon gravatar image

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 flag offensive close merge delete

Comments

1

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

FrédéricC gravatar imageFrédéricC ( 2020-01-14 13:22:16 +0100 )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?

Leon gravatar imageLeon ( 2020-01-14 15:45:17 +0100 )edit
2

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

  sage: tuple([4])
  (4,)
FrédéricC gravatar imageFrédéricC ( 2020-01-14 17:21:15 +0100 )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.

John Palmieri gravatar imageJohn Palmieri ( 2020-01-14 17:50:04 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2020-01-14 18:02:12 +0100

updated 2020-01-14 18:04:21 +0100

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-01-14 08:34:00 +0100

Seen: 284 times

Last updated: Jan 14 '20