# HG changeset patch
# User Travis Scrimshaw <tscrim@ucdavis.edu>
# Date 1355267723 28800
# Node ID 36fb4e873ecbeecbd8a310857f85f17c955d07c3
# Parent 0e80cec881aba827ace0ef2fc48979ff64280a55
Review patch for #13725.
diff git a/sage/homology/examples.py b/sage/homology/examples.py
a

b

class SimplicialComplexExamples(): 
1064  1064  
1065  1065  def SumComplex(self, n, A): 
1066  1066  r""" 
1067   The sum complexes of Linial, Meshulam, and Rosenthal. 
1068   
1069   INPUT: 
1070   
1071    ``n``, a positive integer 
1072    ``A``, a subset of `\ZZ/(n)` 
 1067  The sum complexes of Linial, Meshulam, and Rosenthal [LMR2010]_. 
1073  1068  
1074  1069  If `k+1` is the cardinality of `A`, then this returns a 
1075  1070  `k`dimensional simplicial complex `X_A` with vertices 
… 
… 
class SimplicialComplexExamples(): 
1090  1085  4dimensional complex on 13 vertices with `H_3` having a 
1091  1086  cyclic summand of order 
1092  1087  
1093   .. math:: 
 1088  .. MATH:: 
1094  1089  
1095   706565607945 = 3 \times 5 \times 53 \times 79 \times 131 
1096   \times 157 \times 547. 
 1090  706565607945 = 3 \cdot 5 \cdot 53 \cdot 79 \cdot 131 
 1091  \cdot 157 \cdot 547. 
1097  1092  
1098  1093  See the examples. 
1099  1094  
 1095  INPUT: 
 1096  
 1097   ``n``  a positive integer 
 1098  
 1099   ``A``  a subset of `\ZZ/(n)` 
 1100  
1100  1101  REFERENCES: 
1101  1102  
1102  1103  .. [LMR2010] N. Linial, R. Meshulam and M. Rosenthal, "Sum 
… 
… 
class SimplicialComplexExamples(): 
1106  1107  
1107  1108  EXAMPLES:: 
1108  1109  
1109   sage: simplicial_complexes.SumComplex(10, [0,1,2,3,6]).homology() 
 1110  sage: S = simplicial_complexes.SumComplex(10, [0,1,2,3,6]); S 
 1111  Simplicial complex with 10 vertices and 126 facets 
 1112  sage: S.homology() 
1110  1113  {0: 0, 1: 0, 2: 0, 3: C2728, 4: 0} 
1111  1114  sage: factor(2728) 
1112  1115  2^3 * 11 * 31 
1113  1116  
1114   sage: simplicial_complexes.SumComplex(11, [0, 1, 3]).homology(1) 
 1117  sage: S = simplicial_complexes.SumComplex(11, [0, 1, 3]); S 
 1118  Simplicial complex with 11 vertices and 45 facets 
 1119  sage: S.homology(1) 
1115  1120  C23 
1116   sage: simplicial_complexes.SumComplex(11, [0,1,2,3,4,7]).homology() # long time 
 1121  sage: S = simplicial_complexes.SumComplex(11, [0,1,2,3,4,7]); S 
 1122  Simplicial complex with 11 vertices and 252 facets 
 1123  sage: S.homology() # long time 
1117  1124  {0: 0, 1: 0, 2: 0, 3: 0, 4: C645679, 5: 0} 
1118  1125  sage: factor(645679) 
1119  1126  23 * 67 * 419 
1120  1127  
1121   sage: simplicial_complexes.SumComplex(13, [0, 1, 3]).homology(1) 
 1128  sage: S = simplicial_complexes.SumComplex(13, [0, 1, 3]); S 
 1129  Simplicial complex with 13 vertices and 66 facets 
 1130  sage: S.homology(1) 
1122  1131  C159 
1123  1132  sage: factor(159) 
1124  1133  3 * 53 
1125   sage: simplicial_complexes.SumComplex(13, [0,1,2,5]).homology() # long time 
 1134  sage: S = simplicial_complexes.SumComplex(13, [0,1,2,5]); S 
 1135  Simplicial complex with 13 vertices and 220 facets 
 1136  sage: S.homology() # long time 
1126  1137  {0: 0, 1: 0, 2: C146989209, 3: 0} 
1127  1138  sage: factor(1648910295) 
1128  1139  3^2 * 5 * 53 * 521 * 1327 
1129   sage: simplicial_complexes.SumComplex(13, [0,1,2,3,5]).homology() # long time 
 1140  sage: S = simplicial_complexes.SumComplex(13, [0,1,2,3,5]); S 
 1141  Simplicial complex with 13 vertices and 495 facets 
 1142  sage: S.homology() # long time 
1130  1143  {0: 0, 1: 0, 2: 0, 3: C3 x C237 x C706565607945, 4: 0} 
1131  1144  sage: factor(706565607945) 
1132  1145  3 * 5 * 53 * 79 * 131 * 157 * 547 
1133  1146  
1134   sage: simplicial_complexes.SumComplex(17, [0, 1, 4]).homology(1) 
 1147  sage: S = simplicial_complexes.SumComplex(17, [0, 1, 4]); S 
 1148  Simplicial complex with 17 vertices and 120 facets 
 1149  sage: S.homology(1) 
1135  1150  C140183 
1136  1151  sage: factor(140183) 
1137  1152  103 * 1361 
1138   sage: simplicial_complexes.SumComplex(19, [0, 1, 4]).homology(1) 
 1153  sage: S = simplicial_complexes.SumComplex(19, [0, 1, 4]); S 
 1154  Simplicial complex with 19 vertices and 153 facets 
 1155  sage: S.homology(1) 
1139  1156  C5670599 
1140  1157  sage: factor(5670599) 
1141  1158  11 * 191 * 2699 
1142   sage: simplicial_complexes.SumComplex(31, [0, 1, 4]).homology(1) # long time 
 1159  sage: S = simplicial_complexes.SumComplex(31, [0, 1, 4]); S 
 1160  Simplicial complex with 31 vertices and 435 facets 
 1161  sage: S.homology(1) # long time 
1143  1162  C5 x C5 x C5 x C5 x C26951480558170926865 
1144  1163  sage: factor(26951480558170926865) 
1145  1164  5 * 311 * 683 * 1117 * 11657 * 1948909 
1146  1165  """ 
1147  1166  from sage.rings.all import Integers 
1148   from sage.sets.set import Set 
1149   from sage.homology.all import SimplicialComplex 
1150  1167  Zn = Integers(n) 
1151  1168  A = frozenset([Zn(x) for x in A]) 
1152   k = len(A)  1 
1153  1169  facets = [] 
1154   for f in Set(Zn).subsets(k+1): 
 1170  for f in Set(Zn).subsets(len(A)): 
1155  1171  if sum(f) in A: 
1156  1172  facets.append(tuple(f)) 
1157   return SimplicialComplex(facets) 
 1173  return SimplicialComplex(facets, is_mutable=False) 
1158  1174  
1159  1175  simplicial_complexes = SimplicialComplexExamples() 