passagemath-polyhedra 10.6.37__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. passagemath_polyhedra/__init__.py +3 -0
  2. passagemath_polyhedra-10.6.37.dist-info/METADATA +367 -0
  3. passagemath_polyhedra-10.6.37.dist-info/METADATA.bak +369 -0
  4. passagemath_polyhedra-10.6.37.dist-info/RECORD +209 -0
  5. passagemath_polyhedra-10.6.37.dist-info/WHEEL +5 -0
  6. passagemath_polyhedra-10.6.37.dist-info/top_level.txt +3 -0
  7. passagemath_polyhedra.libs/libgcc_s-0cd532bd.so.1 +0 -0
  8. passagemath_polyhedra.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  9. passagemath_polyhedra.libs/libgomp-8949ffbe.so.1.0.0 +0 -0
  10. passagemath_polyhedra.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  11. sage/all__sagemath_polyhedra.py +50 -0
  12. sage/game_theory/all.py +8 -0
  13. sage/game_theory/catalog.py +6 -0
  14. sage/game_theory/catalog_normal_form_games.py +923 -0
  15. sage/game_theory/cooperative_game.py +844 -0
  16. sage/game_theory/matching_game.py +1181 -0
  17. sage/game_theory/normal_form_game.py +2697 -0
  18. sage/game_theory/parser.py +275 -0
  19. sage/geometry/all__sagemath_polyhedra.py +22 -0
  20. sage/geometry/cone.py +6940 -0
  21. sage/geometry/cone_catalog.py +847 -0
  22. sage/geometry/cone_critical_angles.py +1027 -0
  23. sage/geometry/convex_set.py +1119 -0
  24. sage/geometry/fan.py +3743 -0
  25. sage/geometry/fan_isomorphism.py +389 -0
  26. sage/geometry/fan_morphism.py +1884 -0
  27. sage/geometry/hasse_diagram.py +202 -0
  28. sage/geometry/hyperplane_arrangement/affine_subspace.py +390 -0
  29. sage/geometry/hyperplane_arrangement/all.py +1 -0
  30. sage/geometry/hyperplane_arrangement/arrangement.py +3905 -0
  31. sage/geometry/hyperplane_arrangement/check_freeness.py +145 -0
  32. sage/geometry/hyperplane_arrangement/hyperplane.py +773 -0
  33. sage/geometry/hyperplane_arrangement/library.py +825 -0
  34. sage/geometry/hyperplane_arrangement/ordered_arrangement.py +642 -0
  35. sage/geometry/hyperplane_arrangement/plot.py +520 -0
  36. sage/geometry/integral_points.py +35 -0
  37. sage/geometry/integral_points_generic_dense.cpython-314-x86_64-linux-musl.so +0 -0
  38. sage/geometry/integral_points_generic_dense.pyx +7 -0
  39. sage/geometry/lattice_polytope.py +5894 -0
  40. sage/geometry/linear_expression.py +773 -0
  41. sage/geometry/newton_polygon.py +767 -0
  42. sage/geometry/point_collection.cpython-314-x86_64-linux-musl.so +0 -0
  43. sage/geometry/point_collection.pyx +1008 -0
  44. sage/geometry/polyhedral_complex.py +2616 -0
  45. sage/geometry/polyhedron/all.py +8 -0
  46. sage/geometry/polyhedron/backend_cdd.py +460 -0
  47. sage/geometry/polyhedron/backend_cdd_rdf.py +231 -0
  48. sage/geometry/polyhedron/backend_field.py +347 -0
  49. sage/geometry/polyhedron/backend_normaliz.py +2503 -0
  50. sage/geometry/polyhedron/backend_number_field.py +168 -0
  51. sage/geometry/polyhedron/backend_polymake.py +765 -0
  52. sage/geometry/polyhedron/backend_ppl.py +582 -0
  53. sage/geometry/polyhedron/base.py +1206 -0
  54. sage/geometry/polyhedron/base0.py +1444 -0
  55. sage/geometry/polyhedron/base1.py +886 -0
  56. sage/geometry/polyhedron/base2.py +812 -0
  57. sage/geometry/polyhedron/base3.py +1845 -0
  58. sage/geometry/polyhedron/base4.py +1262 -0
  59. sage/geometry/polyhedron/base5.py +2700 -0
  60. sage/geometry/polyhedron/base6.py +1741 -0
  61. sage/geometry/polyhedron/base7.py +997 -0
  62. sage/geometry/polyhedron/base_QQ.py +1258 -0
  63. sage/geometry/polyhedron/base_RDF.py +98 -0
  64. sage/geometry/polyhedron/base_ZZ.py +934 -0
  65. sage/geometry/polyhedron/base_mutable.py +215 -0
  66. sage/geometry/polyhedron/base_number_field.py +122 -0
  67. sage/geometry/polyhedron/cdd_file_format.py +155 -0
  68. sage/geometry/polyhedron/combinatorial_polyhedron/all.py +1 -0
  69. sage/geometry/polyhedron/combinatorial_polyhedron/base.cpython-314-x86_64-linux-musl.so +0 -0
  70. sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +76 -0
  71. sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +3859 -0
  72. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.cpython-314-x86_64-linux-musl.so +0 -0
  73. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +39 -0
  74. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +1038 -0
  75. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.cpython-314-x86_64-linux-musl.so +0 -0
  76. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pxd +9 -0
  77. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +501 -0
  78. sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd +207 -0
  79. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.cpython-314-x86_64-linux-musl.so +0 -0
  80. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +102 -0
  81. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +2274 -0
  82. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.cpython-314-x86_64-linux-musl.so +0 -0
  83. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pxd +370 -0
  84. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pyx +84 -0
  85. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.cpython-314-x86_64-linux-musl.so +0 -0
  86. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd +31 -0
  87. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +587 -0
  88. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.cpython-314-x86_64-linux-musl.so +0 -0
  89. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +52 -0
  90. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +560 -0
  91. sage/geometry/polyhedron/constructor.py +773 -0
  92. sage/geometry/polyhedron/double_description.py +753 -0
  93. sage/geometry/polyhedron/double_description_inhomogeneous.py +564 -0
  94. sage/geometry/polyhedron/face.py +1060 -0
  95. sage/geometry/polyhedron/generating_function.py +1810 -0
  96. sage/geometry/polyhedron/lattice_euclidean_group_element.py +178 -0
  97. sage/geometry/polyhedron/library.py +3502 -0
  98. sage/geometry/polyhedron/misc.py +121 -0
  99. sage/geometry/polyhedron/modules/all.py +1 -0
  100. sage/geometry/polyhedron/modules/formal_polyhedra_module.py +155 -0
  101. sage/geometry/polyhedron/palp_database.py +447 -0
  102. sage/geometry/polyhedron/parent.py +1279 -0
  103. sage/geometry/polyhedron/plot.py +1986 -0
  104. sage/geometry/polyhedron/ppl_lattice_polygon.py +556 -0
  105. sage/geometry/polyhedron/ppl_lattice_polytope.py +1257 -0
  106. sage/geometry/polyhedron/representation.py +1723 -0
  107. sage/geometry/pseudolines.py +515 -0
  108. sage/geometry/relative_interior.py +445 -0
  109. sage/geometry/toric_plotter.py +1103 -0
  110. sage/geometry/triangulation/all.py +2 -0
  111. sage/geometry/triangulation/base.cpython-314-x86_64-linux-musl.so +0 -0
  112. sage/geometry/triangulation/base.pyx +963 -0
  113. sage/geometry/triangulation/data.h +147 -0
  114. sage/geometry/triangulation/data.pxd +4 -0
  115. sage/geometry/triangulation/element.py +914 -0
  116. sage/geometry/triangulation/functions.h +10 -0
  117. sage/geometry/triangulation/functions.pxd +4 -0
  118. sage/geometry/triangulation/point_configuration.py +2256 -0
  119. sage/geometry/triangulation/triangulations.h +49 -0
  120. sage/geometry/triangulation/triangulations.pxd +7 -0
  121. sage/geometry/voronoi_diagram.py +319 -0
  122. sage/interfaces/all__sagemath_polyhedra.py +1 -0
  123. sage/interfaces/polymake.py +2028 -0
  124. sage/numerical/all.py +13 -0
  125. sage/numerical/all__sagemath_polyhedra.py +11 -0
  126. sage/numerical/backends/all.py +1 -0
  127. sage/numerical/backends/all__sagemath_polyhedra.py +1 -0
  128. sage/numerical/backends/cvxopt_backend.cpython-314-x86_64-linux-musl.so +0 -0
  129. sage/numerical/backends/cvxopt_backend.pyx +1006 -0
  130. sage/numerical/backends/cvxopt_backend_test.py +19 -0
  131. sage/numerical/backends/cvxopt_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  132. sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
  133. sage/numerical/backends/cvxpy_backend.cpython-314-x86_64-linux-musl.so +0 -0
  134. sage/numerical/backends/cvxpy_backend.pxd +41 -0
  135. sage/numerical/backends/cvxpy_backend.pyx +934 -0
  136. sage/numerical/backends/cvxpy_backend_test.py +13 -0
  137. sage/numerical/backends/generic_backend_test.py +24 -0
  138. sage/numerical/backends/interactivelp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/numerical/backends/interactivelp_backend.pxd +36 -0
  140. sage/numerical/backends/interactivelp_backend.pyx +1231 -0
  141. sage/numerical/backends/interactivelp_backend_test.py +12 -0
  142. sage/numerical/backends/logging_backend.py +391 -0
  143. sage/numerical/backends/matrix_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  144. sage/numerical/backends/matrix_sdp_backend.pxd +15 -0
  145. sage/numerical/backends/matrix_sdp_backend.pyx +478 -0
  146. sage/numerical/backends/ppl_backend.cpython-314-x86_64-linux-musl.so +0 -0
  147. sage/numerical/backends/ppl_backend.pyx +1126 -0
  148. sage/numerical/backends/ppl_backend_test.py +13 -0
  149. sage/numerical/backends/scip_backend.cpython-314-x86_64-linux-musl.so +0 -0
  150. sage/numerical/backends/scip_backend.pxd +22 -0
  151. sage/numerical/backends/scip_backend.pyx +1289 -0
  152. sage/numerical/backends/scip_backend_test.py +13 -0
  153. sage/numerical/interactive_simplex_method.py +5338 -0
  154. sage/numerical/knapsack.py +665 -0
  155. sage/numerical/linear_functions.cpython-314-x86_64-linux-musl.so +0 -0
  156. sage/numerical/linear_functions.pxd +31 -0
  157. sage/numerical/linear_functions.pyx +1648 -0
  158. sage/numerical/linear_tensor.py +470 -0
  159. sage/numerical/linear_tensor_constraints.py +448 -0
  160. sage/numerical/linear_tensor_element.cpython-314-x86_64-linux-musl.so +0 -0
  161. sage/numerical/linear_tensor_element.pxd +6 -0
  162. sage/numerical/linear_tensor_element.pyx +459 -0
  163. sage/numerical/mip.cpython-314-x86_64-linux-musl.so +0 -0
  164. sage/numerical/mip.pxd +40 -0
  165. sage/numerical/mip.pyx +3667 -0
  166. sage/numerical/sdp.cpython-314-x86_64-linux-musl.so +0 -0
  167. sage/numerical/sdp.pxd +39 -0
  168. sage/numerical/sdp.pyx +1433 -0
  169. sage/rings/all__sagemath_polyhedra.py +3 -0
  170. sage/rings/polynomial/all__sagemath_polyhedra.py +10 -0
  171. sage/rings/polynomial/omega.py +982 -0
  172. sage/schemes/all__sagemath_polyhedra.py +2 -0
  173. sage/schemes/toric/all.py +10 -0
  174. sage/schemes/toric/chow_group.py +1248 -0
  175. sage/schemes/toric/divisor.py +2082 -0
  176. sage/schemes/toric/divisor_class.cpython-314-x86_64-linux-musl.so +0 -0
  177. sage/schemes/toric/divisor_class.pyx +322 -0
  178. sage/schemes/toric/fano_variety.py +1606 -0
  179. sage/schemes/toric/homset.py +650 -0
  180. sage/schemes/toric/ideal.py +451 -0
  181. sage/schemes/toric/library.py +1322 -0
  182. sage/schemes/toric/morphism.py +1958 -0
  183. sage/schemes/toric/points.py +1032 -0
  184. sage/schemes/toric/sheaf/all.py +1 -0
  185. sage/schemes/toric/sheaf/constructor.py +302 -0
  186. sage/schemes/toric/sheaf/klyachko.py +921 -0
  187. sage/schemes/toric/toric_subscheme.py +905 -0
  188. sage/schemes/toric/variety.py +3460 -0
  189. sage/schemes/toric/weierstrass.py +1078 -0
  190. sage/schemes/toric/weierstrass_covering.py +457 -0
  191. sage/schemes/toric/weierstrass_higher.py +288 -0
  192. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.info +10 -0
  193. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v03 +0 -0
  194. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v04 +0 -0
  195. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v05 +1 -0
  196. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v06 +1 -0
  197. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.info +22 -0
  198. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v04 +0 -0
  199. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v05 +0 -0
  200. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v06 +0 -0
  201. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v07 +0 -0
  202. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v08 +0 -0
  203. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v09 +0 -0
  204. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v10 +0 -0
  205. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v11 +1 -0
  206. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v12 +1 -0
  207. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v13 +1 -0
  208. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_2d +80 -0
  209. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_3d +37977 -0
