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 b TAB key:: 
    4040   simplicial_complexes.RealProjectiveSpace
    4141   simplicial_complexes.Simplex
    4242   simplicial_complexes.Sphere
     43   simplicial_complexes.SumComplex
    4344   simplicial_complexes.SurfaceOfGenus
    4445   simplicial_complexes.Torus
    4546
    class SimplicialComplexExamples(): 
    170171    - :meth:`RealProjectiveSpace`
    171172    - :meth:`Simplex`
    172173    - :meth:`Sphere`
     174    - :meth:`SumComplex`
    173175    - :meth:`SurfaceOfGenus`
    174176    - :meth:`Torus`
    175177
    class SimplicialComplexExamples(): 
    10631065            facets.extend([f for f in maybe if random.random() <= p])
    10641066            return SimplicialComplex(facets, is_mutable=False)
    10651067
     1068    def SumComplex(self, n, A):
     1069        r"""
     1070        The sum complexes of Linial, Meshulam, and Rosenthal.
     1071
     1072        INPUT:
     1073
     1074        - ``n``, a positive integer
     1075        - ``A``, a subset of `\ZZ/(n)`
     1076
     1077        If `k+1` is the cardinality of `A`, then this returns a
     1078        `k`-dimensional simplicial complex `X_A` with vertices
     1079        `\ZZ/(n)`, and facets given by all `k+1`-tuples `(x_0, x_1,
     1080        ..., x_k)` such that the sum `\sum x_i` is in `A`. See the
     1081        paper by Linial, Meshulam, and Rosenthal [LMR2010]_, in which
     1082        they prove various results about these complexes; for example,
     1083        if `n` is prime, then `X_A` is rationally acyclic, and if in
     1084        addition `A` forms an arithmetic progression in `\ZZ/(n)`,
     1085        then `X_A` is `\ZZ`-acyclic. Throughout their paper, they
     1086        assume that `n` and `k` are relatively prime, but the
     1087        construction makes sense in general.
     1088
     1089        In addition to the results from the cited paper, these
     1090        complexes can have large torsion, given the number of
     1091        vertices; for example, if `n=10`, and `A=\{0,1,2,3,6\}`, then
     1092        `H_3(X_A)` is cyclic of order 2728, and there is a
     1093        4-dimensional complex on 13 vertices with `H_3` having a
     1094        cyclic summand of order
     1095
     1096        .. math::
     1097   
     1098            706565607945 = 3 \times 5 \times 53 \times 79 \times 131
     1099            \times 157 \times 547.
     1100
     1101        See the examples.
     1102
     1103        REFERENCES:
     1104
     1105        .. [LMR2010] N. Linial, R. Meshulam and M. Rosenthal, "Sum
     1106           complexes -- a new family of hypertrees", Discrete &
     1107           Computational Geometry, 2010, Volume 44, Number 3, Pages
     1108           622-636
     1109
     1110        EXAMPLES::
     1111
     1112            sage: simplicial_complexes.SumComplex(10, [0,1,2,3,6]).homology()
     1113            {0: 0, 1: 0, 2: 0, 3: C2728, 4: 0}
     1114            sage: factor(2728)
     1115            2^3 * 11 * 31
     1116
     1117            sage: simplicial_complexes.SumComplex(11, [0, 1, 3]).homology(1)
     1118            C23
     1119            sage: simplicial_complexes.SumComplex(11, [0,1,2,3,4,7]).homology() # long time
     1120            {0: 0, 1: 0, 2: 0, 3: 0, 4: C645679, 5: 0}
     1121            sage: factor(645679)
     1122            23 * 67 * 419
     1123
     1124            sage: simplicial_complexes.SumComplex(13, [0, 1, 3]).homology(1)
     1125            C159
     1126            sage: factor(159)
     1127            3 * 53
     1128            sage: simplicial_complexes.SumComplex(13, [0,1,2,5]).homology() # long time
     1129            {0: 0, 1: 0, 2: C146989209, 3: 0}
     1130            sage: factor(1648910295)
     1131            3^2 * 5 * 53 * 521 * 1327
     1132            sage: simplicial_complexes.SumComplex(13, [0,1,2,3,5]).homology() # long time
     1133            {0: 0, 1: 0, 2: 0, 3: C3 x C237 x C706565607945, 4: 0}
     1134            sage: factor(706565607945)
     1135            3 * 5 * 53 * 79 * 131 * 157 * 547
     1136
     1137            sage: simplicial_complexes.SumComplex(17, [0, 1, 4]).homology(1)
     1138            C140183
     1139            sage: factor(140183)
     1140            103 * 1361
     1141            sage: simplicial_complexes.SumComplex(19, [0, 1, 4]).homology(1)
     1142            C5670599
     1143            sage: factor(5670599)
     1144            11 * 191 * 2699
     1145            sage: simplicial_complexes.SumComplex(31, [0, 1, 4]).homology(1) # long time
     1146            C5 x C5 x C5 x C5 x C26951480558170926865
     1147            sage: factor(26951480558170926865)
     1148            5 * 311 * 683 * 1117 * 11657 * 1948909
     1149        """
     1150        from sage.rings.all import Integers
     1151        from sage.sets.set import Set
     1152        from sage.homology.all import SimplicialComplex
     1153        Zn = Integers(n)
     1154        A = frozenset([Zn(x) for x in A])
     1155        k = len(A) - 1
     1156        facets = []
     1157        for f in Set(Zn).subsets(k+1):
     1158            if sum(f) in A:
     1159                facets.append(tuple(f))
     1160        return SimplicialComplex(facets)
     1161
    10661162simplicial_complexes = SimplicialComplexExamples()