Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/homology/examples.py
8818 views
1
# -*- coding: utf-8 -*-
2
"""
3
Examples of simplicial complexes
4
5
AUTHORS:
6
7
- John H. Palmieri (2009-04)
8
9
This file constructs some examples of simplicial complexes. There are
10
two main types: manifolds and examples related to graph theory.
11
12
For manifolds, there are functions defining the `n`-sphere for any
13
`n`, the torus, `n`-dimensional real projective space for any `n`, the
14
complex projective plane, surfaces of arbitrary genus, and some other
15
manifolds, all as simplicial complexes.
16
17
Aside from surfaces, this file also provides some functions for
18
constructing some other simplicial complexes: the simplicial complex
19
of not-`i`-connected graphs on `n` vertices, the matching complex on n
20
vertices, and the chessboard complex for an `n` by `i` chessboard.
21
These provide examples of large simplicial complexes; for example,
22
``simplicial_complexes.NotIConnectedGraphs(7,2)`` has over a million
23
simplices.
24
25
All of these examples are accessible by typing
26
``simplicial_complexes.NAME``, where ``NAME`` is the name of the example.
27
You can get a list by typing ``simplicial_complexes.`` and hitting the
28
TAB key::
29
30
simplicial_complexes.BarnetteSphere
31
simplicial_complexes.BrucknerGrunbaumSphere
32
simplicial_complexes.ChessboardComplex
33
simplicial_complexes.ComplexProjectivePlane
34
simplicial_complexes.K3Surface
35
simplicial_complexes.KleinBottle
36
simplicial_complexes.MatchingComplex
37
simplicial_complexes.MooreSpace
38
simplicial_complexes.NotIConnectedGraphs
39
simplicial_complexes.PoincareHomologyThreeSphere
40
simplicial_complexes.PseudoQuaternionicProjectivePlane
41
simplicial_complexes.RandomComplex
42
simplicial_complexes.RealProjectivePlane
43
simplicial_complexes.RealProjectiveSpace
44
simplicial_complexes.Simplex
45
simplicial_complexes.Sphere
46
simplicial_complexes.SumComplex
47
simplicial_complexes.SurfaceOfGenus
48
simplicial_complexes.Torus
49
50
See the documentation for ``simplicial_complexes`` and for each
51
particular type of example for full details.
52
"""
53
54
from sage.homology.simplicial_complex import SimplicialComplex, Simplex
55
from sage.sets.set import Set
56
from sage.misc.functional import is_even
57
from sage.combinat.subset import Subsets
58
import sage.misc.prandom as random
59
60
def matching(A, B):
61
r"""
62
List of maximal matchings between the sets ``A`` and ``B``.
63
64
A matching is a set of pairs `(a,b) \in A \times B` where each `a` and
65
`b` appears in at most one pair. A maximal matching is one which is
66
maximal with respect to inclusion of subsets of `A \times B`.
67
68
INPUT:
69
70
- ``A``, ``B`` -- list, tuple, or indeed anything which can be
71
converted to a set.
72
73
EXAMPLES::
74
75
sage: from sage.homology.examples import matching
76
sage: matching([1,2], [3,4])
77
[set([(1, 3), (2, 4)]), set([(2, 3), (1, 4)])]
78
sage: matching([0,2], [0])
79
[set([(0, 0)]), set([(2, 0)])]
80
"""
81
answer = []
82
if len(A) == 0 or len(B) == 0:
83
return [set([])]
84
for v in A:
85
for w in B:
86
for M in matching(set(A).difference([v]), set(B).difference([w])):
87
new = M.union([(v,w)])
88
if new not in answer:
89
answer.append(new)
90
return answer
91
92
def facets_for_RP4():
93
"""
94
Return the list of facets for a minimal triangulation of 4-dimensional
95
real projective space.
96
97
We use vertices numbered 1 through 16, define two facets, and define
98
a certain subgroup `G` of the symmetric group `S_{16}`. Then the set
99
of all facets is the `G`-orbit of the two given facets.
100
101
See the description in Example 3.12 in Datta [Da2007]_.
102
103
EXAMPLES::
104
105
sage: from sage.homology.examples import facets_for_RP4
106
sage: A = facets_for_RP4() # long time (1 or 2 seconds)
107
sage: SimplicialComplex(A) == simplicial_complexes.RealProjectiveSpace(4) # long time
108
True
109
"""
110
# Define the group:
111
from sage.groups.perm_gps.permgroup import PermutationGroup
112
g1 = '(2,7)(4,10)(5,6)(11,12)'
113
g2 = '(1, 2, 3, 4, 5, 10)(6, 8, 9)(11, 12, 13, 14, 15, 16)'
114
G = PermutationGroup([g1, g2])
115
# Define the two simplices:
116
t1 = (1, 2, 4, 5, 11)
117
t2 = (1, 2, 4, 11, 13)
118
# Apply the group elements to the simplices:
119
facets = []
120
for g in G:
121
d = g.dict()
122
for t in [t1, t2]:
123
new = tuple([d[j] for j in t])
124
if new not in facets:
125
facets.append(new)
126
return facets
127
128
def facets_for_K3():
129
"""
130
Returns the facets for a minimal triangulation of the K3 surface.
131
132
This is a pure simplicial complex of dimension 4 with 16
133
vertices and 288 facets. The facets are obtained by constructing a
134
few facets and a permutation group `G`, and then computing the
135
`G`-orbit of those facets.
136
137
See Casella and Kühnel in [CK2001]_ and Spreer and Kühnel [SK2011]_;
138
the construction here uses the labeling from Spreer and Kühnel.
139
140
EXAMPLES::
141
142
sage: from sage.homology.examples import facets_for_K3
143
sage: A = facets_for_K3() # long time (a few seconds)
144
sage: SimplicialComplex(A) == simplicial_complexes.K3Surface() # long time
145
True
146
"""
147
from sage.groups.perm_gps.permgroup import PermutationGroup
148
G = PermutationGroup([[(1,3,8,4,9,16,15,2,14,12,6,7,13,5,10)],
149
[(1,11,16),(2,10,14),(3,12,13),(4,9,15),(5,7,8)]])
150
return ([tuple([g(i) for i in (1,2,3,8,12)]) for g in G]
151
+[tuple([g(i) for i in (1,2,5,8,14)]) for g in G])
152
153
154
# for backwards compatibility:
155
SimplicialSurface = SimplicialComplex
156
157
class SimplicialComplexExamples():
158
"""
159
Some examples of simplicial complexes.
160
161
Here are the available examples; you can also type
162
``simplicial_complexes.`` and hit tab to get a list:
163
164
- :meth:`BarnetteSphere`
165
- :meth:`BrucknerGrunbaumSphere`
166
- :meth:`ChessboardComplex`
167
- :meth:`ComplexProjectivePlane`
168
- :meth:`K3Surface`
169
- :meth:`KleinBottle`
170
- :meth:`MatchingComplex`
171
- :meth:`MooreSpace`
172
- :meth:`NotIConnectedGraphs`
173
- :meth:`PoincareHomologyThreeSphere`
174
- :meth:`PseudoQuaternionicProjectivePlane`
175
- :meth:`RandomComplex`
176
- :meth:`RealProjectivePlane`
177
- :meth:`RealProjectiveSpace`
178
- :meth:`Simplex`
179
- :meth:`Sphere`
180
- :meth:`SumComplex`
181
- :meth:`SurfaceOfGenus`
182
- :meth:`Torus`
183
184
EXAMPLES::
185
186
sage: S = simplicial_complexes.Sphere(2) # the 2-sphere
187
sage: S.homology()
188
{0: 0, 1: 0, 2: Z}
189
sage: simplicial_complexes.SurfaceOfGenus(3)
190
Simplicial complex with 15 vertices and 38 facets
191
sage: M4 = simplicial_complexes.MooreSpace(4)
192
sage: M4.homology()
193
{0: 0, 1: C4, 2: 0}
194
sage: simplicial_complexes.MatchingComplex(6).homology()
195
{0: 0, 1: Z^16, 2: 0}
196
"""
197
198
def Sphere(self,n):
199
"""
200
A minimal triangulation of the `n`-dimensional sphere.
201
202
INPUT:
203
204
- ``n`` -- positive integer
205
206
EXAMPLES::
207
208
sage: simplicial_complexes.Sphere(2)
209
Simplicial complex with vertex set (0, 1, 2, 3) and facets {(0, 2, 3), (0, 1, 2), (1, 2, 3), (0, 1, 3)}
210
sage: simplicial_complexes.Sphere(5).homology()
211
{0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: Z}
212
sage: [simplicial_complexes.Sphere(n).euler_characteristic() for n in range(6)]
213
[2, 0, 2, 0, 2, 0]
214
sage: [simplicial_complexes.Sphere(n).f_vector() for n in range(6)]
215
[[1, 2],
216
[1, 3, 3],
217
[1, 4, 6, 4],
218
[1, 5, 10, 10, 5],
219
[1, 6, 15, 20, 15, 6],
220
[1, 7, 21, 35, 35, 21, 7]]
221
"""
222
S = Simplex(n+1)
223
facets = S.faces()
224
return SimplicialComplex(facets, is_mutable=False)
225
226
def Simplex(self, n):
227
"""
228
An `n`-dimensional simplex, as a simplicial complex.
229
230
INPUT:
231
232
- ``n`` -- a non-negative integer
233
234
OUTPUT: the simplicial complex consisting of the `n`-simplex
235
on vertices `(0, 1, ..., n)` and all of its faces.
236
237
EXAMPLES::
238
239
sage: simplicial_complexes.Simplex(3)
240
Simplicial complex with vertex set (0, 1, 2, 3) and facets {(0, 1, 2, 3)}
241
sage: simplicial_complexes.Simplex(5).euler_characteristic()
242
1
243
"""
244
return SimplicialComplex([Simplex(n)], is_mutable=False)
245
246
def Torus(self):
247
"""
248
A minimal triangulation of the torus.
249
250
EXAMPLES::
251
252
sage: simplicial_complexes.Torus().homology(1)
253
Z x Z
254
"""
255
return SimplicialComplex([[0,1,2], [1,2,4], [1,3,4], [1,3,6],
256
[0,1,5], [1,5,6], [2,3,5], [2,4,5],
257
[2,3,6], [0,2,6], [0,3,4], [0,3,5],
258
[4,5,6], [0,4,6]],
259
is_mutable=False)
260
261
def RealProjectivePlane(self):
262
"""
263
A minimal triangulation of the real projective plane.
264
265
EXAMPLES::
266
267
sage: P = simplicial_complexes.RealProjectivePlane()
268
sage: Q = simplicial_complexes.ProjectivePlane()
269
sage: P == Q
270
True
271
sage: P.cohomology(1)
272
0
273
sage: P.cohomology(2)
274
C2
275
sage: P.cohomology(1, base_ring=GF(2))
276
Vector space of dimension 1 over Finite Field of size 2
277
sage: P.cohomology(2, base_ring=GF(2))
278
Vector space of dimension 1 over Finite Field of size 2
279
"""
280
return SimplicialComplex([[0,1,2], [0,2,3], [0,1,5], [0,4,5],
281
[0,3,4], [1,2,4], [1,3,4], [1,3,5],
282
[2,3,5], [2,4,5]],
283
is_mutable=False)
284
285
ProjectivePlane = RealProjectivePlane
286
287
def KleinBottle(self):
288
"""
289
A minimal triangulation of the Klein bottle, as presented for example
290
in Davide Cervone's thesis [Ce1994]_.
291
292
EXAMPLES::
293
294
sage: simplicial_complexes.KleinBottle()
295
Simplicial complex with vertex set (0, 1, 2, 3, 4, 5, 6, 7) and 16 facets
296
297
REFERENCES:
298
299
.. [Ce1994] D. P. Cervone, "Vertex-minimal simplicial immersions of the Klein
300
bottle in three-space", Geom. Ded. 50 (1994) 117-141,
301
http://www.math.union.edu/~dpvc/papers/1993-03.kb/vmkb.pdf.
302
"""
303
return SimplicialComplex([[2,3,7], [1,2,3], [1,3,5], [1,5,7],
304
[1,4,7], [2,4,6], [1,2,6], [1,6,0],
305
[1,4,0], [2,4,0], [3,4,7], [3,4,6],
306
[3,5,6], [5,6,0], [2,5,0], [2,5,7]],
307
is_mutable=False)
308
309
def SurfaceOfGenus(self, g, orientable=True):
310
"""
311
A surface of genus `g`.
312
313
INPUT:
314
315
- ``g`` -- a non-negative integer. The desired genus
316
317
- ``orientable`` -- boolean (optional, default ``True``). If
318
``True``, return an orientable surface, and if ``False``,
319
return a non-orientable surface.
320
321
In the orientable case, return a sphere if `g` is zero, and
322
otherwise return a `g`-fold connected sum of a torus with itself.
323
324
In the non-orientable case, raise an error if `g` is zero. If
325
`g` is positive, return a `g`-fold connected sum of a
326
real projective plane with itself.
327
328
EXAMPLES::
329
330
sage: simplicial_complexes.SurfaceOfGenus(2)
331
Simplicial complex with 11 vertices and 26 facets
332
sage: simplicial_complexes.SurfaceOfGenus(1, orientable=False)
333
Simplicial complex with vertex set (0, 1, 2, 3, 4, 5) and 10 facets
334
"""
335
if g == 0:
336
if not orientable:
337
raise ValueError, "No non-orientable surface of genus zero."
338
else:
339
return simplicial_complexes.Sphere(2)
340
if orientable:
341
T = simplicial_complexes.Torus()
342
else:
343
T = simplicial_complexes.RealProjectivePlane()
344
S = T
345
for i in range(g-1):
346
S = S.connected_sum(T, is_mutable=False)
347
return S
348
349
def MooreSpace(self, q):
350
"""
351
Triangulation of the mod `q` Moore space.
352
353
INPUT:
354
355
- ``q`` -0 integer, at least 2
356
357
This is a simplicial complex with simplices of dimension 0, 1,
358
and 2, such that its reduced homology is isomorphic to
359
`\\ZZ/q\\ZZ` in dimension 1, zero otherwise.
360
361
If `q=2`, this is the real projective plane. If `q>2`, then
362
construct it as follows: start with a triangle with vertices
363
1, 2, 3. We take a `3q`-gon forming a `q`-fold cover of the
364
triangle, and we form the resulting complex as an
365
identification space of the `3q`-gon. To triangulate this
366
identification space, put `q` vertices `A_0`, ..., `A_{q-1}`,
367
in the interior, each of which is connected to 1, 2, 3 (two
368
facets each: `[1, 2, A_i]`, `[2, 3, A_i]`). Put `q` more
369
vertices in the interior: `B_0`, ..., `B_{q-1}`, with facets
370
`[3, 1, B_i]`, `[3, B_i, A_i]`, `[1, B_i, A_{i+1}]`, `[B_i,
371
A_i, A_{i+1}]`. Then triangulate the interior polygon with
372
vertices `A_0`, `A_1`, ..., `A_{q-1}`.
373
374
EXAMPLES::
375
376
sage: simplicial_complexes.MooreSpace(2)
377
Simplicial complex with vertex set (0, 1, 2, 3, 4, 5) and 10 facets
378
sage: simplicial_complexes.MooreSpace(3).homology()[1]
379
C3
380
sage: simplicial_complexes.MooreSpace(4).suspension().homology()[2]
381
C4
382
sage: simplicial_complexes.MooreSpace(8)
383
Simplicial complex with 19 vertices and 54 facets
384
"""
385
if q <= 1:
386
raise ValueError("The mod q Moore space is only defined if q is at least 2")
387
if q == 2:
388
return simplicial_complexes.RealProjectivePlane()
389
facets = []
390
for i in range(q):
391
Ai = "A" + str(i)
392
Aiplus = "A" + str((i+1)%q)
393
Bi = "B" + str(i)
394
facets.append([1, 2, Ai])
395
facets.append([2, 3, Ai])
396
facets.append([3, 1, Bi])
397
facets.append([3, Bi, Ai])
398
facets.append([1, Bi, Aiplus])
399
facets.append([Bi, Ai, Aiplus])
400
for i in range(1, q-1):
401
Ai = "A" + str(i)
402
Aiplus = "A" + str((i+1)%q)
403
facets.append(["A0", Ai, Aiplus])
404
return SimplicialComplex(facets, is_immutable=True)
405
406
def ComplexProjectivePlane(self):
407
"""
408
A minimal triangulation of the complex projective plane.
409
410
This was constructed by Kühnel and Banchoff [KB1983]_.
411
412
REFERENCES:
413
414
.. [KB1983] W. Kühnel and T. F. Banchoff, "The 9-vertex complex
415
projective plane", Math. Intelligencer 5 (1983), no. 3,
416
11-22.
417
418
EXAMPLES::
419
420
sage: C = simplicial_complexes.ComplexProjectivePlane()
421
sage: C.f_vector()
422
[1, 9, 36, 84, 90, 36]
423
sage: C.homology(2)
424
Z
425
sage: C.homology(4)
426
Z
427
"""
428
return SimplicialComplex(
429
[[1, 2, 4, 5, 6], [2, 3, 5, 6, 4], [3, 1, 6, 4, 5],
430
[1, 2, 4, 5, 9], [2, 3, 5, 6, 7], [3, 1, 6, 4, 8],
431
[2, 3, 6, 4, 9], [3, 1, 4, 5, 7], [1, 2, 5, 6, 8],
432
[3, 1, 5, 6, 9], [1, 2, 6, 4, 7], [2, 3, 4, 5, 8],
433
[4, 5, 7, 8, 9], [5, 6, 8, 9, 7], [6, 4, 9, 7, 8],
434
[4, 5, 7, 8, 3], [5, 6, 8, 9, 1], [6, 4, 9, 7, 2],
435
[5, 6, 9, 7, 3], [6, 4, 7, 8, 1], [4, 5, 8, 9, 2],
436
[6, 4, 8, 9, 3], [4, 5, 9, 7, 1], [5, 6, 7, 8, 2],
437
[7, 8, 1, 2, 3], [8, 9, 2, 3, 1], [9, 7, 3, 1, 2],
438
[7, 8, 1, 2, 6], [8, 9, 2, 3, 4], [9, 7, 3, 1, 5],
439
[8, 9, 3, 1, 6], [9, 7, 1, 2, 4], [7, 8, 2, 3, 5],
440
[9, 7, 2, 3, 6], [7, 8, 3, 1, 4], [8, 9, 1, 2, 5]],
441
is_mutable=False)
442
443
def PseudoQuaternionicProjectivePlane(self):
444
r"""
445
Returns a pure simplicial complex of dimension 8 with 490 facets.
446
447
.. WARNING::
448
449
This is expected to be a triangulation of the projective plane
450
`HP^2` over the ring of quaternions, but this has not been
451
proved yet.
452
453
This simplicial complex has the same homology as `HP^2`. Its
454
automorphism group is isomorphic to the alternating group `A_5`
455
and acts transitively on vertices.
456
457
This is defined here using the description in [BrK92]_. This
458
article deals with three different triangulations. This procedure
459
returns the only one which has a transitive group of
460
automorphisms.
461
462
EXAMPLES::
463
464
sage: HP2 = simplicial_complexes.PseudoQuaternionicProjectivePlane() ; HP2
465
Simplicial complex with 15 vertices and 490 facets
466
sage: HP2.f_vector()
467
[1, 15, 105, 455, 1365, 3003, 4515, 4230, 2205, 490]
468
469
Checking its automorphism group::
470
471
sage: HP2.automorphism_group().is_isomorphic(AlternatingGroup(5))
472
True
473
474
REFERENCES:
475
476
.. [BrK92] Brehm U., Kuhnel W., "15-vertex triangulations of an
477
8-manifold", Math. Annalen 294 (1992), no. 1, 167-193.
478
"""
479
from sage.groups.perm_gps.permgroup import PermutationGroup
480
P = [(1,2,3,4,5),(6,7,8,9,10),(11,12,13,14,15)]
481
S = [(1,6,11),(2,15,14),(3,13,8),(4,7,5),(9,12,10)]
482
start_list = [
483
(1,2,3,6,8,11,13,14,15), # A
484
(1,3,6,8,9,10,11,12,13), # B
485
(1,2,6,9,10,11,12,14,15), # C
486
(1,2,3,4,7,9,12,14,15), # D
487
(1,2,4,7,9,10,12,13,14), # E
488
(1,2,6,8,9,10,11,14,15), # F
489
(1,2,3,4,5,6,9,11,13), # G
490
(1,3,5,6,8,9,10,11,12), # H
491
(1,3,5,6,7,8,9,10,11), # I
492
(1,2,3,4,5,7,10,12,15), # J
493
(1,2,3,7,8,10,12,13,14), # K
494
(2,5,6,7,8,9,10,13,14), # M
495
496
(3,4,6,7,11,12,13,14,15), # L
497
(3,4,6,7,10,12,13,14,15)] # N
498
return SimplicialComplex([ [g(index) for index in tuple]
499
for tuple in start_list
500
for g in PermutationGroup([P,S]) ])
501
502
def PoincareHomologyThreeSphere(self):
503
"""
504
A triangulation of the Poincare homology 3-sphere.
505
506
This is a manifold whose integral homology is identical to the
507
ordinary 3-sphere, but it is not simply connected. In particular,
508
its fundamental group is the binary icosahedral group, which has
509
order 120. The triangulation given here has 16 vertices and is
510
due to Björner and Lutz [BL2000]_.
511
512
REFERENCES:
513
514
.. [BL2000] Anders Björner and Frank H. Lutz, "Simplicial
515
manifolds, bistellar flips and a 16-vertex triangulation of
516
the Poincaré homology 3-sphere", Experiment. Math. 9
517
(2000), no. 2, 275-289.
518
519
EXAMPLES::
520
521
sage: S3 = simplicial_complexes.Sphere(3)
522
sage: Sigma3 = simplicial_complexes.PoincareHomologyThreeSphere()
523
sage: S3.homology() == Sigma3.homology()
524
True
525
sage: Sigma3.fundamental_group().cardinality() # long time
526
120
527
"""
528
return SimplicialComplex(
529
[[1, 2, 4, 9], [1, 2, 4, 15], [1, 2, 6, 14], [1, 2, 6, 15],
530
[1, 2, 9, 14], [1, 3, 4, 12], [1, 3, 4, 15], [1, 3, 7, 10],
531
[1, 3, 7, 12], [1, 3, 10, 15], [1, 4, 9, 12], [1, 5, 6, 13],
532
[1, 5, 6, 14], [1, 5, 8, 11], [1, 5, 8, 13], [1, 5, 11, 14],
533
[1, 6, 13, 15], [1, 7, 8, 10], [1, 7, 8, 11], [1, 7, 11, 12],
534
[1, 8, 10, 13], [1, 9, 11, 12], [1, 9, 11, 14], [1, 10, 13, 15],
535
[2, 3, 5, 10], [2, 3, 5, 11], [2, 3, 7, 10], [2, 3, 7, 13],
536
[2, 3, 11, 13], [2, 4, 9, 13], [2, 4, 11, 13], [2, 4, 11, 15],
537
[2, 5, 8, 11], [2, 5, 8, 12], [2, 5, 10, 12], [2, 6, 10, 12],
538
[2, 6, 10, 14], [2, 6, 12, 15], [2, 7, 9, 13], [2, 7, 9, 14],
539
[2, 7, 10, 14], [2, 8, 11, 15], [2, 8, 12, 15], [3, 4, 5, 14],
540
[3, 4, 5, 15], [3, 4, 12, 14], [3, 5, 10, 15], [3, 5, 11, 14],
541
[3, 7, 12, 13], [3, 11, 13, 14], [3, 12, 13, 14], [4, 5, 6, 7],
542
[4, 5, 6, 14], [4, 5, 7, 15], [4, 6, 7, 11], [4, 6, 10, 11],
543
[4, 6, 10, 14], [4, 7, 11, 15], [4, 8, 9, 12], [4, 8, 9, 13],
544
[4, 8, 10, 13], [4, 8, 10, 14], [4, 8, 12, 14], [4, 10, 11, 13],
545
[5, 6, 7, 13], [5, 7, 9, 13], [5, 7, 9, 15], [5, 8, 9, 12],
546
[5, 8, 9, 13], [5, 9, 10, 12], [5, 9, 10, 15], [6, 7, 11, 12],
547
[6, 7, 12, 13], [6, 10, 11, 12], [6, 12, 13, 15], [7, 8, 10, 14],
548
[7, 8, 11, 15], [7, 8, 14, 15], [7, 9, 14, 15], [8, 12, 14, 15],
549
[9, 10, 11, 12], [9, 10, 11, 16], [9, 10, 15, 16], [9, 11, 14, 16],
550
[9, 14, 15, 16], [10, 11, 13, 16], [10, 13, 15, 16],
551
[11, 13, 14, 16], [12, 13, 14, 15], [13, 14, 15, 16]],
552
is_mutable=False)
553
554
def RealProjectiveSpace(self, n):
555
r"""
556
A triangulation of `\Bold{R}P^n` for any `n \geq 0`.
557
558
INPUT:
559
560
- ``n`` -- integer, the dimension of the real projective space
561
to construct
562
563
The first few cases are pretty trivial:
564
565
- `\Bold{R}P^0` is a point.
566
567
- `\Bold{R}P^1` is a circle, triangulated as the boundary of a
568
single 2-simplex.
569
570
- `\Bold{R}P^2` is the real projective plane, here given its
571
minimal triangulation with 6 vertices, 15 edges, and 10
572
triangles.
573
574
- `\Bold{R}P^3`: any triangulation has at least 11 vertices by
575
a result of Walkup [Wa1970]_; this function returns a
576
triangulation with 11 vertices, as given by Lutz [Lu2005]_.
577
578
- `\Bold{R}P^4`: any triangulation has at least 16 vertices by
579
a result of Walkup; this function returns a triangulation
580
with 16 vertices as given by Lutz; see also Datta [Da2007]_,
581
Example 3.12.
582
583
- `\Bold{R}P^n`: Lutz has found a triangulation of
584
`\Bold{R}P^5` with 24 vertices, but it does not seem to have
585
been published. Kühnel [Ku1987]_ has described a triangulation of
586
`\Bold{R}P^n`, in general, with `2^{n+1}-1` vertices; see
587
also Datta, Example 3.21. This triangulation is presumably
588
not minimal, but it seems to be the best in the published
589
literature as of this writing. So this function returns it
590
when `n > 4`.
591
592
ALGORITHM: For `n < 4`, these are constructed explicitly by
593
listing the facets. For `n = 4`, this is constructed by
594
specifying 16 vertices, two facets, and a certain subgroup `G`
595
of the symmetric group `S_{16}`. Then the set of all facets
596
is the `G`-orbit of the two given facets. This is implemented
597
here by explicitly listing all of the facets; the facets
598
can be computed by the function :func:`facets_for_RP4`, but
599
running the function takes a few seconds.
600
601
For `n > 4`, the construction is as follows: let `S` denote
602
the simplicial complex structure on the `n`-sphere given by
603
the first barycentric subdivision of the boundary of an
604
`(n+1)`-simplex. This has a simplicial antipodal action: if
605
`V` denotes the vertices in the boundary of the simplex, then
606
the vertices in its barycentric subdivision `S` correspond to
607
nonempty proper subsets `U` of `V`, and the antipodal action
608
sends any subset `U` to its complement. One can show that
609
modding out by this action results in a triangulation for
610
`\Bold{R}P^n`. To find the facets in this triangulation, find
611
the facets in `S`. These are indentified in pairs to form
612
`\Bold{R}P^n`, so choose a representative from each pair: for
613
each facet in `S`, replace any vertex in `S` containing 0 with
614
its complement.
615
616
Of course these complexes increase in size pretty quickly as
617
`n` increases.
618
619
REFERENCES:
620
621
.. [Da2007] Basudeb Datta, "Minimal triangulations of manifolds",
622
J. Indian Inst. Sci. 87 (2007), no. 4, 429-449.
623
624
.. [Ku1987] W. Kühnel, "Minimal triangulations of Kummer varieties",
625
Abh. Math. Sem. Univ. Hamburg 57 (1987), 7-20.
626
627
.. [Lu2005] Frank H. Lutz, "Triangulated Manifolds with Few Vertices:
628
Combinatorial Manifolds", preprint (2005),
629
arXiv:math/0506372.
630
631
.. [Wa1970] David W. Walkup, "The lower bound conjecture for 3- and
632
4-manifolds", Acta Math. 125 (1970), 75-107.
633
634
EXAMPLES::
635
636
sage: P3 = simplicial_complexes.RealProjectiveSpace(3)
637
sage: P3.f_vector()
638
[1, 11, 51, 80, 40]
639
sage: P3.homology()
640
{0: 0, 1: C2, 2: 0, 3: Z}
641
sage: P4 = simplicial_complexes.RealProjectiveSpace(4)
642
sage: P4.f_vector()
643
[1, 16, 120, 330, 375, 150]
644
sage: P4.homology() # long time
645
{0: 0, 1: C2, 2: 0, 3: C2, 4: 0}
646
sage: P5 = simplicial_complexes.RealProjectiveSpace(5) # long time (44s on sage.math, 2012)
647
sage: P5.f_vector() # long time
648
[1, 63, 903, 4200, 8400, 7560, 2520]
649
650
The following computation can take a long time -- over half an
651
hour -- with Sage's default computation of homology groups,
652
but if you have CHomP installed, Sage will use that and the
653
computation should only take a second or two. (You can
654
download CHomP from http://chomp.rutgers.edu/, or you can
655
install it as a Sage package using ``sage -i chomp``). ::
656
657
sage: P5.homology() # long time # optional - CHomP
658
{0: 0, 1: C2, 2: 0, 3: C2, 4: 0, 5: Z}
659
sage: simplicial_complexes.RealProjectiveSpace(2).dimension()
660
2
661
sage: P3.dimension()
662
3
663
sage: P4.dimension() # long time
664
4
665
sage: P5.dimension() # long time
666
5
667
"""
668
if n == 0:
669
return self.Simplex(0)
670
if n == 1:
671
return self.Sphere(1)
672
if n == 2:
673
return self.RealProjectivePlane()
674
if n == 3:
675
# Minimal triangulation found by Walkup and given
676
# explicitly by Lutz
677
return SimplicialComplex(
678
[[1, 2, 3, 7], [1, 4, 7, 9], [2, 3, 4, 8], [2, 5, 8, 10],
679
[3, 6, 7, 10], [1, 2, 3, 11], [1, 4, 7, 10], [2, 3, 4, 11],
680
[2, 5, 9, 10], [3, 6, 8, 9], [1, 2, 6, 9], [1, 4, 8, 9],
681
[2, 3, 7, 8], [2, 6, 9, 10], [3, 6, 9, 10], [1, 2, 6, 11],
682
[1, 4, 8, 10], [2, 4, 6, 10], [3, 4, 5, 9], [4, 5, 6, 7],
683
[1, 2, 7, 9], [1, 5, 6, 8], [2, 4, 6, 11], [3, 4, 5, 11],
684
[4, 5, 6, 11], [1, 3, 5, 10], [1, 5, 6, 11], [2, 4, 8, 10],
685
[3, 4, 8, 9], [4, 5, 7, 9], [1, 3, 5, 11], [1, 5, 8, 10],
686
[2, 5, 7, 8], [3, 5, 9, 10], [4, 6, 7, 10], [1, 3, 7, 10],
687
[1, 6, 8, 9], [2, 5, 7, 9], [3, 6, 7, 8], [5, 6, 7, 8]],
688
is_mutable=False)
689
if n == 4:
690
return SimplicialComplex(
691
[(1, 3, 8, 12, 13), (2, 7, 8, 13, 16), (4, 8, 9, 12, 14),
692
(2, 6, 10, 12, 16), (5, 7, 9, 10, 13), (1, 2, 7, 8, 15),
693
(1, 3, 9, 11, 16), (5, 6, 8, 13, 16), (1, 3, 8, 11, 13),
694
(3, 4, 10, 13, 15), (4, 6, 9, 12, 15), (2, 4, 6, 11, 13),
695
(2, 3, 9, 12, 16), (1, 6, 9, 12, 15), (2, 5, 10, 11, 12),
696
(1, 7, 8, 12, 15), (2, 6, 9, 13, 16), (1, 5, 9, 11, 15),
697
(4, 9, 10, 13, 14), (2, 7, 8, 15, 16), (2, 3, 9, 12, 14),
698
(1, 6, 7, 10, 14), (2, 5, 10, 11, 15), (1, 2, 4, 13, 14),
699
(1, 6, 10, 14, 16), (2, 6, 9, 12, 16), (1, 3, 9, 12, 16),
700
(4, 5, 7, 11, 16), (5, 9, 10, 11, 15), (3, 5, 8, 12, 14),
701
(5, 6, 9, 13, 16), (5, 6, 9, 13, 15), (1, 3, 4, 10, 16),
702
(1, 6, 10, 12, 16), (2, 4, 6, 9, 13), (2, 4, 6, 9, 12),
703
(1, 2, 4, 11, 13), (7, 9, 10, 13, 14), (1, 7, 8, 12, 13),
704
(4, 6, 7, 11, 12), (3, 4, 6, 11, 13), (1, 5, 6, 9, 15),
705
(1, 6, 7, 14, 15), (2, 3, 7, 14, 15), (2, 6, 10, 11, 12),
706
(5, 7, 9, 10, 11), (1, 2, 4, 5, 14), (3, 5, 10, 13, 15),
707
(3, 8, 9, 12, 14), (5, 9, 10, 13, 15), (2, 6, 8, 13, 16),
708
(1, 2, 7, 13, 14), (1, 7, 10, 12, 13), (3, 4, 6, 13, 15),
709
(4, 9, 10, 13, 15), (2, 3, 10, 12, 16), (1, 2, 5, 14, 15),
710
(2, 6, 8, 10, 11), (1, 3, 10, 12, 13), (4, 8, 9, 12, 15),
711
(1, 3, 8, 9, 11), (4, 6, 7, 12, 15), (1, 8, 9, 11, 15),
712
(4, 5, 8, 14, 16), (1, 2, 8, 11, 13), (3, 6, 8, 11, 13),
713
(3, 6, 8, 11, 14), (3, 5, 8, 12, 13), (3, 7, 9, 11, 14),
714
(4, 6, 9, 13, 15), (2, 3, 5, 10, 12), (4, 7, 8, 15, 16),
715
(1, 2, 7, 14, 15), (3, 7, 9, 11, 16), (3, 6, 7, 14, 15),
716
(2, 6, 8, 11, 13), (4, 8, 9, 10, 14), (1, 4, 10, 13, 14),
717
(4, 8, 9, 10, 15), (2, 7, 9, 13, 16), (1, 6, 9, 12, 16),
718
(2, 3, 7, 9, 14), (4, 8, 10, 15, 16), (1, 5, 9, 11, 16),
719
(1, 5, 6, 14, 15), (5, 7, 9, 11, 16), (4, 5, 7, 11, 12),
720
(5, 7, 10, 11, 12), (2, 3, 10, 15, 16), (1, 2, 7, 8, 13),
721
(1, 6, 7, 10, 12), (1, 3, 10, 12, 16), (7, 9, 10, 11, 14),
722
(1, 7, 10, 13, 14), (1, 2, 4, 5, 11), (3, 4, 6, 7, 11),
723
(1, 6, 7, 12, 15), (1, 3, 4, 10, 13), (1, 4, 10, 14, 16),
724
(2, 4, 6, 11, 12), (5, 6, 8, 14, 16), (3, 5, 6, 8, 13),
725
(3, 5, 6, 8, 14), (1, 2, 8, 11, 15), (1, 4, 5, 14, 16),
726
(2, 3, 7, 15, 16), (8, 9, 10, 11, 14), (1, 3, 4, 11, 16),
727
(6, 8, 10, 14, 16), (8, 9, 10, 11, 15), (1, 3, 4, 11, 13),
728
(2, 4, 5, 12, 14), (2, 4, 9, 13, 14), (3, 4, 7, 11, 16),
729
(3, 6, 7, 11, 14), (3, 8, 9, 11, 14), (2, 8, 10, 11, 15),
730
(1, 3, 8, 9, 12), (4, 5, 7, 8, 16), (4, 5, 8, 12, 14),
731
(2, 4, 9, 12, 14), (6, 8, 10, 11, 14), (3, 5, 6, 13, 15),
732
(1, 4, 5, 11, 16), (3, 5, 6, 14, 15), (2, 4, 5, 11, 12),
733
(4, 5, 7, 8, 12), (1, 8, 9, 12, 15), (5, 7, 8, 13, 16),
734
(2, 3, 5, 12, 14), (3, 5, 10, 12, 13), (6, 7, 10, 11, 12),
735
(5, 7, 9, 13, 16), (6, 7, 10, 11, 14), (5, 7, 10, 12, 13),
736
(1, 2, 5, 11, 15), (1, 5, 6, 9, 16), (5, 7, 8, 12, 13),
737
(4, 7, 8, 12, 15), (2, 3, 5, 10, 15), (2, 6, 8, 10, 16),
738
(3, 4, 10, 15, 16), (1, 5, 6, 14, 16), (2, 3, 5, 14, 15),
739
(2, 3, 7, 9, 16), (2, 7, 9, 13, 14), (3, 4, 6, 7, 15),
740
(4, 8, 10, 14, 16), (3, 4, 7, 15, 16), (2, 8, 10, 15, 16)],
741
is_mutable=False)
742
if n >= 5:
743
# Use the construction given by Datta in Example 3.21.
744
V = set(range(0, n+2))
745
S = simplicial_complexes.Sphere(n).barycentric_subdivision()
746
X = S.facets()
747
facets = set([])
748
for f in X:
749
new = []
750
for v in f:
751
if 0 in v:
752
new.append(tuple(V.difference(v)))
753
else:
754
new.append(v)
755
facets.add(tuple(new))
756
return SimplicialComplex(list(facets), is_mutable=False)
757
758
def K3Surface(self):
759
"""
760
Returns a minimal triangulation of the K3 surface.
761
762
This is a pure simplicial complex of dimension 4 with 16 vertices
763
and 288 facets. It was constructed by Casella and Kühnel
764
in [CK2001]_. The construction here uses the labeling from
765
Spreer and Kühnel [SK2011]_.
766
767
REFERENCES:
768
769
.. [CK2001] M. Casella and W. Kühnel, "A triangulated K3 surface
770
with the minimum number of vertices", Topology 40 (2001),
771
753–772.
772
773
.. [SK2011] J. Spreer and W. Kühnel, "Combinatorial properties
774
of the K3 surface: Simplicial blowups and slicings", Experimental
775
Mathematics, Volume 20, Issue 2, 2011.
776
777
EXAMPLES::
778
779
sage: K3=simplicial_complexes.K3Surface() ; K3
780
Simplicial complex with 16 vertices and 288 facets
781
sage: K3.f_vector()
782
[1, 16, 120, 560, 720, 288]
783
784
This simplicial complex is implemented just by listing all 288
785
facets. The list of facets can be computed by the function
786
:func:`facets_for_K3`, but running the function takes a few
787
seconds.
788
"""
789
return SimplicialComplex(
790
[(2, 10, 13, 15, 16), (2, 8, 11, 15, 16), (2, 5, 7, 8, 10),
791
(1, 9, 11, 13, 14), (1, 2, 8, 10, 12), (1, 3, 5, 6, 11),
792
(1, 5, 6, 9, 12), (1, 2, 6, 13, 16), (1, 4, 10, 13, 14),
793
(1, 9, 10, 14, 15), (2, 4, 7, 8, 12), (3, 4, 6, 10, 12),
794
(1, 6, 7, 8, 9), (3, 4, 5, 7, 15), (1, 7, 12, 15, 16),
795
(4, 5, 7, 13, 16), (5, 8, 11, 12, 15), (2, 4, 7, 12, 14),
796
(1, 4, 5, 14, 16), (2, 5, 6, 10, 11), (1, 6, 8, 12, 14),
797
(5, 8, 9, 14, 16), (5, 10, 11, 12, 13), (2, 4, 8, 9, 12),
798
(7, 9, 12, 15, 16), (1, 2, 6, 9, 15), (1, 5, 14, 15, 16),
799
(2, 3, 4, 5, 9), (6, 8, 10, 11, 15), (1, 5, 8, 10, 12),
800
(1, 3, 7, 9, 10), (6, 7, 8, 9, 13), (1, 2, 9, 11, 15),
801
(2, 8, 11, 14, 16), (2, 4, 5, 13, 16), (1, 4, 8, 13, 15),
802
(4, 7, 8, 10, 11), (2, 3, 9, 11, 14), (2, 3, 4, 9, 13),
803
(2, 8, 10, 12, 13), (1, 2, 4, 11, 15), (2, 3, 9, 11, 15),
804
(3, 5, 10, 13, 15), (3, 4, 5, 9, 11), (6, 10, 13, 15, 16),
805
(8, 10, 11, 15, 16), (6, 7, 11, 13, 15), (1, 5, 7, 15, 16),
806
(4, 5, 7, 9, 15), (3, 4, 6, 7, 16), (2, 3, 11, 14, 16),
807
(3, 4, 9, 11, 13), (1, 2, 5, 14, 15), (2, 3, 9, 13, 14),
808
(1, 2, 5, 13, 16), (2, 3, 7, 8, 12), (2, 9, 11, 12, 14),
809
(1, 9, 11, 15, 16), (4, 6, 9, 14, 16), (1, 4, 9, 13, 14),
810
(1, 2, 3, 12, 16), (8, 11, 12, 14, 15), (2, 4, 11, 12, 14),
811
(1, 4, 10, 12, 13), (1, 2, 6, 7, 13), (1, 3, 6, 10, 11),
812
(1, 6, 8, 9, 12), (1, 4, 5, 6, 14), (3, 9, 10, 12, 15),
813
(5, 8, 11, 12, 16), (5, 9, 10, 14, 15), (3, 9, 12, 15, 16),
814
(3, 6, 8, 14, 15), (2, 4, 9, 10, 16), (5, 8, 9, 13, 15),
815
(2, 3, 6, 9, 15), (6, 11, 12, 14, 16), (2, 3, 10, 13, 15),
816
(2, 8, 9, 10, 13), (3, 4, 8, 11, 13), (3, 4, 5, 7, 13),
817
(5, 7, 8, 10, 14), (4, 12, 13, 14, 15), (6, 7, 10, 14, 16),
818
(5, 10, 11, 13, 14), (3, 4, 7, 13, 16), (6, 8, 9, 12, 13),
819
(1, 3, 4, 10, 14), (2, 4, 6, 11, 12), (1, 7, 9, 10, 14),
820
(4, 6, 8, 13, 14), (4, 9, 10, 11, 16), (3, 7, 8, 10, 16),
821
(5, 7, 9, 15, 16), (1, 7, 9, 11, 14), (6, 8, 10, 15, 16),
822
(5, 8, 9, 10, 14), (7, 8, 10, 14, 16), (2, 6, 7, 9, 11),
823
(7, 9, 10, 13, 15), (3, 6, 7, 10, 12), (2, 4, 6, 10, 11),
824
(4, 5, 8, 9, 11), (1, 2, 3, 8, 16), (3, 7, 9, 10, 12),
825
(1, 2, 6, 8, 14), (3, 5, 6, 13, 15), (1, 5, 6, 12, 14),
826
(2, 5, 7, 14, 15), (1, 5, 10, 11, 12), (3, 7, 8, 10, 11),
827
(1, 2, 6, 14, 15), (1, 2, 6, 8, 16), (7, 9, 10, 12, 15),
828
(3, 4, 6, 8, 14), (3, 7, 13, 14, 16), (2, 5, 7, 8, 14),
829
(6, 7, 9, 10, 14), (2, 3, 7, 12, 14), (4, 10, 12, 13, 14),
830
(2, 5, 6, 11, 13), (4, 5, 6, 7, 16), (1, 3, 12, 13, 16),
831
(1, 4, 11, 15, 16), (1, 3, 4, 6, 10), (1, 10, 11, 12, 13),
832
(6, 9, 11, 12, 14), (1, 4, 7, 8, 15), (5, 8, 9, 10, 13),
833
(1, 2, 5, 7, 15), (1, 7, 12, 13, 16), (3, 11, 13, 14, 16),
834
(1, 2, 5, 7, 13), (4, 7, 8, 9, 15), (1, 5, 6, 10, 11),
835
(6, 7, 10, 13, 15), (3, 4, 7, 14, 15), (7, 11, 13, 14, 16),
836
(3, 4, 10, 12, 14), (3, 6, 8, 10, 16), (2, 7, 8, 14, 16),
837
(2, 3, 4, 5, 13), (5, 8, 12, 13, 15), (4, 6, 9, 13, 14),
838
(2, 4, 5, 6, 12), (1, 3, 7, 8, 9), (8, 11, 12, 14, 16),
839
(1, 7, 12, 13, 15), (8, 12, 13, 14, 15), (2, 8, 9, 12, 13),
840
(4, 6, 10, 12, 15), (2, 8, 11, 14, 15), (2, 6, 9, 11, 12),
841
(8, 9, 10, 11, 16), (2, 3, 6, 13, 15), (2, 3, 12, 15, 16),
842
(1, 3, 5, 9, 12), (2, 5, 6, 9, 12), (2, 10, 12, 13, 14),
843
(2, 6, 13, 15, 16), (2, 3, 11, 15, 16), (3, 5, 6, 8, 15),
844
(2, 4, 5, 9, 12), (5, 6, 8, 11, 15), (6, 8, 12, 13, 14),
845
(1, 2, 3, 8, 12), (1, 4, 7, 8, 11), (3, 5, 7, 14, 15),
846
(3, 5, 7, 13, 14), (1, 7, 10, 11, 14), (6, 7, 11, 12, 15),
847
(3, 4, 6, 7, 12), (1, 2, 4, 7, 11), (6, 9, 10, 14, 16),
848
(4, 10, 12, 15, 16), (5, 6, 7, 12, 16), (3, 9, 11, 13, 14),
849
(5, 9, 14, 15, 16), (4, 5, 6, 7, 12), (1, 3, 9, 10, 15),
850
(4, 7, 8, 9, 12), (5, 9, 10, 13, 15), (1, 3, 8, 13, 16),
851
(2, 9, 12, 13, 14), (6, 7, 10, 12, 15), (2, 6, 8, 14, 15),
852
(3, 5, 6, 8, 11), (3, 4, 7, 12, 14), (1, 3, 10, 14, 15),
853
(7, 11, 12, 13, 16), (3, 11, 12, 13, 16), (3, 4, 5, 8, 15),
854
(2, 4, 7, 8, 10), (2, 4, 7, 14, 15), (1, 2, 10, 12, 16),
855
(1, 6, 8, 13, 16), (1, 7, 8, 13, 15), (3, 9, 11, 15, 16),
856
(4, 6, 10, 11, 15), (2, 4, 11, 14, 15), (1, 3, 8, 9, 12),
857
(1, 3, 6, 14, 15), (2, 4, 5, 6, 10), (1, 4, 9, 14, 16),
858
(5, 7, 9, 12, 16), (1, 3, 7, 10, 11), (7, 8, 9, 13, 15),
859
(3, 5, 10, 14, 15), (1, 4, 10, 12, 16), (3, 4, 5, 8, 11),
860
(1, 2, 6, 7, 9), (1, 3, 11, 12, 13), (1, 5, 7, 13, 16),
861
(5, 7, 10, 11, 14), (2, 10, 12, 15, 16), (3, 6, 7, 10, 16),
862
(1, 2, 5, 8, 10), (4, 10, 11, 15, 16), (5, 8, 10, 12, 13),
863
(3, 6, 8, 10, 11), (4, 5, 7, 9, 12), (6, 7, 11, 12, 16),
864
(3, 5, 9, 11, 16), (8, 9, 10, 14, 16), (3, 4, 6, 8, 16),
865
(1, 10, 11, 13, 14), (2, 9, 10, 13, 16), (1, 2, 5, 8, 14),
866
(2, 4, 5, 10, 16), (1, 2, 7, 9, 11), (1, 3, 5, 6, 9),
867
(5, 7, 11, 13, 14), (3, 5, 10, 13, 14), (2, 4, 8, 9, 10),
868
(4, 11, 12, 14, 15), (2, 3, 7, 14, 16), (3, 4, 8, 13, 16),
869
(6, 7, 9, 11, 14), (5, 6, 11, 13, 15), (4, 5, 6, 14, 16),
870
(3, 4, 8, 14, 15), (4, 5, 8, 9, 15), (1, 4, 8, 11, 13),
871
(5, 6, 12, 14, 16), (2, 3, 10, 12, 14), (1, 2, 5, 10, 16),
872
(2, 5, 7, 10, 11), (2, 6, 7, 11, 13), (1, 4, 5, 10, 16),
873
(2, 6, 8, 15, 16), (2, 3, 10, 12, 15), (7, 11, 12, 13, 15),
874
(1, 3, 8, 11, 13), (4, 8, 9, 10, 11), (1, 9, 14, 15, 16),
875
(1, 3, 6, 9, 15), (6, 9, 12, 13, 14), (2, 3, 10, 13, 14),
876
(2, 5, 7, 11, 13), (2, 3, 5, 6, 13), (4, 6, 8, 13, 16),
877
(6, 7, 9, 10, 13), (5, 8, 12, 14, 16), (4, 6, 9, 13, 16),
878
(5, 8, 9, 11, 16), (2, 3, 5, 6, 9), (1, 3, 5, 11, 12),
879
(3, 7, 8, 9, 12), (4, 6, 11, 12, 15), (3, 5, 9, 12, 16),
880
(5, 11, 12, 13, 15), (1, 3, 4, 6, 14), (3, 5, 11, 12, 16),
881
(1, 5, 8, 12, 14), (4, 8, 13, 14, 15), (1, 3, 7, 8, 11),
882
(6, 9, 10, 13, 16), (2, 4, 9, 13, 16), (1, 6, 7, 8, 13),
883
(1, 4, 12, 13, 15), (2, 4, 7, 10, 11), (1, 4, 9, 11, 13),
884
(6, 7, 11, 14, 16), (1, 4, 9, 11, 16), (1, 4, 12, 15, 16),
885
(1, 2, 4, 7, 15), (2, 3, 7, 8, 16), (1, 4, 5, 6, 10)],
886
is_mutable=False)
887
888
def BarnetteSphere(self):
889
r"""
890
Returns Barnette's triangulation of the 3-sphere.
891
892
This is a pure simplicial complex of dimension 3 with 8
893
vertices and 19 facets, which is a non-polytopal triangulation
894
of the 3-sphere. It was constructed by Barnette in
895
[B1970]_. The construction here uses the labeling from De
896
Loera, Rambau and Santos [DLRS2010]_. Another reference is chapter
897
III.4 of Ewald [E1996]_.
898
899
EXAMPLES::
900
901
sage: BS = simplicial_complexes.BarnetteSphere() ; BS
902
Simplicial complex with vertex set (1, 2, 3, 4, 5, 6, 7, 8) and 19 facets
903
sage: BS.f_vector()
904
[1, 8, 27, 38, 19]
905
906
TESTS:
907
908
Checks that this is indeed the same Barnette Sphere as the one
909
given on page 87 of [E1996]_.::
910
911
sage: BS2 = SimplicialComplex([[1,2,3,4],[3,4,5,6],[1,2,5,6],
912
... [1,2,4,7],[1,3,4,7],[3,4,6,7],
913
... [3,5,6,7],[1,2,5,7],[2,5,6,7],
914
... [2,4,6,7],[1,2,3,8],[2,3,4,8],
915
... [3,4,5,8],[4,5,6,8],[1,2,6,8],
916
... [1,5,6,8],[1,3,5,8],[2,4,6,8],
917
... [1,3,5,7]])
918
sage: BS.is_isomorphic(BS2)
919
True
920
921
REFERENCES:
922
923
.. [B1970] Barnette, "Diagrams and Schlegel diagrams", in
924
Combinatorial Structures and Their Applications, Proc. Calgary
925
Internat. Conference 1969, New York, 1970, Gordon and Breach.
926
927
.. [DLRS2010] De Loera, Rambau and Santos, "Triangulations:
928
Structures for Algorithms and Applications", Algorithms and
929
Computation in Mathematics, Volume 25, Springer, 2011.
930
931
.. [E1996] Ewald, "Combinatorial Convexity and Algebraic Geometry",
932
vol. 168 of Graduate Texts in Mathematics, Springer, 1996
933
934
"""
935
return SimplicialComplex([
936
(1,2,4,5),(2,3,5,6),(1,3,4,6),(1,2,3,7),(4,5,6,7),(1,2,4,7),
937
(2,4,5,7),(2,3,5,7),(3,5,6,7),(3,1,6,7),(1,6,4,7),(1,2,3,8),
938
(4,5,6,8),(1,2,5,8),(1,4,5,8),(2,3,6,8),(2,5,6,8),(3,1,4,8),
939
(3,6,4,8)])
940
941
def BrucknerGrunbaumSphere(self):
942
r"""
943
Returns Bruckner and Grunbaum's triangulation of the 3-sphere.
944
945
This is a pure simplicial complex of dimension 3 with 8
946
vertices and 20 facets, which is a non-polytopal triangulation
947
of the 3-sphere. It appeared first in [Br1910]_ and was studied in
948
[GrS1967]_.
949
950
It is defined here as the link of any vertex in the unique minimal
951
triangulation of the complex projective plane, see chapter 4 of
952
[Ku1995]_.
953
954
EXAMPLES::
955
956
sage: BGS = simplicial_complexes.BrucknerGrunbaumSphere() ; BGS
957
Simplicial complex with vertex set (1, 2, 3, 4, 5, 6, 7, 8) and 20 facets
958
sage: BGS.f_vector()
959
[1, 8, 28, 40, 20]
960
961
REFERENCES:
962
963
.. [Br1910] Bruckner, "Uber die Ableitung der allgemeinen
964
Polytope und die nach Isomorphismus verschiedenen Typen der
965
allgemeinen Achtzelle (Oktatope)", Verhand. Konik. Akad. Wetenschap,
966
Erste Sectie, 10 (1910)
967
968
.. [GrS1967] Grunbaum and Sreedharan, "An enumeration of simplicial
969
4-polytopes with 8 vertices", J. Comb. Th. 2, 437-465 (1967)
970
971
.. [Ku1995] Kuhnel, "Tight Polyhedral Submanifolds and Tight Triangulations"
972
Lecture Notes in Mathematics Volume 1612, 1995
973
"""
974
return simplicial_complexes.ComplexProjectivePlane().link([9])
975
976
###############################################################
977
# examples from graph theory:
978
979
def NotIConnectedGraphs(self, n, i):
980
"""
981
The simplicial complex of all graphs on `n` vertices which are
982
not `i`-connected.
983
984
Fix an integer `n>0` and consider the set of graphs on `n`
985
vertices. View each graph as its set of edges, so it is a
986
subset of a set of size `n` choose 2. A graph is
987
`i`-connected if, for any `j<i`, if any `j` vertices are
988
removed along with the edges emanating from them, then the
989
graph remains connected. Now fix `i`: it is clear that if `G`
990
is not `i`-connected, then the same is true for any graph
991
obtained from `G` by deleting edges. Thus the set of all
992
graphs which are not `i`-connected, viewed as a set of subsets
993
of the `n` choose 2 possible edges, is closed under taking
994
subsets, and thus forms a simplicial complex. This function
995
produces that simplicial complex.
996
997
INPUT:
998
999
- ``n``, ``i`` -- non-negative integers with `i` at most `n`
1000
1001
See Dumas et al. [DHSW2003]_ for information on computing its homology
1002
by computer, and see Babson et al. [BBLSW1999]_ for theory. For
1003
example, Babson et al. show that when `i=2`, the reduced homology of
1004
this complex is nonzero only in dimension `2n-5`, where it is
1005
free abelian of rank `(n-2)!`.
1006
1007
EXAMPLES::
1008
1009
sage: simplicial_complexes.NotIConnectedGraphs(5,2).f_vector()
1010
[1, 10, 45, 120, 210, 240, 140, 20]
1011
sage: simplicial_complexes.NotIConnectedGraphs(5,2).homology(5).ngens()
1012
6
1013
1014
REFERENCES:
1015
1016
.. [BBLSW1999] Babson, Bjorner, Linusson, Shareshian, and Welker,
1017
"Complexes of not i-connected graphs," Topology 38 (1999),
1018
271-299
1019
1020
.. [DHSW2003] Dumas, Heckenbach, Saunders, Welker, "Computing simplicial
1021
homology based on efficient Smith normal form algorithms,"
1022
in "Algebra, geometry, and software systems" (2003),
1023
177-206.
1024
"""
1025
G_list = range(1,n+1)
1026
G_vertices = Set(G_list)
1027
E_list = []
1028
for w in G_list:
1029
for v in range(1,w):
1030
E_list.append((v,w))
1031
E = Set(E_list)
1032
facets = []
1033
i_minus_one_sets = list(G_vertices.subsets(size=i-1))
1034
for A in i_minus_one_sets:
1035
G_minus_A = G_vertices.difference(A)
1036
for B in G_minus_A.subsets():
1037
if len(B) > 0 and len(B) < len(G_minus_A):
1038
C = G_minus_A.difference(B)
1039
facet = E
1040
for v in B:
1041
for w in C:
1042
bad_edge = (min(v,w), max(v,w))
1043
facet = facet.difference(Set([bad_edge]))
1044
facets.append(facet)
1045
return SimplicialComplex(facets, is_mutable=False)
1046
1047
def MatchingComplex(self, n):
1048
"""
1049
The matching complex of graphs on `n` vertices.
1050
1051
Fix an integer `n>0` and consider a set `V` of `n` vertices.
1052
A 'partial matching' on `V` is a graph formed by edges so that
1053
each vertex is in at most one edge. If `G` is a partial
1054
matching, then so is any graph obtained by deleting edges from
1055
`G`. Thus the set of all partial matchings on `n` vertices,
1056
viewed as a set of subsets of the `n` choose 2 possible edges,
1057
is closed under taking subsets, and thus forms a simplicial
1058
complex called the 'matching complex'. This function produces
1059
that simplicial complex.
1060
1061
INPUT:
1062
1063
- ``n`` -- positive integer.
1064
1065
See Dumas et al. [DHSW2003]_ for information on computing its homology
1066
by computer, and see Wachs [Wa2003]_ for an expository article about
1067
the theory. For example, the homology of these complexes seems to
1068
have only mod 3 torsion, and this has been proved for the
1069
bottom non-vanishing homology group for the matching complex `M_n`.
1070
1071
EXAMPLES::
1072
1073
sage: M = simplicial_complexes.MatchingComplex(7)
1074
sage: H = M.homology()
1075
sage: H
1076
{0: 0, 1: C3, 2: Z^20}
1077
sage: H[2].ngens()
1078
20
1079
sage: simplicial_complexes.MatchingComplex(8).homology(2) # long time (6s on sage.math, 2012)
1080
Z^132
1081
1082
REFERENCES:
1083
1084
.. [Wa2003] Wachs, "Topology of Matching, Chessboard and General Bounded
1085
Degree Graph Complexes" (Algebra Universalis Special Issue
1086
in Memory of Gian-Carlo Rota, Algebra Universalis, 49 (2003)
1087
345-385)
1088
"""
1089
G_vertices = Set(range(1,n+1))
1090
facets = []
1091
if is_even(n):
1092
half = int(n/2)
1093
half_n_sets = list(G_vertices.subsets(size=half))
1094
else:
1095
half = int((n-1)/2)
1096
half_n_sets = list(G_vertices.subsets(size=half))
1097
for X in half_n_sets:
1098
Xcomp = G_vertices.difference(X)
1099
if is_even(n):
1100
if 1 in X:
1101
A = X
1102
B = Xcomp
1103
else:
1104
A = Xcomp
1105
B = X
1106
for M in matching(A, B):
1107
facet = []
1108
for pair in M:
1109
facet.append(tuple(sorted(pair)))
1110
facets.append(facet)
1111
else:
1112
for w in Xcomp:
1113
if 1 in X or (w == 1 and 2 in X):
1114
A = X
1115
B = Xcomp.difference([w])
1116
else:
1117
B = X
1118
A = Xcomp.difference([w])
1119
for M in matching(A, B):
1120
facet = []
1121
for pair in M:
1122
facet.append(tuple(sorted(pair)))
1123
facets.append(facet)
1124
return SimplicialComplex(facets, is_mutable=False)
1125
1126
def ChessboardComplex(self, n, i):
1127
r"""
1128
The chessboard complex for an `n \times i` chessboard.
1129
1130
Fix integers `n, i > 0` and consider sets `V` of `n` vertices
1131
and `W` of `i` vertices. A 'partial matching' between `V` and
1132
`W` is a graph formed by edges `(v,w)` with `v \in V` and `w
1133
\in W` so that each vertex is in at most one edge. If `G` is
1134
a partial matching, then so is any graph obtained by deleting
1135
edges from `G`. Thus the set of all partial matchings on `V`
1136
and `W`, viewed as a set of subsets of the `n+i` choose 2
1137
possible edges, is closed under taking subsets, and thus forms
1138
a simplicial complex called the 'chessboard complex'. This
1139
function produces that simplicial complex. (It is called the
1140
chessboard complex because such graphs also correspond to ways
1141
of placing rooks on an `n` by `i` chessboard so that none of
1142
them are attacking each other.)
1143
1144
INPUT:
1145
1146
- ``n, i`` -- positive integers.
1147
1148
See Dumas et al. [DHSW2003]_ for information on computing its homology
1149
by computer, and see Wachs [Wa2003]_ for an expository article about
1150
the theory.
1151
1152
EXAMPLES::
1153
1154
sage: C = simplicial_complexes.ChessboardComplex(5,5)
1155
sage: C.f_vector()
1156
[1, 25, 200, 600, 600, 120]
1157
sage: simplicial_complexes.ChessboardComplex(3,3).homology()
1158
{0: 0, 1: Z x Z x Z x Z, 2: 0}
1159
"""
1160
A = range(n)
1161
B = range(i)
1162
E_dict = {}
1163
index = 0
1164
for v in A:
1165
for w in B:
1166
E_dict[(v,w)] = index
1167
index += 1
1168
facets = []
1169
for M in matching(A, B):
1170
facet = []
1171
for pair in M:
1172
facet.append(E_dict[pair])
1173
facets.append(facet)
1174
return SimplicialComplex(facets, is_mutable=False)
1175
1176
def RandomComplex(self, n, d, p=0.5):
1177
"""
1178
A random ``d``-dimensional simplicial complex on ``n`` vertices.
1179
1180
INPUT:
1181
1182
- ``n`` -- number of vertices
1183
1184
- ``d`` -- dimension of the complex
1185
1186
- ``p`` -- floating point number between 0 and 1
1187
(optional, default 0.5)
1188
1189
A random `d`-dimensional simplicial complex on `n` vertices,
1190
as defined for example by Meshulam and Wallach [MW2009]_, is
1191
constructed as follows: take `n` vertices and include all of
1192
the simplices of dimension strictly less than `d`, and then for each
1193
possible simplex of dimension `d`, include it with probability `p`.
1194
1195
EXAMPLES::
1196
1197
sage: X = simplicial_complexes.RandomComplex(6, 2); X
1198
Simplicial complex with vertex set (0, 1, 2, 3, 4, 5) and 10 facets
1199
sage: len(list(X.vertices()))
1200
6
1201
1202
If `d` is too large (if `d+1 > n`, so that there are no
1203
`d`-dimensional simplices), then return the simplicial complex
1204
with a single `(n+1)`-dimensional simplex::
1205
1206
sage: simplicial_complexes.RandomComplex(6, 12)
1207
Simplicial complex with vertex set (0, 1, 2, 3, 4, 5) and facets {(0, 1, 2, 3, 4, 5)}
1208
1209
REFERENCES:
1210
1211
.. [MW2009] Meshulam and Wallach, "Homological connectivity of random
1212
`k`-dimensional complexes", preprint, math.CO/0609773.
1213
"""
1214
if d+1 > n:
1215
return simplicial_complexes.Simplex(n-1)
1216
else:
1217
vertices = range(n)
1218
facets = Subsets(vertices, d).list()
1219
maybe = Subsets(vertices, d+1)
1220
facets.extend([f for f in maybe if random.random() <= p])
1221
return SimplicialComplex(facets, is_mutable=False)
1222
1223
def SumComplex(self, n, A):
1224
r"""
1225
The sum complexes of Linial, Meshulam, and Rosenthal [LMR2010]_.
1226
1227
If `k+1` is the cardinality of `A`, then this returns a
1228
`k`-dimensional simplicial complex `X_A` with vertices
1229
`\ZZ/(n)`, and facets given by all `k+1`-tuples `(x_0, x_1,
1230
..., x_k)` such that the sum `\sum x_i` is in `A`. See the
1231
paper by Linial, Meshulam, and Rosenthal [LMR2010]_, in which
1232
they prove various results about these complexes; for example,
1233
if `n` is prime, then `X_A` is rationally acyclic, and if in
1234
addition `A` forms an arithmetic progression in `\ZZ/(n)`,
1235
then `X_A` is `\ZZ`-acyclic. Throughout their paper, they
1236
assume that `n` and `k` are relatively prime, but the
1237
construction makes sense in general.
1238
1239
In addition to the results from the cited paper, these
1240
complexes can have large torsion, given the number of
1241
vertices; for example, if `n=10`, and `A=\{0,1,2,3,6\}`, then
1242
`H_3(X_A)` is cyclic of order 2728, and there is a
1243
4-dimensional complex on 13 vertices with `H_3` having a
1244
cyclic summand of order
1245
1246
.. MATH::
1247
1248
706565607945 = 3 \cdot 5 \cdot 53 \cdot 79 \cdot 131
1249
\cdot 157 \cdot 547.
1250
1251
See the examples.
1252
1253
INPUT:
1254
1255
- ``n`` -- a positive integer
1256
1257
- ``A`` -- a subset of `\ZZ/(n)`
1258
1259
REFERENCES:
1260
1261
.. [LMR2010] N. Linial, R. Meshulam and M. Rosenthal, "Sum
1262
complexes -- a new family of hypertrees", Discrete &
1263
Computational Geometry, 2010, Volume 44, Number 3, Pages
1264
622-636
1265
1266
EXAMPLES::
1267
1268
sage: S = simplicial_complexes.SumComplex(10, [0,1,2,3,6]); S
1269
Simplicial complex with 10 vertices and 126 facets
1270
sage: S.homology()
1271
{0: 0, 1: 0, 2: 0, 3: C2728, 4: 0}
1272
sage: factor(2728)
1273
2^3 * 11 * 31
1274
1275
sage: S = simplicial_complexes.SumComplex(11, [0, 1, 3]); S
1276
Simplicial complex with 11 vertices and 45 facets
1277
sage: S.homology(1)
1278
C23
1279
sage: S = simplicial_complexes.SumComplex(11, [0,1,2,3,4,7]); S
1280
Simplicial complex with 11 vertices and 252 facets
1281
sage: S.homology() # long time
1282
{0: 0, 1: 0, 2: 0, 3: 0, 4: C645679, 5: 0}
1283
sage: factor(645679)
1284
23 * 67 * 419
1285
1286
sage: S = simplicial_complexes.SumComplex(13, [0, 1, 3]); S
1287
Simplicial complex with 13 vertices and 66 facets
1288
sage: S.homology(1)
1289
C159
1290
sage: factor(159)
1291
3 * 53
1292
sage: S = simplicial_complexes.SumComplex(13, [0,1,2,5]); S
1293
Simplicial complex with 13 vertices and 220 facets
1294
sage: S.homology() # long time
1295
{0: 0, 1: 0, 2: C146989209, 3: 0}
1296
sage: factor(1648910295)
1297
3^2 * 5 * 53 * 521 * 1327
1298
sage: S = simplicial_complexes.SumComplex(13, [0,1,2,3,5]); S
1299
Simplicial complex with 13 vertices and 495 facets
1300
sage: S.homology() # long time
1301
{0: 0, 1: 0, 2: 0, 3: C3 x C237 x C706565607945, 4: 0}
1302
sage: factor(706565607945)
1303
3 * 5 * 53 * 79 * 131 * 157 * 547
1304
1305
sage: S = simplicial_complexes.SumComplex(17, [0, 1, 4]); S
1306
Simplicial complex with 17 vertices and 120 facets
1307
sage: S.homology(1)
1308
C140183
1309
sage: factor(140183)
1310
103 * 1361
1311
sage: S = simplicial_complexes.SumComplex(19, [0, 1, 4]); S
1312
Simplicial complex with 19 vertices and 153 facets
1313
sage: S.homology(1)
1314
C5670599
1315
sage: factor(5670599)
1316
11 * 191 * 2699
1317
sage: S = simplicial_complexes.SumComplex(31, [0, 1, 4]); S
1318
Simplicial complex with 31 vertices and 435 facets
1319
sage: S.homology(1) # long time
1320
C5 x C5 x C5 x C5 x C26951480558170926865
1321
sage: factor(26951480558170926865)
1322
5 * 311 * 683 * 1117 * 11657 * 1948909
1323
"""
1324
from sage.rings.all import Integers
1325
Zn = Integers(n)
1326
A = frozenset([Zn(x) for x in A])
1327
facets = []
1328
for f in Set(Zn).subsets(len(A)):
1329
if sum(f) in A:
1330
facets.append(tuple(f))
1331
return SimplicialComplex(facets, is_mutable=False)
1332
1333
simplicial_complexes = SimplicialComplexExamples()
1334
1335