@@ -0,0 +1,825 @@
1
+ # sage_setup: distribution = sagemath-polyhedra
2
+ r"""
3
+ Library of Hyperplane Arrangements
4
+
5
+ A collection of useful or interesting hyperplane arrangements. See
6
+ :mod:`sage.geometry.hyperplane_arrangement.arrangement` for details
7
+ about how to construct your own hyperplane arrangements.
8
+ """
9
+ # ****************************************************************************
10
+ # Copyright (C) 2013 David Perkinson <davidp@reed.edu>
11
+ #
12
+ # Distributed under the terms of the GNU General Public License (GPL)
13
+ # https://www.gnu.org/licenses/
14
+ # ****************************************************************************
15
+
16
+ from sage.arith.misc import binomial
17
+ from sage.geometry.hyperplane_arrangement.arrangement import HyperplaneArrangements
18
+ from sage.matrix.constructor import matrix, random_matrix
19
+ from sage.misc.misc_c import prod
20
+ from sage.rings.integer_ring import ZZ
21
+ from sage.rings.polynomial.polynomial_ring import polygen
22
+ from sage.rings.rational_field import QQ
23
+ from sage.rings.semirings.non_negative_integer_semiring import NN
24
+
25
+
26
+ def make_parent(base_ring, dimension, names=None):
27
+ """
28
+ Construct the parent for the hyperplane arrangements.
29
+
30
+ For internal use only.
31
+
32
+ INPUT:
33
+
34
+ - ``base_ring`` -- a ring
35
+
36
+ - ``dimension`` -- integer
37
+
38
+ - ``names`` -- ``None`` (default) or a list/tuple/iterable of
39
+ strings
40
+
41
+ OUTPUT:
42
+
43
+ A new
44
+ :class:`~sage.geometry.hyperplane_arrangement.arrangement.HyperplaneArrangements`
45
+ instance.
46
+
47
+ EXAMPLES::
48
+
49
+ sage: from sage.geometry.hyperplane_arrangement.library import make_parent
50
+ sage: make_parent(QQ, 3)
51
+ Hyperplane arrangements in 3-dimensional linear space over
52
+ Rational Field with coordinates t0, t1, t2
53
+ """
54
+ if names is None:
55
+ names = tuple('t'+str(i) for i in range(dimension))
56
+ else:
57
+ names = tuple(map(str, names))
58
+ if len(names) != dimension:
59
+ raise ValueError('number of variable names does not match dimension')
60
+ return HyperplaneArrangements(base_ring, names=names)
61
+
62
+
63
+ class HyperplaneArrangementLibrary:
64
+ """
65
+ The library of hyperplane arrangements.
66
+ """
67
+
68
+ def braid(self, n, K=QQ, names=None):
69
+ r"""
70
+ The braid arrangement.
71
+
72
+ INPUT:
73
+
74
+ - ``n`` -- integer
75
+
76
+ - ``K`` -- field (default: ``QQ``)
77
+
78
+ - ``names`` -- tuple of strings or ``None`` (default); the
79
+ variable names for the ambient space
80
+
81
+ OUTPUT:
82
+
83
+ The hyperplane arrangement consisting of the `n(n-1)/2`
84
+ hyperplanes `\{ x_i - x_j = 0 : 1 \leq i \leq j \leq n \}`.
85
+
86
+ EXAMPLES::
87
+
88
+ sage: hyperplane_arrangements.braid(4) # needs sage.graphs
89
+ Arrangement of 6 hyperplanes of dimension 4 and rank 3
90
+ """
91
+ from sage.graphs.graph_generators import graphs
92
+
93
+ x = polygen(QQ, 'x')
94
+ A = self.graphical(graphs.CompleteGraph(n), K, names=names)
95
+ charpoly = prod(x - i for i in range(n))
96
+ A.characteristic_polynomial.set_cache(charpoly)
97
+ return A
98
+
99
+ def bigraphical(self, G, A=None, K=QQ, names=None):
100
+ r"""
101
+ Return a bigraphical hyperplane arrangement.
102
+
103
+ INPUT:
104
+
105
+ - ``G`` -- graph
106
+
107
+ - ``A`` -- list, matrix, dictionary (default: ``None``
108
+ gives semiorder), or the string 'generic'
109
+
110
+ - ``K`` -- field (default: `\QQ`)
111
+
112
+ - ``names`` -- tuple of strings or ``None`` (default); the
113
+ variable names for the ambient space
114
+
115
+ OUTPUT:
116
+
117
+ The hyperplane arrangement with hyperplanes `x_i - x_j =
118
+ A[i,j]` and `x_j - x_i = A[j,i]` for each edge `v_i, v_j` of
119
+ ``G``. The indices `i,j` are the indices of elements of
120
+ ``G.vertices()``.
121
+
122
+ EXAMPLES::
123
+
124
+ sage: # needs sage.graphs
125
+ sage: G = graphs.CycleGraph(4)
126
+ sage: G.edges(sort=True)
127
+ [(0, 1, None), (0, 3, None), (1, 2, None), (2, 3, None)]
128
+ sage: G.edges(sort=True, labels=False)
129
+ [(0, 1), (0, 3), (1, 2), (2, 3)]
130
+ sage: A = {0:{1:1, 3:2}, 1:{0:3, 2:0}, 2:{1:2, 3:1}, 3:{2:0, 0:2}}
131
+ sage: HA = hyperplane_arrangements.bigraphical(G, A)
132
+ sage: HA.n_regions()
133
+ 63
134
+ sage: hyperplane_arrangements.bigraphical(G, # random
135
+ ....: 'generic').n_regions()
136
+ 65
137
+ sage: hyperplane_arrangements.bigraphical(G).n_regions()
138
+ 59
139
+
140
+ REFERENCES:
141
+
142
+ - [HP2016]_
143
+
144
+ TESTS:
145
+
146
+ One of the above examples was marked "# random" because the output is
147
+ not always the same. However, the answer is "65" more than 99.9% of the
148
+ time, so we can make a doctest by running it repeatedly
149
+ (see :issue:`39167`). ::
150
+
151
+ sage: # needs sage.graphs
152
+ sage: G = graphs.CycleGraph(4)
153
+ sage: any(hyperplane_arrangements.bigraphical(G,
154
+ ....: 'generic').n_regions() == 65 for _ in range(5))
155
+ True
156
+ """
157
+ n = G.num_verts()
158
+ if A is None: # default to G-semiorder arrangement
159
+ A = matrix(K, n, lambda i, j: 1)
160
+ elif A == 'generic':
161
+ A = random_matrix(ZZ, n, x=10000)
162
+ A = matrix(K, A)
163
+ H = make_parent(K, n, names)
164
+ x = H.gens()
165
+ hyperplanes = []
166
+ vertex_to_int = {u: i for i, u in enumerate(G)}
167
+ for u, v in G.edge_iterator(labels=False, sort_vertices=False):
168
+ i = vertex_to_int[u]
169
+ j = vertex_to_int[v]
170
+ hyperplanes.append(x[i] - x[j] - A[i][j])
171
+ hyperplanes.append(-x[i] + x[j] - A[j][i])
172
+ return H(*hyperplanes)
173
+
174
+ def Catalan(self, n, K=QQ, names=None):
175
+ r"""
176
+ Return the Catalan arrangement.
177
+
178
+ INPUT:
179
+
180
+ - ``n`` -- integer
181
+
182
+ - ``K`` -- field (default: `\QQ`)
183
+
184
+ - ``names`` -- tuple of strings or ``None`` (default); the
185
+ variable names for the ambient space
186
+
187
+ OUTPUT:
188
+
189
+ The arrangement of `3n(n-1)/2` hyperplanes `\{ x_i - x_j =
190
+ -1,0,1 : 1 \leq i \leq j \leq n \}`.
191
+
192
+ EXAMPLES::
193
+
194
+ sage: hyperplane_arrangements.Catalan(5)
195
+ Arrangement of 30 hyperplanes of dimension 5 and rank 4
196
+
197
+ TESTS::
198
+
199
+ sage: h = hyperplane_arrangements.Catalan(5)
200
+ sage: h.characteristic_polynomial()
201
+ x^5 - 30*x^4 + 335*x^3 - 1650*x^2 + 3024*x
202
+ sage: h.characteristic_polynomial.clear_cache() # long time
203
+ sage: h.characteristic_polynomial() # long time
204
+ x^5 - 30*x^4 + 335*x^3 - 1650*x^2 + 3024*x
205
+ """
206
+ H = make_parent(K, n, names)
207
+ x = H.gens()
208
+ hyperplanes = []
209
+ for i in range(n):
210
+ for j in range(i+1, n):
211
+ for k in [-1, 0, 1]:
212
+ hyperplanes.append(x[i] - x[j] - k)
213
+ Cn = H(*hyperplanes)
214
+ x = polygen(QQ, 'x')
215
+ charpoly = x*prod([x-n-i for i in range(1, n)])
216
+ Cn.characteristic_polynomial.set_cache(charpoly)
217
+ return Cn
218
+
219
+ def coordinate(self, n, K=QQ, names=None):
220
+ r"""
221
+ Return the coordinate hyperplane arrangement.
222
+
223
+ INPUT:
224
+
225
+ - ``n`` -- integer
226
+
227
+ - ``K`` -- field (default: `\QQ`)
228
+
229
+ - ``names`` -- tuple of strings or ``None`` (default); the
230
+ variable names for the ambient space
231
+
232
+ OUTPUT:
233
+
234
+ The coordinate hyperplane arrangement, which is the central
235
+ hyperplane arrangement consisting of the coordinate
236
+ hyperplanes `x_i = 0`.
237
+
238
+ EXAMPLES::
239
+
240
+ sage: hyperplane_arrangements.coordinate(5)
241
+ Arrangement of 5 hyperplanes of dimension 5 and rank 5
242
+ """
243
+ H = make_parent(K, n, names)
244
+ x = H.gens()
245
+ return H(x)
246
+
247
+ def Coxeter(self, data, K=QQ, names=None):
248
+ r"""
249
+ Return the Coxeter arrangement.
250
+
251
+ This generalizes the braid arrangements to crystallographic
252
+ root systems.
253
+
254
+ INPUT:
255
+
256
+ - ``data`` -- either an integer or a Cartan type (or coercible
257
+ into; see "CartanType")
258
+
259
+ - ``K`` -- field (default: ``QQ``)
260
+
261
+ - ``names`` -- tuple of strings or ``None`` (default); the
262
+ variable names for the ambient space
263
+
264
+ OUTPUT:
265
+
266
+ - If ``data`` is an integer `n`, return the braid arrangement in
267
+ dimension `n`, i.e. the set of `n(n-1)` hyperplanes:
268
+ `\{ x_i - x_j = 0,1 : 1 \leq i \leq j \leq n \}`. This corresponds
269
+ to the Coxeter arrangement of Cartan type `A_{n-1}`.
270
+
271
+ - If ``data`` is a Cartan type, return the Coxeter arrangement of given
272
+ type.
273
+
274
+ The Coxeter arrangement of a given crystallographic
275
+ Cartan type is defined by the inner products
276
+ `\langle a,x \rangle = 0` where
277
+ `a \in \Phi^+` runs over positive roots of the root system `\Phi`.
278
+
279
+ EXAMPLES::
280
+
281
+ sage: # needs sage.combinat
282
+ sage: hyperplane_arrangements.Coxeter(4)
283
+ Arrangement of 6 hyperplanes of dimension 4 and rank 3
284
+ sage: hyperplane_arrangements.Coxeter("B4")
285
+ Arrangement of 16 hyperplanes of dimension 4 and rank 4
286
+ sage: hyperplane_arrangements.Coxeter("A3")
287
+ Arrangement of 6 hyperplanes of dimension 4 and rank 3
288
+
289
+ If the Cartan type is not crystallographic, the Coxeter arrangement
290
+ is not implemented yet::
291
+
292
+ sage: hyperplane_arrangements.Coxeter("H3") # needs sage.libs.gap
293
+ Traceback (most recent call last):
294
+ ...
295
+ NotImplementedError: Coxeter arrangements are not implemented
296
+ for non crystallographic Cartan types
297
+
298
+ The characteristic polynomial is pre-computed using the results
299
+ of Terao, see [Ath2000]_::
300
+
301
+ sage: # needs sage.combinat
302
+ sage: hyperplane_arrangements.Coxeter("A3").characteristic_polynomial()
303
+ x^3 - 6*x^2 + 11*x - 6
304
+ """
305
+ from sage.combinat.root_system.cartan_type import CartanType
306
+ from sage.combinat.root_system.root_system import RootSystem
307
+ from sage.combinat.root_system.weyl_group import WeylGroup
308
+
309
+ if data in NN:
310
+ cartan_type = CartanType(["A", data - 1])
311
+ else:
312
+ cartan_type = CartanType(data)
313
+ if not cartan_type.is_crystallographic():
314
+ raise NotImplementedError("Coxeter arrangements are not implemented for non crystallographic Cartan types")
315
+ W = WeylGroup(cartan_type)
316
+ Ra = RootSystem(cartan_type).ambient_space()
317
+ PR = Ra.positive_roots()
318
+ d = Ra.dimension()
319
+ H = make_parent(K, d, names)
320
+ x = H.gens()
321
+ hyperplanes = []
322
+
323
+ for a in PR:
324
+ hyperplanes.append(sum(a[j] * x[j] for j in range(d)))
325
+ A = H(*hyperplanes)
326
+ x = polygen(QQ, 'x')
327
+ charpoly = prod(x - d + 1 for d in W.degrees())
328
+ A.characteristic_polynomial.set_cache(charpoly)
329
+ return A
330
+
331
+ def G_semiorder(self, G, K=QQ, names=None):
332
+ r"""
333
+ Return the semiorder hyperplane arrangement of a graph.
334
+
335
+ INPUT:
336
+
337
+ - ``G`` -- graph
338
+
339
+ - ``K`` -- field (default: `\QQ`)
340
+
341
+ - ``names`` -- tuple of strings or ``None`` (default); the
342
+ variable names for the ambient space
343
+
344
+ OUTPUT:
345
+
346
+ The semiorder hyperplane arrangement of a graph G is the
347
+ arrangement `\{ x_i - x_j = -1,1 \}` where `ij` is an edge of
348
+ ``G``.
349
+
350
+ EXAMPLES::
351
+
352
+ sage: # needs sage.graphs
353
+ sage: G = graphs.CompleteGraph(5)
354
+ sage: hyperplane_arrangements.G_semiorder(G)
355
+ Arrangement of 20 hyperplanes of dimension 5 and rank 4
356
+ sage: g = graphs.HouseGraph()
357
+ sage: hyperplane_arrangements.G_semiorder(g)
358
+ Arrangement of 12 hyperplanes of dimension 5 and rank 4
359
+ """
360
+ n = G.num_verts()
361
+ H = make_parent(K, n, names)
362
+ x = H.gens()
363
+ hyperplanes = []
364
+ vertex_to_int = {u: i for i, u in enumerate(G.vertices(sort=True))}
365
+ for u, v in G.edge_iterator(labels=False):
366
+ i = vertex_to_int[u]
367
+ j = vertex_to_int[v]
368
+ hyperplanes.append(x[i] - x[j] - 1)
369
+ hyperplanes.append(x[i] - x[j] + 1)
370
+ return H(*hyperplanes)
371
+
372
+ def G_Shi(self, G, K=QQ, names=None):
373
+ r"""
374
+ Return the Shi hyperplane arrangement of a graph `G`.
375
+
376
+ INPUT:
377
+
378
+ - ``G`` -- graph
379
+
380
+ - ``K`` -- field (default: `\QQ`)
381
+
382
+ - ``names`` -- tuple of strings or ``None`` (default); the
383
+ variable names for the ambient space
384
+
385
+ OUTPUT: the Shi hyperplane arrangement of the given graph ``G``
386
+
387
+ EXAMPLES::
388
+
389
+ sage: # needs sage.graphs
390
+ sage: G = graphs.CompleteGraph(5)
391
+ sage: hyperplane_arrangements.G_Shi(G)
392
+ Arrangement of 20 hyperplanes of dimension 5 and rank 4
393
+ sage: g = graphs.HouseGraph()
394
+ sage: hyperplane_arrangements.G_Shi(g)
395
+ Arrangement of 12 hyperplanes of dimension 5 and rank 4
396
+ sage: a = hyperplane_arrangements.G_Shi(graphs.WheelGraph(4)); a
397
+ Arrangement of 12 hyperplanes of dimension 4 and rank 3
398
+ """
399
+ n = G.num_verts()
400
+ H = make_parent(K, n, names)
401
+ x = H.gens()
402
+ hyperplanes = []
403
+ vertex_to_int = {u: i for i, u in enumerate(G.vertices(sort=True))}
404
+ for u, v in G.edge_iterator(labels=False):
405
+ i = vertex_to_int[u]
406
+ j = vertex_to_int[v]
407
+ hyperplanes.append(x[i] - x[j])
408
+ hyperplanes.append(x[i] - x[j] - 1)
409
+ return H(*hyperplanes)
410
+
411
+ def graphical(self, G, K=QQ, names=None):
412
+ r"""
413
+ Return the graphical hyperplane arrangement of a graph ``G``.
414
+
415
+ INPUT:
416
+
417
+ - ``G`` -- graph
418
+
419
+ - ``K`` -- field (default: `\QQ`)
420
+
421
+ - ``names`` -- tuple of strings or ``None`` (default); the
422
+ variable names for the ambient space
423
+
424
+ OUTPUT:
425
+
426
+ The graphical hyperplane arrangement of a graph G, which is
427
+ the arrangement `\{ x_i - x_j = 0 \}` for all edges `ij` of the
428
+ graph ``G``.
429
+
430
+ EXAMPLES::
431
+
432
+ sage: # needs sage.graphs
433
+ sage: G = graphs.CompleteGraph(5)
434
+ sage: hyperplane_arrangements.graphical(G)
435
+ Arrangement of 10 hyperplanes of dimension 5 and rank 4
436
+ sage: g = graphs.HouseGraph()
437
+ sage: hyperplane_arrangements.graphical(g)
438
+ Arrangement of 6 hyperplanes of dimension 5 and rank 4
439
+
440
+ TESTS::
441
+
442
+ sage: # needs sage.graphs
443
+ sage: h = hyperplane_arrangements.graphical(g)
444
+ sage: h.characteristic_polynomial()
445
+ x^5 - 6*x^4 + 14*x^3 - 15*x^2 + 6*x
446
+ sage: h.characteristic_polynomial.clear_cache() # long time
447
+ sage: h.characteristic_polynomial() # long time
448
+ x^5 - 6*x^4 + 14*x^3 - 15*x^2 + 6*x
449
+ """
450
+ n = G.num_verts()
451
+ H = make_parent(K, n, names)
452
+ x = H.gens()
453
+ hyperplanes = []
454
+ vertex_to_int = {u: i for i, u in enumerate(G.vertices(sort=True))}
455
+ for u, v in G.edge_iterator(labels=False):
456
+ i = vertex_to_int[u]
457
+ j = vertex_to_int[v]
458
+ hyperplanes.append(x[i] - x[j])
459
+ A = H(*hyperplanes)
460
+ charpoly = G.chromatic_polynomial()
461
+ A.characteristic_polynomial.set_cache(charpoly)
462
+ return A
463
+
464
+ def Ish(self, n, K=QQ, names=None):
465
+ r"""
466
+ Return the Ish arrangement.
467
+
468
+ INPUT:
469
+
470
+ - ``n`` -- integer
471
+
472
+ - ``K`` -- field (default: ``QQ``)
473
+
474
+ - ``names`` -- tuple of strings or ``None`` (default); the
475
+ variable names for the ambient space
476
+
477
+ OUTPUT:
478
+
479
+ The Ish arrangement, which is the set of `n(n-1)` hyperplanes.
480
+
481
+ .. MATH::
482
+
483
+ \{ x_i - x_j = 0 : 1 \leq i \leq j \leq n \}
484
+ \cup
485
+ \{ x_1 - x_j = i : 1 \leq i \leq j \leq n \}.
486
+
487
+ EXAMPLES::
488
+
489
+ sage: # needs sage.combinat
490
+ sage: a = hyperplane_arrangements.Ish(3); a
491
+ Arrangement of 6 hyperplanes of dimension 3 and rank 2
492
+ sage: a.characteristic_polynomial()
493
+ x^3 - 6*x^2 + 9*x
494
+ sage: b = hyperplane_arrangements.Shi(3)
495
+ sage: b.characteristic_polynomial()
496
+ x^3 - 6*x^2 + 9*x
497
+
498
+ TESTS::
499
+
500
+ sage: a.characteristic_polynomial.clear_cache() # long time # needs sage.combinat
501
+ sage: a.characteristic_polynomial() # long time # needs sage.combinat
502
+ x^3 - 6*x^2 + 9*x
503
+
504
+ REFERENCES:
505
+
506
+ - [AR2012]_
507
+ """
508
+ from sage.combinat.combinat import stirling_number2
509
+
510
+ H = make_parent(K, n, names)
511
+ x = H.gens()
512
+ hyperplanes = []
513
+ for i in range(n):
514
+ for j in range(i+1, n):
515
+ hyperplanes.append(x[i] - x[j])
516
+ hyperplanes.append(x[0] - x[j] - (i+1))
517
+ A = H(*hyperplanes)
518
+ x = polygen(QQ, 'x')
519
+ charpoly = x * sum([(-1)**k * stirling_number2(n, n-k) *
520
+ prod([(x - 1 - j) for j in range(k, n-1)])
521
+ for k in range(n)])
522
+ A.characteristic_polynomial.set_cache(charpoly)
523
+ return A
524
+
525
+ def IshB(self, n, K=QQ, names=None):
526
+ r"""
527
+ Return the type B Ish arrangement.
528
+
529
+ INPUT:
530
+
531
+ - ``n`` -- integer
532
+ - ``K`` -- field (default: ``QQ``)
533
+ - ``names`` -- tuple of strings or ``None`` (default); the
534
+ variable names for the ambient space
535
+
536
+ OUTPUT: the type `B` Ish arrangement, which is the set of `2n^2` hyperplanes
537
+
538
+ .. MATH::
539
+
540
+ \{ x_i \pm x_j = 0 : 1 \leq i < j \leq n \}
541
+ \cup
542
+ \{ x_i = a : 1 \leq i\leq n, \quad i - n \leq a \leq n - i + 1 \}.
543
+
544
+ EXAMPLES::
545
+
546
+ sage: a = hyperplane_arrangements.IshB(2)
547
+ sage: a
548
+ Arrangement of 8 hyperplanes of dimension 2 and rank 2
549
+ sage: a.hyperplanes()
550
+ (Hyperplane 0*t0 + t1 - 1,
551
+ Hyperplane 0*t0 + t1 + 0,
552
+ Hyperplane t0 - t1 + 0,
553
+ Hyperplane t0 + 0*t1 - 2,
554
+ Hyperplane t0 + 0*t1 - 1,
555
+ Hyperplane t0 + 0*t1 + 0,
556
+ Hyperplane t0 + 0*t1 + 1,
557
+ Hyperplane t0 + t1 + 0)
558
+ sage: a.cone().is_free() # needs sage.libs.singular
559
+ True
560
+
561
+ .. PLOT::
562
+ :width: 500 px
563
+
564
+ a = hyperplane_arrangements.IshB(2)
565
+ sphinx_plot(a.plot())
566
+
567
+ ::
568
+
569
+ sage: a = hyperplane_arrangements.IshB(3); a
570
+ Arrangement of 18 hyperplanes of dimension 3 and rank 3
571
+ sage: a.characteristic_polynomial()
572
+ x^3 - 18*x^2 + 108*x - 216
573
+ sage: b = hyperplane_arrangements.Shi(['B', 3])
574
+ sage: b.characteristic_polynomial()
575
+ x^3 - 18*x^2 + 108*x - 216
576
+
577
+ TESTS::
578
+
579
+ sage: a.characteristic_polynomial.clear_cache()
580
+ sage: a.characteristic_polynomial()
581
+ x^3 - 18*x^2 + 108*x - 216
582
+
583
+ REFERENCES:
584
+
585
+ - [TT2023]_
586
+ """
587
+ H = make_parent(K, n, names)
588
+ x = H.gens()
589
+ hyperplanes = []
590
+ for i in range(n):
591
+ for j in range(i+1, n):
592
+ hyperplanes.append(x[i] - x[j])
593
+ hyperplanes.append(x[i] + x[j])
594
+ for a in range(i+1-n, n-i+1):
595
+ hyperplanes.append(x[i] - a)
596
+ A = H(*hyperplanes)
597
+ x = polygen(QQ, 'x')
598
+ charpoly = (x - 2*n) ** n
599
+ A.characteristic_polynomial.set_cache(charpoly)
600
+ return A
601
+
602
+ def linial(self, n, K=QQ, names=None):
603
+ r"""
604
+ Return the linial hyperplane arrangement.
605
+
606
+ INPUT:
607
+
608
+ - ``n`` -- integer
609
+
610
+ - ``K`` -- field (default: `\QQ`)
611
+
612
+ - ``names`` -- tuple of strings or ``None`` (default); the
613
+ variable names for the ambient space
614
+
615
+ OUTPUT:
616
+
617
+ The linial hyperplane arrangement is the set of hyperplanes
618
+ `\{x_i - x_j = 1 : 1\leq i < j \leq n\}`.
619
+
620
+ EXAMPLES::
621
+
622
+ sage: a = hyperplane_arrangements.linial(4); a
623
+ Arrangement of 6 hyperplanes of dimension 4 and rank 3
624
+ sage: a.characteristic_polynomial()
625
+ x^4 - 6*x^3 + 15*x^2 - 14*x
626
+
627
+ TESTS::
628
+
629
+ sage: h = hyperplane_arrangements.linial(5)
630
+ sage: h.characteristic_polynomial()
631
+ x^5 - 10*x^4 + 45*x^3 - 100*x^2 + 90*x
632
+ sage: h.characteristic_polynomial.clear_cache() # long time
633
+ sage: h.characteristic_polynomial() # long time
634
+ x^5 - 10*x^4 + 45*x^3 - 100*x^2 + 90*x
635
+ """
636
+ H = make_parent(K, n, names)
637
+ x = H.gens()
638
+ hyperplanes = []
639
+ for i in range(n):
640
+ for j in range(i+1, n):
641
+ hyperplanes.append(x[i] - x[j] - 1)
642
+ A = H(*hyperplanes)
643
+ x = polygen(QQ, 'x')
644
+ charpoly = x * sum(binomial(n, k)*(x - k)**(n - 1) for k in range(n + 1)) / 2**n
645
+ A.characteristic_polynomial.set_cache(charpoly)
646
+ return A
647
+
648
+ def semiorder(self, n, K=QQ, names=None):
649
+ r"""
650
+ Return the semiorder arrangement.
651
+
652
+ INPUT:
653
+
654
+ - ``n`` -- integer
655
+
656
+ - ``K`` -- field (default: `\QQ`)
657
+
658
+ - ``names`` -- tuple of strings or ``None`` (default); the
659
+ variable names for the ambient space
660
+
661
+ OUTPUT:
662
+
663
+ The semiorder arrangement, which is the set of `n(n-1)`
664
+ hyperplanes `\{ x_i - x_j = -1,1 : 1 \leq i \leq j \leq n\}`.
665
+
666
+ EXAMPLES::
667
+
668
+ sage: hyperplane_arrangements.semiorder(4)
669
+ Arrangement of 12 hyperplanes of dimension 4 and rank 3
670
+
671
+ TESTS::
672
+
673
+ sage: # needs sage.combinat
674
+ sage: h = hyperplane_arrangements.semiorder(5)
675
+ sage: h.characteristic_polynomial()
676
+ x^5 - 20*x^4 + 180*x^3 - 790*x^2 + 1380*x
677
+ sage: h.characteristic_polynomial.clear_cache() # long time
678
+ sage: h.characteristic_polynomial() # long time
679
+ x^5 - 20*x^4 + 180*x^3 - 790*x^2 + 1380*x
680
+ """
681
+ from sage.combinat.combinat import stirling_number2
682
+
683
+ H = make_parent(K, n, names)
684
+ x = H.gens()
685
+ hyperplanes = []
686
+ for i in range(n):
687
+ for j in range(i+1, n):
688
+ for k in [-1, 1]:
689
+ hyperplanes.append(x[i] - x[j] - k)
690
+ A = H(*hyperplanes)
691
+ x = polygen(QQ, 'x')
692
+ charpoly = x * sum([stirling_number2(n, k) * prod([x - k - i for i in range(1, k)])
693
+ for k in range(1, n+1)])
694
+ A.characteristic_polynomial.set_cache(charpoly)
695
+ return A
696
+
697
+ def Shi(self, data, K=QQ, names=None, m=1):
698
+ r"""
699
+ Return the Shi arrangement.
700
+
701
+ INPUT:
702
+
703
+ - ``data`` -- either an integer or a Cartan type (or coercible
704
+ into; see "CartanType")
705
+
706
+ - ``K`` -- field (default: ``QQ``)
707
+
708
+ - ``names`` -- tuple of strings or ``None`` (default); the
709
+ variable names for the ambient space
710
+
711
+ - ``m`` -- integer (default: 1)
712
+
713
+ OUTPUT:
714
+
715
+ - If ``data`` is an integer `n`, return the Shi arrangement in
716
+ dimension `n`, i.e. the set of `n(n-1)` hyperplanes:
717
+ `\{ x_i - x_j = 0,1 : 1 \leq i \leq j \leq n \}`. This corresponds
718
+ to the Shi arrangement of Cartan type `A_{n-1}`.
719
+
720
+ - If ``data`` is a Cartan type, return the Shi arrangement of given
721
+ type.
722
+
723
+ - If `m > 1`, return the `m`-extended Shi arrangement of given type.
724
+
725
+ The `m`-extended Shi arrangement of a given crystallographic
726
+ Cartan type is defined by the inner product
727
+ `\langle a,x \rangle = k` for `-m < k \leq m` and
728
+ `a \in \Phi^+` is a positive root of the root system `\Phi`.
729
+
730
+ EXAMPLES::
731
+
732
+ sage: # needs sage.combinat
733
+ sage: hyperplane_arrangements.Shi(4)
734
+ Arrangement of 12 hyperplanes of dimension 4 and rank 3
735
+ sage: hyperplane_arrangements.Shi("A3")
736
+ Arrangement of 12 hyperplanes of dimension 4 and rank 3
737
+ sage: hyperplane_arrangements.Shi("A3", m=2)
738
+ Arrangement of 24 hyperplanes of dimension 4 and rank 3
739
+ sage: hyperplane_arrangements.Shi("B4")
740
+ Arrangement of 32 hyperplanes of dimension 4 and rank 4
741
+ sage: hyperplane_arrangements.Shi("B4", m=3)
742
+ Arrangement of 96 hyperplanes of dimension 4 and rank 4
743
+ sage: hyperplane_arrangements.Shi("C3")
744
+ Arrangement of 18 hyperplanes of dimension 3 and rank 3
745
+ sage: hyperplane_arrangements.Shi("D4", m=3)
746
+ Arrangement of 72 hyperplanes of dimension 4 and rank 4
747
+ sage: hyperplane_arrangements.Shi("E6")
748
+ Arrangement of 72 hyperplanes of dimension 8 and rank 6
749
+ sage: hyperplane_arrangements.Shi("E6", m=2)
750
+ Arrangement of 144 hyperplanes of dimension 8 and rank 6
751
+
752
+ If the Cartan type is not crystallographic, the Shi arrangement
753
+ is not defined::
754
+
755
+ sage: hyperplane_arrangements.Shi("H4")
756
+ Traceback (most recent call last):
757
+ ...
758
+ NotImplementedError: Shi arrangements are not defined for non crystallographic Cartan types
759
+
760
+ The characteristic polynomial is pre-computed using the results
761
+ of [Ath1996]_::
762
+
763
+ sage: # needs sage.combinat
764
+ sage: hyperplane_arrangements.Shi("A3").characteristic_polynomial()
765
+ x^4 - 12*x^3 + 48*x^2 - 64*x
766
+ sage: hyperplane_arrangements.Shi("A3", m=2).characteristic_polynomial()
767
+ x^4 - 24*x^3 + 192*x^2 - 512*x
768
+ sage: hyperplane_arrangements.Shi("C3").characteristic_polynomial()
769
+ x^3 - 18*x^2 + 108*x - 216
770
+ sage: hyperplane_arrangements.Shi("E6").characteristic_polynomial()
771
+ x^8 - 72*x^7 + 2160*x^6 - 34560*x^5 + 311040*x^4 - 1492992*x^3 + 2985984*x^2
772
+ sage: hyperplane_arrangements.Shi("B4", m=3).characteristic_polynomial()
773
+ x^4 - 96*x^3 + 3456*x^2 - 55296*x + 331776
774
+
775
+ TESTS::
776
+
777
+ sage: # needs sage.combinat
778
+ sage: h = hyperplane_arrangements.Shi(4)
779
+ sage: h.characteristic_polynomial()
780
+ x^4 - 12*x^3 + 48*x^2 - 64*x
781
+ sage: h.characteristic_polynomial.clear_cache() # long time
782
+ sage: h.characteristic_polynomial() # long time
783
+ x^4 - 12*x^3 + 48*x^2 - 64*x
784
+ sage: h = hyperplane_arrangements.Shi("A3", m=2)
785
+ sage: h.characteristic_polynomial()
786
+ x^4 - 24*x^3 + 192*x^2 - 512*x
787
+ sage: h.characteristic_polynomial.clear_cache()
788
+ sage: h.characteristic_polynomial()
789
+ x^4 - 24*x^3 + 192*x^2 - 512*x
790
+ sage: h = hyperplane_arrangements.Shi("B3", m=3)
791
+ sage: h.characteristic_polynomial()
792
+ x^3 - 54*x^2 + 972*x - 5832
793
+ sage: h.characteristic_polynomial.clear_cache()
794
+ sage: h.characteristic_polynomial()
795
+ x^3 - 54*x^2 + 972*x - 5832
796
+ """
797
+ from sage.combinat.root_system.cartan_type import CartanType
798
+ from sage.combinat.root_system.root_system import RootSystem
799
+
800
+ if data in NN:
801
+ cartan_type = CartanType(["A", data - 1])
802
+ else:
803
+ cartan_type = CartanType(data)
804
+ if not cartan_type.is_crystallographic():
805
+ raise NotImplementedError("Shi arrangements are not defined for non crystallographic Cartan types")
806
+ n = cartan_type.rank()
807
+ h = cartan_type.coxeter_number()
808
+ Ra = RootSystem(cartan_type).ambient_space()
809
+ PR = Ra.positive_roots()
810
+ d = Ra.dimension()
811
+ H = make_parent(K, d, names)
812
+ x = H.gens()
813
+ hyperplanes = []
814
+
815
+ for a in PR:
816
+ for const in range(-m + 1, m + 1):
817
+ hyperplanes.append(sum(a[j]*x[j] for j in range(d))-const)
818
+ A = H(*hyperplanes)
819
+ x = polygen(QQ, 'x')
820
+ charpoly = x**(d-n) * (x-m*h)**n
821
+ A.characteristic_polynomial.set_cache(charpoly)
822
+ return A
823
+
824
+
825
+ hyperplane_arrangements = HyperplaneArrangementLibrary()