# Ticket #13725: trac_13725-sum-complex.patch

File trac_13725-sum-complex.patch, 4.8 KB (added by jhpalmieri, 8 years ago)
• ## sage/homology/examples.py

# HG changeset patch
# User J. H. Palmieri <palmieri@math.washington.edu>
# Date 1353389601 28800
# Node ID be9d638aea733a08a6f633f1b64dbda4e0e361ea
# Parent  d8344ebd368cf78d67f719dcbf10460602863fac
Simplicial complexes: add a new example, 'sum complexes'

diff --git a/sage/homology/examples.py b/sage/homology/examples.py
 a TAB key:: simplicial_complexes.RealProjectiveSpace simplicial_complexes.Simplex simplicial_complexes.Sphere simplicial_complexes.SumComplex simplicial_complexes.SurfaceOfGenus simplicial_complexes.Torus class SimplicialComplexExamples(): - :meth:RealProjectiveSpace - :meth:Simplex - :meth:Sphere - :meth:SumComplex - :meth:SurfaceOfGenus - :meth:Torus class SimplicialComplexExamples(): facets.extend([f for f in maybe if random.random() <= p]) return SimplicialComplex(facets, is_mutable=False) def SumComplex(self, n, A): r""" The sum complexes of Linial, Meshulam, and Rosenthal. INPUT: - n, a positive integer - A, a subset of \ZZ/(n) If k+1 is the cardinality of A, then this returns a k-dimensional simplicial complex X_A with vertices \ZZ/(n), and facets given by all k+1-tuples (x_0, x_1, ..., x_k) such that the sum \sum x_i is in A. See the paper by Linial, Meshulam, and Rosenthal [LMR2010]_, in which they prove various results about these complexes; for example, if n is prime, then X_A is rationally acyclic, and if in addition A forms an arithmetic progression in \ZZ/(n), then X_A is \ZZ-acyclic. Throughout their paper, they assume that n and k are relatively prime, but the construction makes sense in general. In addition to the results from the cited paper, these complexes can have large torsion, given the number of vertices; for example, if n=10, and A=\{0,1,2,3,6\}, then H_3(X_A) is cyclic of order 2728, and there is a 4-dimensional complex on 13 vertices with H_3 having a cyclic summand of order .. math:: 706565607945 = 3 \times 5 \times 53 \times 79 \times 131 \times 157 \times 547. See the examples. REFERENCES: .. [LMR2010] N. Linial, R. Meshulam and M. Rosenthal, "Sum complexes -- a new family of hypertrees", Discrete & Computational Geometry, 2010, Volume 44, Number 3, Pages 622-636 EXAMPLES:: sage: simplicial_complexes.SumComplex(10, [0,1,2,3,6]).homology() {0: 0, 1: 0, 2: 0, 3: C2728, 4: 0} sage: factor(2728) 2^3 * 11 * 31 sage: simplicial_complexes.SumComplex(11, [0, 1, 3]).homology(1) C23 sage: simplicial_complexes.SumComplex(11, [0,1,2,3,4,7]).homology() # long time {0: 0, 1: 0, 2: 0, 3: 0, 4: C645679, 5: 0} sage: factor(645679) 23 * 67 * 419 sage: simplicial_complexes.SumComplex(13, [0, 1, 3]).homology(1) C159 sage: factor(159) 3 * 53 sage: simplicial_complexes.SumComplex(13, [0,1,2,5]).homology() # long time {0: 0, 1: 0, 2: C146989209, 3: 0} sage: factor(1648910295) 3^2 * 5 * 53 * 521 * 1327 sage: simplicial_complexes.SumComplex(13, [0,1,2,3,5]).homology() # long time {0: 0, 1: 0, 2: 0, 3: C3 x C237 x C706565607945, 4: 0} sage: factor(706565607945) 3 * 5 * 53 * 79 * 131 * 157 * 547 sage: simplicial_complexes.SumComplex(17, [0, 1, 4]).homology(1) C140183 sage: factor(140183) 103 * 1361 sage: simplicial_complexes.SumComplex(19, [0, 1, 4]).homology(1) C5670599 sage: factor(5670599) 11 * 191 * 2699 sage: simplicial_complexes.SumComplex(31, [0, 1, 4]).homology(1) # long time C5 x C5 x C5 x C5 x C26951480558170926865 sage: factor(26951480558170926865) 5 * 311 * 683 * 1117 * 11657 * 1948909 """ from sage.rings.all import Integers from sage.sets.set import Set from sage.homology.all import SimplicialComplex Zn = Integers(n) A = frozenset([Zn(x) for x in A]) k = len(A) - 1 facets = [] for f in Set(Zn).subsets(k+1): if sum(f) in A: facets.append(tuple(f)) return SimplicialComplex(facets) simplicial_complexes = SimplicialComplexExamples()