|
60 | 60 | The default base field is `\QQ`, the rational numbers. Finite fields are also |
61 | 61 | supported:: |
62 | 62 |
|
63 | | - sage: H.<x,y,z> = HyperplaneArrangements(GF(5)) |
64 | | - sage: a = H([(1,2,3), 4], [(5,6,7), 8]); a |
| 63 | + sage: H.<x,y,z> = HyperplaneArrangements(GF(5)) # optional - sage.libs.pari |
| 64 | + sage: a = H([(1,2,3), 4], [(5,6,7), 8]); a # optional - sage.libs.pari |
65 | 65 | Arrangement <y + 2*z + 3 | x + 2*y + 3*z + 4> |
66 | 66 |
|
67 | 67 | Number fields are also possible:: |
68 | 68 |
|
69 | 69 | sage: x = var('x') |
70 | | - sage: NF.<a> = NumberField(x**4 - 5*x**2 + 5,embedding=1.90) |
71 | | - sage: H.<y,z> = HyperplaneArrangements(NF) |
72 | | - sage: A = H([[(-a**3 + 3*a, -a**2 + 4), 1], [(a**3 - 4*a, -1), 1], |
| 70 | + sage: NF.<a> = NumberField(x**4 - 5*x**2 + 5, embedding=1.90) # optional - sage.rings.number_field |
| 71 | + sage: H.<y,z> = HyperplaneArrangements(NF) # optional - sage.rings.number_field |
| 72 | + sage: A = H([[(-a**3 + 3*a, -a**2 + 4), 1], [(a**3 - 4*a, -1), 1], # optional - sage.rings.number_field |
73 | 73 | ....: [(0, 2*a**2 - 6), 1], [(-a**3 + 4*a, -1), 1], |
74 | 74 | ....: [(a**3 - 3*a, -a**2 + 4), 1]]) |
75 | | - sage: A |
| 75 | + sage: A # optional - sage.rings.number_field |
76 | 76 | Arrangement of 5 hyperplanes of dimension 2 and rank 2 |
77 | | - sage: A.base_ring() |
| 77 | + sage: A.base_ring() # optional - sage.rings.number_field |
78 | 78 | Number Field in a with defining polynomial x^4 - 5*x^2 + 5 with a = 1.902113032590308? |
79 | 79 |
|
80 | 80 | Notation (iii): a list or tuple of hyperplanes:: |
81 | 81 |
|
82 | | - sage: H.<x,y,z> = HyperplaneArrangements(GF(5)) |
83 | | - sage: k = [x+i for i in range(4)]; k |
| 82 | + sage: H.<x,y,z> = HyperplaneArrangements(GF(5)) # optional - sage.libs.pari |
| 83 | + sage: k = [x+i for i in range(4)]; k # optional - sage.libs.pari |
84 | 84 | [Hyperplane x + 0*y + 0*z + 0, Hyperplane x + 0*y + 0*z + 1, |
85 | 85 | Hyperplane x + 0*y + 0*z + 2, Hyperplane x + 0*y + 0*z + 3] |
86 | | - sage: H(k) |
| 86 | + sage: H(k) # optional - sage.libs.pari |
87 | 87 | Arrangement <x | x + 1 | x + 2 | x + 3> |
88 | 88 |
|
89 | 89 | Notation (iv): using the library of arrangements:: |
|
264 | 264 | sage: a = hyperplane_arrangements.semiorder(3) |
265 | 265 | sage: a.has_good_reduction(5) |
266 | 266 | True |
267 | | - sage: b = a.change_ring(GF(5)) |
| 267 | + sage: b = a.change_ring(GF(5)) # optional - sage.libs.pari |
268 | 268 | sage: pa = a.intersection_poset() |
269 | | - sage: pb = b.intersection_poset() |
270 | | - sage: pa.is_isomorphic(pb) |
| 269 | + sage: pb = b.intersection_poset() # optional - sage.libs.pari |
| 270 | + sage: pa.is_isomorphic(pb) # optional - sage.libs.pari |
271 | 271 | True |
272 | 272 | sage: a.face_vector() |
273 | 273 | (0, 12, 30, 19) |
|
356 | 356 | from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing |
357 | 357 |
|
358 | 358 | from sage.geometry.hyperplane_arrangement.hyperplane import AmbientVectorSpace, Hyperplane |
359 | | -from sage.combinat.posets.posets import Poset |
360 | 359 |
|
361 | 360 |
|
362 | 361 | class HyperplaneArrangementElement(Element): |
@@ -1129,7 +1128,7 @@ def change_ring(self, base_ring): |
1129 | 1128 |
|
1130 | 1129 | sage: H.<x,y> = HyperplaneArrangements(QQ) |
1131 | 1130 | sage: A = H([(1,1), 0], [(2,3), -1]) |
1132 | | - sage: A.change_ring(FiniteField(2)) |
| 1131 | + sage: A.change_ring(FiniteField(2)) # optional - sage.libs.pari |
1133 | 1132 | Arrangement <y + 1 | x + y> |
1134 | 1133 |
|
1135 | 1134 | TESTS: |
@@ -1165,25 +1164,30 @@ def n_regions(self): |
1165 | 1164 |
|
1166 | 1165 | sage: H.<x,y> = HyperplaneArrangements(QQ) |
1167 | 1166 | sage: A = H([(1,1), 0], [(2,3), -1], [(4,5), 3]) |
1168 | | - sage: B = A.change_ring(FiniteField(7)) |
1169 | | - sage: B.n_regions() |
| 1167 | + sage: B = A.change_ring(FiniteField(7)) # optional - sage.libs.pari |
| 1168 | + sage: B.n_regions() # optional - sage.libs.pari |
1170 | 1169 | Traceback (most recent call last): |
1171 | 1170 | ... |
1172 | 1171 | TypeError: base field must have characteristic zero |
1173 | 1172 |
|
1174 | 1173 | Check that :trac:`30749` is fixed:: |
1175 | 1174 |
|
1176 | 1175 | sage: R.<y> = QQ[] |
1177 | | - sage: v1 = AA.polynomial_root(AA.common_polynomial(y^2 - 3), RIF(RR(1.7320508075688772), RR(1.7320508075688774))) |
1178 | | - sage: v2 = QQbar.polynomial_root(AA.common_polynomial(y^4 - y^2 + 1), CIF(RIF(RR(0.8660254037844386), RR(0.86602540378443871)), RIF(-RR(0.50000000000000011), -RR(0.49999999999999994)))) |
1179 | | - sage: my_vectors = (vector(AA, [-v1, -1, 1]), vector(AA, [0, 2, 1]), vector(AA,[v1, -1, 1]), vector(AA, [1, 0, 0]), vector(AA, [1/2, AA(-1/2*v2^3 + v2),0]), vector(AA, [-1/2, AA(-1/2*v2^3 + v2), 0])) |
1180 | | - sage: H = HyperplaneArrangements(AA, names='xyz') |
1181 | | - sage: x,y,z = H.gens() |
1182 | | - sage: A = H(backend="normaliz") # optional - pynormaliz |
1183 | | - sage: for v in my_vectors: # optional - pynormaliz |
| 1176 | + sage: v1 = AA.polynomial_root(AA.common_polynomial(y^2 - 3), # optional - sage.rings.number_field |
| 1177 | + ....: RIF(RR(1.7320508075688772), RR(1.7320508075688774))) |
| 1178 | + sage: v2 = QQbar.polynomial_root(AA.common_polynomial(y^4 - y^2 + 1), # optional - sage.rings.number_field |
| 1179 | + ....: CIF(RIF(RR(0.8660254037844386), RR(0.86602540378443871)), |
| 1180 | + ....: RIF(-RR(0.50000000000000011), -RR(0.49999999999999994)))) |
| 1181 | + sage: my_vectors = (vector(AA, [-v1, -1, 1]), vector(AA, [0, 2, 1]), vector(AA, [v1, -1, 1]), # optional - sage.rings.number_field |
| 1182 | + ....: vector(AA, [1, 0, 0]), vector(AA, [1/2, AA(-1/2*v2^3 + v2),0]), |
| 1183 | + ....: vector(AA, [-1/2, AA(-1/2*v2^3 + v2), 0])) |
| 1184 | + sage: H = HyperplaneArrangements(AA, names='xyz') # optional - sage.rings.number_field |
| 1185 | + sage: x,y,z = H.gens() # optional - sage.rings.number_field |
| 1186 | + sage: A = H(backend="normaliz") # optional - pynormaliz # optional - sage.rings.number_field |
| 1187 | + sage: for v in my_vectors: # optional - pynormaliz # optional - sage.rings.number_field |
1184 | 1188 | ....: a, b, c = v |
1185 | 1189 | ....: A = A.add_hyperplane(a*x + b*y + c*z) |
1186 | | - sage: A.n_regions() # optional - pynormaliz |
| 1190 | + sage: A.n_regions() # optional - pynormaliz # optional - sage.rings.number_field |
1187 | 1191 | 24 |
1188 | 1192 | """ |
1189 | 1193 | if self.base_ring().characteristic() != 0: |
@@ -1211,8 +1215,8 @@ def n_bounded_regions(self): |
1211 | 1215 |
|
1212 | 1216 | sage: H.<x,y> = HyperplaneArrangements(QQ) |
1213 | 1217 | sage: A = H([(1,1),0], [(2,3),-1], [(4,5),3]) |
1214 | | - sage: B = A.change_ring(FiniteField(7)) |
1215 | | - sage: B.n_bounded_regions() |
| 1218 | + sage: B = A.change_ring(FiniteField(7)) # optional - sage.libs.pari |
| 1219 | + sage: B.n_bounded_regions() # optional - sage.libs.pari |
1216 | 1220 | Traceback (most recent call last): |
1217 | 1221 | ... |
1218 | 1222 | TypeError: base field must have characteristic zero |
@@ -1243,14 +1247,14 @@ def has_good_reduction(self, p): |
1243 | 1247 | EXAMPLES:: |
1244 | 1248 |
|
1245 | 1249 | sage: a = hyperplane_arrangements.semiorder(3) |
1246 | | - sage: a.has_good_reduction(5) |
| 1250 | + sage: a.has_good_reduction(5) # optional - sage.libs.pari |
1247 | 1251 | True |
1248 | | - sage: a.has_good_reduction(3) |
| 1252 | + sage: a.has_good_reduction(3) # optional - sage.libs.pari |
1249 | 1253 | False |
1250 | | - sage: b = a.change_ring(GF(3)) |
| 1254 | + sage: b = a.change_ring(GF(3)) # optional - sage.libs.pari |
1251 | 1255 | sage: a.characteristic_polynomial() |
1252 | 1256 | x^3 - 6*x^2 + 12*x |
1253 | | - sage: b.characteristic_polynomial() # not equal to that for a |
| 1257 | + sage: b.characteristic_polynomial() # not equal to that for a # optional - sage.libs.pari |
1254 | 1258 | x^3 - 6*x^2 + 10*x |
1255 | 1259 | """ |
1256 | 1260 | if self.base_ring() != QQ: |
@@ -1495,9 +1499,9 @@ def essentialization(self): |
1495 | 1499 | Hyperplane arrangements in 1-dimensional linear space over |
1496 | 1500 | Rational Field with coordinate x |
1497 | 1501 |
|
1498 | | - sage: H.<x,y> = HyperplaneArrangements(GF(2)) |
1499 | | - sage: C = H([(1,1),1], [(1,1),0]) |
1500 | | - sage: C.essentialization() |
| 1502 | + sage: H.<x,y> = HyperplaneArrangements(GF(2)) # optional - sage.libs.pari |
| 1503 | + sage: C = H([(1,1),1], [(1,1),0]) # optional - sage.libs.pari |
| 1504 | + sage: C.essentialization() # optional - sage.libs.pari |
1501 | 1505 | Arrangement <y | y + 1> |
1502 | 1506 |
|
1503 | 1507 | sage: h = hyperplane_arrangements.semiorder(4) |
@@ -1587,9 +1591,9 @@ def sign_vector(self, p): |
1587 | 1591 |
|
1588 | 1592 | TESTS:: |
1589 | 1593 |
|
1590 | | - sage: H.<x,y> = HyperplaneArrangements(GF(3)) |
1591 | | - sage: A = H(x, y) |
1592 | | - sage: A.sign_vector([1, 2]) |
| 1594 | + sage: H.<x,y> = HyperplaneArrangements(GF(3)) # optional - sage.libs.pari |
| 1595 | + sage: A = H(x, y) # optional - sage.libs.pari |
| 1596 | + sage: A.sign_vector([1, 2]) # optional - sage.libs.pari |
1593 | 1597 | Traceback (most recent call last): |
1594 | 1598 | ... |
1595 | 1599 | ValueError: characteristic must be zero |
@@ -1992,6 +1996,8 @@ def poset_of_regions(self, B=None, numbered_labels=True): |
1992 | 1996 | sage: A.poset_of_regions(B=base_region) |
1993 | 1997 | Finite poset containing 14 elements |
1994 | 1998 | """ |
| 1999 | + from sage.combinat.posets.posets import Poset |
| 2000 | + |
1995 | 2001 | # We use RX to keep track of indexes and R to keep track of which regions |
1996 | 2002 | # we've already hit. This poset is graded, so we can go one set at a time |
1997 | 2003 | RX = self.regions() |
@@ -2480,7 +2486,7 @@ def face_semigroup_algebra(self, field=None, names='e'): |
2480 | 2486 | sage: (e3 + 2*e4) * (e1 - e7) |
2481 | 2487 | e4 - e6 |
2482 | 2488 |
|
2483 | | - sage: U3 = a.face_semigroup_algebra(field=GF(3)); U3 |
| 2489 | + sage: U3 = a.face_semigroup_algebra(field=GF(3)); U3 # optional - sage.libs.pari |
2484 | 2490 | Finite-dimensional algebra of degree 13 over Finite Field of size 3 |
2485 | 2491 |
|
2486 | 2492 | TESTS: |
@@ -2550,8 +2556,8 @@ def region_containing_point(self, p): |
2550 | 2556 | TESTS:: |
2551 | 2557 |
|
2552 | 2558 | sage: A = H([(1,1),0], [(2,3),-1], [(4,5),3]) |
2553 | | - sage: B = A.change_ring(FiniteField(7)) |
2554 | | - sage: B.region_containing_point((1,2)) |
| 2559 | + sage: B = A.change_ring(FiniteField(7)) # optional - sage.libs.pari |
| 2560 | + sage: B.region_containing_point((1,2)) # optional - sage.libs.pari |
2555 | 2561 | Traceback (most recent call last): |
2556 | 2562 | ... |
2557 | 2563 | ValueError: base field must have characteristic zero |
@@ -2991,8 +2997,8 @@ def matroid(self): |
2991 | 2997 | intersection lattice:: |
2992 | 2998 |
|
2993 | 2999 | sage: f = sum([list(M.flats(i)) for i in range(M.rank()+1)], []) |
2994 | | - sage: PF = Poset([f, lambda x,y: x < y]) |
2995 | | - sage: PF.is_isomorphic(A.intersection_poset()) |
| 3000 | + sage: PF = Poset([f, lambda x, y: x < y]) # optional - sage.combinat |
| 3001 | + sage: PF.is_isomorphic(A.intersection_poset()) # optional - sage.combinat |
2996 | 3002 | True |
2997 | 3003 | """ |
2998 | 3004 | if not self.is_central(): |
|
0 commit comments