Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/schemes/toric/library.py
8820 views
1
r"""
2
Library of toric varieties
3
4
This module provides a simple way to construct often-used toric
5
varieties. Please see the help for the individual methods of
6
``toric_varieties`` for a more detailed description of which varieties
7
can be constructed.
8
9
AUTHORS:
10
11
- Volker Braun (2010-07-02): initial version
12
13
EXAMPLES::
14
15
sage: toric_varieties.dP6()
16
2-d CPR-Fano toric variety covered by 6 affine patches
17
18
You can assign the homogeneous coordinates to Sage variables either
19
with
20
:meth:`~sage.schemes.toric.variety.ToricVariety_field.inject_variables`
21
or immediately during assignment like this::
22
23
sage: P2.<x,y,z> = toric_varieties.P2()
24
sage: x^2 + y^2 + z^2
25
x^2 + y^2 + z^2
26
sage: P2.coordinate_ring()
27
Multivariate Polynomial Ring in x, y, z over Rational Field
28
"""
29
30
#*****************************************************************************
31
# Copyright (C) 2010 Volker Braun <[email protected]>
32
# Copyright (C) 2010 Andrey Novoseltsev <[email protected]>
33
#
34
# Distributed under the terms of the GNU General Public License (GPL)
35
#
36
# http://www.gnu.org/licenses/
37
#*****************************************************************************
38
39
from sage.structure.sage_object import SageObject
40
41
from sage.matrix.all import matrix, identity_matrix
42
from sage.geometry.fan import Fan
43
from sage.geometry.toric_lattice import ToricLattice
44
from sage.geometry.lattice_polytope import LatticePolytope
45
from sage.rings.all import ZZ, QQ, gcd
46
from sage.schemes.toric.variety import (DEFAULT_PREFIX,
47
ToricVariety,
48
normalize_names)
49
from sage.schemes.toric.fano_variety import CPRFanoToricVariety
50
from sage.categories.fields import Fields
51
_Fields = Fields()
52
53
54
55
# The combinatorial data of the toric varieties is stored separately here
56
# since we might want to use it later on to do the reverse lookup.
57
toric_varieties_rays_cones = {
58
'dP6':[
59
[(0, 1), (-1, 0), (-1, -1), (0, -1), (1, 0), (1, 1)],
60
[[0,1],[1,2],[2,3],[3,4],[4,5],[5,0]] ],
61
'dP7':[
62
[(0, 1), (-1, 0), (-1, -1), (0, -1), (1, 0)],
63
[[0,1],[1,2],[2,3],[3,4],[4,0]] ],
64
'dP8':[
65
[(1,1), (0, 1), (-1, -1), (1, 0)],
66
[[0,1],[1,2],[2,3],[3,0]]
67
],
68
'P1xP1':[
69
[(1, 0), (-1, 0), (0, 1), (0, -1)],
70
[[0,2],[2,1],[1,3],[3,0]] ],
71
'P1xP1_Z2':[
72
[(1, 1), (-1, -1), (-1, 1), (1, -1)],
73
[[0,2],[2,1],[1,3],[3,0]] ],
74
'P1':[
75
[(1,), (-1,)],
76
[[0],[1]] ],
77
'P2':[
78
[(1,0), (0, 1), (-1, -1)],
79
[[0,1],[1,2],[2,0]] ],
80
'A1':[
81
[(1,)],
82
[[0]] ],
83
'A2':[
84
[(1, 0), (0, 1)],
85
[[0,1]] ],
86
'A2_Z2':[
87
[(1, 0), (1, 2)],
88
[[0,1]] ],
89
'P1xA1':[
90
[(1, 0), (-1, 0), (0, 1)],
91
[[0,2],[2,1]] ],
92
'Conifold':[
93
[(0, 0, 1), (0, 1, 1), (1, 0, 1), (1, 1, 1)],
94
[[0,1,2,3]] ],
95
'dP6xdP6':[
96
[(0, 1, 0, 0), (-1, 0, 0, 0), (-1, -1, 0, 0),
97
(0, -1, 0, 0), (1, 0, 0, 0), (1, 1, 0, 0),
98
(0, 0, 0, 1), (0, 0, -1, 0), (0, 0, -1, -1),
99
(0, 0, 0, -1), (0, 0, 1, 0), (0, 0, 1, 1)],
100
[[0, 1, 6, 7], [0, 1, 7, 8], [0, 1, 8, 9], [0, 1, 9, 10],
101
[0, 1, 10, 11], [0, 1, 6, 11], [1, 2, 6, 7], [1, 2, 7, 8],
102
[1, 2, 8, 9], [1, 2, 9, 10], [1, 2, 10, 11], [1, 2, 6, 11],
103
[2, 3, 6, 7], [2, 3, 7, 8], [2, 3, 8, 9], [2, 3, 9, 10],
104
[2, 3, 10, 11], [2, 3, 6, 11], [3, 4, 6, 7], [3, 4, 7, 8],
105
[3, 4, 8, 9], [3, 4, 9, 10], [3, 4, 10, 11], [3, 4, 6, 11],
106
[4, 5, 6, 7], [4, 5, 7, 8], [4, 5, 8, 9], [4, 5, 9, 10],
107
[4, 5, 10, 11], [4, 5, 6, 11], [0, 5, 6, 7], [0, 5, 7, 8],
108
[0, 5, 8, 9], [0, 5, 9, 10], [0, 5, 10, 11], [0, 5, 6, 11]] ],
109
'Cube_face_fan':[
110
[(1, 1, 1), (1, -1, 1), (-1, 1, 1), (-1, -1, 1),
111
(-1, -1, -1), (-1, 1, -1), (1, -1, -1), (1, 1, -1)],
112
[[0,1,2,3], [4,5,6,7], [0,1,7,6], [4,5,3,2], [0,2,5,7], [4,6,1,3]] ],
113
'Cube_sublattice':[
114
[(1, 0, 0), (0, 1, 0), (0, 0, 1), (-1, 1, 1),
115
(-1, 0, 0), (0, -1, 0), (0, 0, -1), (1, -1, -1)],
116
[[0,1,2,3],[4,5,6,7],[0,1,7,6],[4,5,3,2],[0,2,5,7],[4,6,1,3]] ],
117
'Cube_nonpolyhedral':[
118
[(1, 2, 3), (1, -1, 1), (-1, 1, 1), (-1, -1, 1),
119
(-1, -1, -1), (-1, 1, -1), (1, -1, -1), (1, 1, -1)],
120
[[0,1,2,3],[4,5,6,7],[0,1,7,6],[4,5,3,2],[0,2,5,7],[4,6,1,3]] ],
121
'BCdlOG':[
122
[(-1, 0, 0, 2, 3), # 0
123
( 0,-1, 0, 2, 3), # 1
124
( 0, 0,-1, 2, 3), # 2
125
( 0, 0,-1, 1, 2), # 3
126
( 0, 0, 0,-1, 0), # 4
127
( 0, 0, 0, 0,-1), # 5
128
( 0, 0, 0, 2, 3), # 6
129
( 0, 0, 1, 2, 3), # 7
130
( 0, 0, 2, 2, 3), # 8
131
( 0, 0, 1, 1, 1), # 9
132
( 0, 1, 2, 2, 3), # 10
133
( 0, 1, 3, 2, 3), # 11
134
( 1, 0, 4, 2, 3)], # 12
135
[ [0,6,7,1,4], [0,6,10,2,4], [0,6,1,2,4], [0,9,7,1,5], [0,6,7,1,5],
136
[0,6,10,2,5], [0,6,1,2,5], [0,9,1,4,5], [0,6,10,4,11],[0,6,7,4,11],
137
[0,6,10,5,11], [0,9,7,5,11], [0,6,7,5,11], [0,9,4,5,11], [0,10,4,5,11],
138
[0,9,7,1,8], [0,9,1,4,8], [0,7,1,4,8], [0,9,7,11,8], [0,9,4,11,8],
139
[0,7,4,11,8], [0,10,2,4,3], [0,1,2,4,3], [0,10,2,5,3], [0,1,2,5,3],
140
[0,10,4,5,3], [0,1,4,5,3], [12,6,7,1,4], [12,6,10,2,4],[12,6,1,2,4],
141
[12,9,7,1,5], [12,6,7,1,5], [12,6,10,2,5], [12,6,1,2,5], [12,9,1,4,5],
142
[12,6,10,4,11],[12,6,7,4,11], [12,6,10,5,11],[12,9,7,5,11],[12,6,7,5,11],
143
[12,9,4,5,11], [12,10,4,5,11],[12,9,7,1,8], [12,9,1,4,8], [12,7,1,4,8],
144
[12,9,7,11,8], [12,9,4,11,8], [12,7,4,11,8], [12,10,2,4,3],[12,1,2,4,3],
145
[12,10,2,5,3], [12,1,2,5,3], [12,10,4,5,3], [12,1,4,5,3] ] ],
146
'BCdlOG_base':[
147
[(-1, 0, 0),
148
( 0,-1, 0),
149
( 0, 0,-1),
150
( 0, 0, 1),
151
( 0, 1, 2),
152
( 0, 1, 3),
153
( 1, 0, 4)],
154
[[0,4,2],[0,4,5],[0,5,3],[0,1,3],[0,1,2],
155
[6,4,2],[6,4,5],[6,5,3],[6,1,3],[6,1,2]] ],
156
'P2_112':[
157
[(1,0), (0, 1), (-1, -2)],
158
[[0,1],[1,2],[2,0]] ],
159
'P2_123':[
160
[(1,0), (0, 1), (-2, -3)],
161
[[0,1],[1,2],[2,0]] ],
162
'P4_11169':[
163
[(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (-9, -6, -1, -1)],
164
[[0,1,2,3],[0,1,2,4],[0,1,3,4],[0,2,3,4],[1,2,3,4]] ],
165
'P4_11169_resolved':[
166
[(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (-9, -6, -1, -1), (-3, -2, 0, 0)],
167
[[0, 1, 2, 3], [0, 1, 3, 4], [0, 1, 2, 4], [1, 3, 4, 5], [0, 3, 4, 5],
168
[1, 2, 4, 5], [0, 2, 4, 5], [1, 2, 3, 5], [0, 2, 3, 5]] ],
169
'P4_11133':[
170
[(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (-3, -3, -1, -1)],
171
[[0,1,2,3],[0,1,2,4],[0,1,3,4],[0,2,3,4],[1,2,3,4]] ],
172
'P4_11133_resolved':[
173
[(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (-3, -3, -1, -1), (-1, -1, 0, 0)],
174
[[0, 1, 2, 3], [0, 1, 3, 4], [0, 1, 2, 4], [1, 3, 4, 5], [0, 3, 4, 5],
175
[1, 2, 4, 5], [0, 2, 4, 5], [1, 2, 3, 5], [0, 2, 3, 5]] ]
176
}
177
178
179
180
class ToricVarietyFactory(SageObject):
181
r"""
182
The methods of this class construct toric varieties.
183
184
.. WARNING::
185
186
You need not create instances of this class. Use the
187
already-provided object ``toric_varieties`` instead.
188
"""
189
190
_check = True
191
192
def _make_ToricVariety(self, name, coordinate_names, base_ring):
193
"""
194
Construct a toric variety and cache the result.
195
196
INPUT:
197
198
- ``name`` -- string. One of the pre-defined names in the
199
``toric_varieties_rays_cones`` data structure.
200
201
- ``coordinate_names`` -- A string describing the names of the
202
homogeneous coordinates of the toric variety.
203
204
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
205
the toric variety.
206
207
OUTPUT:
208
209
A :class:`toric variety
210
<sage.schemes.toric.variety.ToricVariety_field>`.
211
212
EXAMPLES::
213
214
sage: toric_varieties.A1() # indirect doctest
215
1-d affine toric variety
216
"""
217
rays, cones = toric_varieties_rays_cones[name]
218
if coordinate_names is None:
219
dict_key = (name, base_ring)
220
else:
221
coordinate_names = normalize_names(coordinate_names, len(rays),
222
DEFAULT_PREFIX)
223
dict_key = (name, base_ring) + tuple(coordinate_names)
224
if dict_key not in self.__dict__:
225
fan = Fan(cones, rays, check=self._check)
226
self.__dict__[dict_key] = \
227
ToricVariety(fan,
228
coordinate_names=coordinate_names,
229
base_ring=base_ring)
230
return self.__dict__[dict_key]
231
232
def _make_CPRFanoToricVariety(self, name, coordinate_names, base_ring):
233
"""
234
Construct a (crepant partially resolved) Fano toric variety
235
and cache the result.
236
237
INPUT:
238
239
- ``name`` -- string. One of the pre-defined names in the
240
``toric_varieties_rays_cones`` data structure.
241
242
- ``coordinate_names`` -- A string describing the names of the
243
homogeneous coordinates of the toric variety.
244
245
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
246
the toric variety.
247
248
OUTPUT:
249
250
A :class:`CPR-Fano toric variety
251
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
252
253
EXAMPLES::
254
255
sage: toric_varieties.P2() # indirect doctest
256
2-d CPR-Fano toric variety covered by 3 affine patches
257
"""
258
rays, cones = toric_varieties_rays_cones[name]
259
if coordinate_names is None:
260
dict_key = (name, base_ring)
261
else:
262
coordinate_names = normalize_names(coordinate_names, len(rays),
263
DEFAULT_PREFIX)
264
dict_key = (name, base_ring) + tuple(coordinate_names)
265
if dict_key not in self.__dict__:
266
polytope = LatticePolytope( matrix(rays).transpose() )
267
points = map(tuple, polytope.points().columns())
268
ray2point = [points.index(r) for r in rays]
269
charts = [ [ray2point[i] for i in c] for c in cones ]
270
self.__dict__[dict_key] = \
271
CPRFanoToricVariety(Delta_polar=polytope,
272
coordinate_points=ray2point,
273
charts=charts,
274
coordinate_names=coordinate_names,
275
base_ring=base_ring,
276
check=self._check)
277
return self.__dict__[dict_key]
278
279
def dP6(self, names='x u y v z w', base_ring=QQ):
280
r"""
281
Construct the del Pezzo surface of degree 6 (`\mathbb{P}^2`
282
blown up at 3 points) as a toric variety.
283
284
INPUT:
285
286
- ``names`` -- string. Names for the homogeneous
287
coordinates. See
288
:func:`~sage.schemes.toric.variety.normalize_names`
289
for acceptable formats.
290
291
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
292
the toric variety.
293
294
OUTPUT:
295
296
A :class:`CPR-Fano toric variety
297
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
298
299
EXAMPLES::
300
301
sage: dP6 = toric_varieties.dP6()
302
sage: dP6
303
2-d CPR-Fano toric variety covered by 6 affine patches
304
sage: dP6.fan().rays()
305
N( 0, 1),
306
N(-1, 0),
307
N(-1, -1),
308
N( 0, -1),
309
N( 1, 0),
310
N( 1, 1)
311
in 2-d lattice N
312
sage: dP6.gens()
313
(x, u, y, v, z, w)
314
"""
315
return self._make_CPRFanoToricVariety('dP6', names, base_ring)
316
317
def dP7(self, names='x u y v z', base_ring=QQ):
318
r"""
319
Construct the del Pezzo surface of degree 7 (`\mathbb{P}^2`
320
blown up at 2 points) as a toric variety.
321
322
INPUT:
323
324
- ``names`` -- string. Names for the homogeneous
325
coordinates. See
326
:func:`~sage.schemes.toric.variety.normalize_names`
327
for acceptable formats.
328
329
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
330
the toric variety.
331
332
OUTPUT:
333
334
A :class:`CPR-Fano toric variety
335
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
336
337
EXAMPLES::
338
339
sage: dP7 = toric_varieties.dP7()
340
sage: dP7
341
2-d CPR-Fano toric variety covered by 5 affine patches
342
sage: dP7.fan().rays()
343
N( 0, 1),
344
N(-1, 0),
345
N(-1, -1),
346
N( 0, -1),
347
N( 1, 0)
348
in 2-d lattice N
349
sage: dP7.gens()
350
(x, u, y, v, z)
351
"""
352
return self._make_CPRFanoToricVariety('dP7', names, base_ring)
353
354
def dP8(self, names='t x y z', base_ring=QQ):
355
r"""
356
Construct the del Pezzo surface of degree 8 (`\mathbb{P}^2`
357
blown up at 1 point) as a toric variety.
358
359
INPUT:
360
361
- ``names`` -- string. Names for the homogeneous
362
coordinates. See
363
:func:`~sage.schemes.toric.variety.normalize_names`
364
for acceptable formats.
365
366
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
367
the toric variety.
368
369
OUTPUT:
370
371
A :class:`CPR-Fano toric variety
372
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
373
374
EXAMPLES::
375
376
sage: dP8 = toric_varieties.dP8()
377
sage: dP8
378
2-d CPR-Fano toric variety covered by 4 affine patches
379
sage: dP8.fan().rays()
380
N( 1, 1),
381
N( 0, 1),
382
N(-1, -1),
383
N( 1, 0)
384
in 2-d lattice N
385
sage: dP8.gens()
386
(t, x, y, z)
387
"""
388
return self._make_CPRFanoToricVariety('dP8', names, base_ring)
389
390
def P1xP1(self, names='s t x y', base_ring=QQ):
391
r"""
392
Construct the del Pezzo surface `\mathbb{P}^1 \times
393
\mathbb{P}^1` as a toric variety.
394
395
INPUT:
396
397
- ``names`` -- string. Names for the homogeneous
398
coordinates. See
399
:func:`~sage.schemes.toric.variety.normalize_names`
400
for acceptable formats.
401
402
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
403
the toric variety.
404
405
OUTPUT:
406
407
A :class:`CPR-Fano toric variety
408
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
409
410
EXAMPLES::
411
412
sage: P1xP1 = toric_varieties.P1xP1()
413
sage: P1xP1
414
2-d CPR-Fano toric variety covered by 4 affine patches
415
sage: P1xP1.fan().rays()
416
N( 1, 0),
417
N(-1, 0),
418
N( 0, 1),
419
N( 0, -1)
420
in 2-d lattice N
421
sage: P1xP1.gens()
422
(s, t, x, y)
423
"""
424
return self._make_CPRFanoToricVariety('P1xP1', names, base_ring)
425
426
def P1xP1_Z2(self, names='s t x y', base_ring=QQ):
427
r"""
428
Construct the toric `\mathbb{Z}_2`-orbifold of the del Pezzo
429
surface `\mathbb{P}^1 \times \mathbb{P}^1` as a toric variety.
430
431
INPUT:
432
433
- ``names`` -- string. Names for the homogeneous
434
coordinates. See
435
:func:`~sage.schemes.toric.variety.normalize_names`
436
for acceptable formats.
437
438
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
439
the toric variety.
440
441
OUTPUT:
442
443
A :class:`CPR-Fano toric variety
444
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
445
446
EXAMPLES::
447
448
sage: P1xP1_Z2 = toric_varieties.P1xP1_Z2()
449
sage: P1xP1_Z2
450
2-d CPR-Fano toric variety covered by 4 affine patches
451
sage: P1xP1_Z2.fan().rays()
452
N( 1, 1),
453
N(-1, -1),
454
N(-1, 1),
455
N( 1, -1)
456
in 2-d lattice N
457
sage: P1xP1_Z2.gens()
458
(s, t, x, y)
459
sage: P1xP1_Z2.Chow_group().degree(1)
460
C2 x Z^2
461
"""
462
return self._make_CPRFanoToricVariety('P1xP1_Z2', names, base_ring)
463
464
def P1(self, names='s t', base_ring=QQ):
465
r"""
466
Construct the projective line `\mathbb{P}^1` as a toric
467
variety.
468
469
INPUT:
470
471
- ``names`` -- string. Names for the homogeneous
472
coordinates. See
473
:func:`~sage.schemes.toric.variety.normalize_names`
474
for acceptable formats.
475
476
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
477
the toric variety.
478
479
OUTPUT:
480
481
A :class:`CPR-Fano toric variety
482
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
483
484
EXAMPLES::
485
486
sage: P1 = toric_varieties.P1()
487
sage: P1
488
1-d CPR-Fano toric variety covered by 2 affine patches
489
sage: P1.fan().rays()
490
N( 1),
491
N(-1)
492
in 1-d lattice N
493
sage: P1.gens()
494
(s, t)
495
"""
496
return self._make_CPRFanoToricVariety('P1', names, base_ring)
497
498
def P2(self, names='x y z', base_ring=QQ):
499
r"""
500
Construct the projective plane `\mathbb{P}^2` as a toric
501
variety.
502
503
INPUT:
504
505
- ``names`` -- string. Names for the homogeneous
506
coordinates. See
507
:func:`~sage.schemes.toric.variety.normalize_names`
508
for acceptable formats.
509
510
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
511
the toric variety.
512
513
OUTPUT:
514
515
A :class:`CPR-Fano toric variety
516
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
517
518
EXAMPLES::
519
520
sage: P2 = toric_varieties.P2()
521
sage: P2
522
2-d CPR-Fano toric variety covered by 3 affine patches
523
sage: P2.fan().rays()
524
N( 1, 0),
525
N( 0, 1),
526
N(-1, -1)
527
in 2-d lattice N
528
sage: P2.gens()
529
(x, y, z)
530
"""
531
return self._make_CPRFanoToricVariety('P2', names, base_ring)
532
533
def P(self, n, names='z+', base_ring=QQ):
534
r"""
535
Construct the ``n``-dimensional projective space `\mathbb{P}^n`.
536
537
INPUT:
538
539
- ``n`` -- positive integer. The dimension of the projective space.
540
541
- ``names`` -- string. Names for the homogeneous
542
coordinates. See
543
:func:`~sage.schemes.toric.variety.normalize_names`
544
for acceptable formats.
545
546
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
547
the toric variety.
548
549
OUTPUT:
550
551
A :class:`CPR-Fano toric variety
552
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
553
554
EXAMPLES::
555
556
sage: P3 = toric_varieties.P(3)
557
sage: P3
558
3-d CPR-Fano toric variety covered by 4 affine patches
559
sage: P3.fan().rays()
560
N( 1, 0, 0),
561
N( 0, 1, 0),
562
N( 0, 0, 1),
563
N(-1, -1, -1)
564
in 3-d lattice N
565
sage: P3.gens()
566
(z0, z1, z2, z3)
567
"""
568
# We are going to eventually switch off consistency checks, so we need
569
# to be sure that the input is acceptable.
570
try:
571
n = ZZ(n) # make sure that we got a "mathematical" integer
572
except TypeError:
573
raise TypeError("dimension of the projective space must be a "
574
"positive integer!\nGot: %s" % n)
575
if n <= 0:
576
raise ValueError("only projective spaces of positive dimension "
577
"can be constructed!\nGot: %s" % n)
578
m = identity_matrix(n).augment(matrix(n, 1, [-1]*n))
579
charts = [ range(0,i)+range(i+1,n+1) for i in range(0,n+1) ]
580
return CPRFanoToricVariety(Delta_polar=LatticePolytope(m),
581
charts=charts, check=self._check,
582
coordinate_names=names, base_ring=base_ring)
583
584
def A1(self, names='z', base_ring=QQ):
585
r"""
586
Construct the affine line `\mathbb{A}^1` as a toric variety.
587
588
INPUT:
589
590
- ``names`` -- string. Names for the homogeneous
591
coordinates. See
592
:func:`~sage.schemes.toric.variety.normalize_names`
593
for acceptable formats.
594
595
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
596
the toric variety.
597
598
OUTPUT:
599
600
A :class:`toric variety
601
<sage.schemes.toric.variety.ToricVariety_field>`.
602
603
EXAMPLES::
604
605
sage: A1 = toric_varieties.A1()
606
sage: A1
607
1-d affine toric variety
608
sage: A1.fan().rays()
609
N(1)
610
in 1-d lattice N
611
sage: A1.gens()
612
(z,)
613
"""
614
return self._make_ToricVariety('A1', names, base_ring)
615
616
def A2(self, names='x y', base_ring=QQ):
617
r"""
618
Construct the affine plane `\mathbb{A}^2` as a toric variety.
619
620
INPUT:
621
622
- ``names`` -- string. Names for the homogeneous
623
coordinates. See
624
:func:`~sage.schemes.toric.variety.normalize_names`
625
for acceptable formats.
626
627
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
628
the toric variety.
629
630
OUTPUT:
631
632
A :class:`toric variety
633
<sage.schemes.toric.variety.ToricVariety_field>`.
634
635
EXAMPLES::
636
637
sage: A2 = toric_varieties.A2()
638
sage: A2
639
2-d affine toric variety
640
sage: A2.fan().rays()
641
N(1, 0),
642
N(0, 1)
643
in 2-d lattice N
644
sage: A2.gens()
645
(x, y)
646
"""
647
return self._make_ToricVariety('A2', names, base_ring)
648
649
def A(self, n, names='z+', base_ring=QQ):
650
r"""
651
Construct the ``n``-dimensional affine space.
652
653
INPUT:
654
655
- ``n`` -- positive integer. The dimension of the affine space.
656
657
- ``names`` -- string. Names for the homogeneous
658
coordinates. See
659
:func:`~sage.schemes.toric.variety.normalize_names`
660
for acceptable formats.
661
662
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
663
the toric variety.
664
665
OUTPUT:
666
667
A :class:`toric variety
668
<sage.schemes.toric.variety.ToricVariety_field>`.
669
670
EXAMPLES::
671
672
sage: A3 = toric_varieties.A(3)
673
sage: A3
674
3-d affine toric variety
675
sage: A3.fan().rays()
676
N(1, 0, 0),
677
N(0, 1, 0),
678
N(0, 0, 1)
679
in 3-d lattice N
680
sage: A3.gens()
681
(z0, z1, z2)
682
"""
683
# We are going to eventually switch off consistency checks, so we need
684
# to be sure that the input is acceptable.
685
try:
686
n = ZZ(n) # make sure that we got a "mathematical" integer
687
except TypeError:
688
raise TypeError("dimension of the affine space must be a "
689
"positive integer!\nGot: %s" % n)
690
if n <= 0:
691
raise ValueError("only affine spaces of positive dimension can "
692
"be constructed!\nGot: %s" % n)
693
rays = identity_matrix(n).columns()
694
cones = [ range(0,n) ]
695
fan = Fan(cones, rays, check=self._check)
696
return ToricVariety(fan, coordinate_names=names)
697
698
def A2_Z2(self, names='x y', base_ring=QQ):
699
r"""
700
Construct the orbifold `\mathbb{A}^2 / \ZZ_2` as a toric
701
variety.
702
703
INPUT:
704
705
- ``names`` -- string. Names for the homogeneous
706
coordinates. See
707
:func:`~sage.schemes.toric.variety.normalize_names`
708
for acceptable formats.
709
710
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
711
the toric variety.
712
713
OUTPUT:
714
715
A :class:`toric variety
716
<sage.schemes.toric.variety.ToricVariety_field>`.
717
718
EXAMPLES::
719
720
sage: A2_Z2 = toric_varieties.A2_Z2()
721
sage: A2_Z2
722
2-d affine toric variety
723
sage: A2_Z2.fan().rays()
724
N(1, 0),
725
N(1, 2)
726
in 2-d lattice N
727
sage: A2_Z2.gens()
728
(x, y)
729
"""
730
return self._make_ToricVariety('A2_Z2', names, base_ring)
731
732
def P1xA1(self, names='s t z', base_ring=QQ):
733
r"""
734
Construct the cartesian product `\mathbb{P}^1 \times \mathbb{A}^1` as
735
a toric variety.
736
737
INPUT:
738
739
- ``names`` -- string. Names for the homogeneous
740
coordinates. See
741
:func:`~sage.schemes.toric.variety.normalize_names`
742
for acceptable formats.
743
744
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
745
the toric variety.
746
747
OUTPUT:
748
749
A :class:`toric variety
750
<sage.schemes.toric.variety.ToricVariety_field>`.
751
752
EXAMPLES::
753
754
sage: P1xA1 = toric_varieties.P1xA1()
755
sage: P1xA1
756
2-d toric variety covered by 2 affine patches
757
sage: P1xA1.fan().rays()
758
N( 1, 0),
759
N(-1, 0),
760
N( 0, 1)
761
in 2-d lattice N
762
sage: P1xA1.gens()
763
(s, t, z)
764
"""
765
return self._make_ToricVariety('P1xA1', names, base_ring)
766
767
def Conifold(self, names='u x y v', base_ring=QQ):
768
r"""
769
Construct the conifold as a toric variety.
770
771
INPUT:
772
773
- ``names`` -- string. Names for the homogeneous
774
coordinates. See
775
:func:`~sage.schemes.toric.variety.normalize_names`
776
for acceptable formats.
777
778
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
779
the toric variety.
780
781
OUTPUT:
782
783
A :class:`toric variety
784
<sage.schemes.toric.variety.ToricVariety_field>`.
785
786
EXAMPLES::
787
788
sage: Conifold = toric_varieties.Conifold()
789
sage: Conifold
790
3-d affine toric variety
791
sage: Conifold.fan().rays()
792
N(0, 0, 1),
793
N(0, 1, 1),
794
N(1, 0, 1),
795
N(1, 1, 1)
796
in 3-d lattice N
797
sage: Conifold.gens()
798
(u, x, y, v)
799
"""
800
return self._make_ToricVariety('Conifold', names, base_ring)
801
802
def dP6xdP6(self, names='x0 x1 x2 x3 x4 x5 y0 y1 y2 y3 y4 y5', base_ring=QQ):
803
r"""
804
Construct the product of two del Pezzo surfaces of degree 6
805
(`\mathbb{P}^2` blown up at 3 points) as a toric variety.
806
807
INPUT:
808
809
- ``names`` -- string. Names for the homogeneous
810
coordinates. See
811
:func:`~sage.schemes.toric.variety.normalize_names`
812
for acceptable formats.
813
814
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
815
the toric variety.
816
817
OUTPUT:
818
819
A :class:`CPR-Fano toric variety
820
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
821
822
EXAMPLES::
823
824
sage: dP6xdP6 = toric_varieties.dP6xdP6()
825
sage: dP6xdP6
826
4-d CPR-Fano toric variety covered by 36 affine patches
827
sage: dP6xdP6.fan().rays()
828
N( 0, 1, 0, 0),
829
N(-1, 0, 0, 0),
830
N(-1, -1, 0, 0),
831
N( 0, -1, 0, 0),
832
N( 1, 0, 0, 0),
833
N( 1, 1, 0, 0),
834
N( 0, 0, 0, 1),
835
N( 0, 0, -1, 0),
836
N( 0, 0, -1, -1),
837
N( 0, 0, 0, -1),
838
N( 0, 0, 1, 0),
839
N( 0, 0, 1, 1)
840
in 4-d lattice N
841
sage: dP6xdP6.gens()
842
(x0, x1, x2, x3, x4, x5, y0, y1, y2, y3, y4, y5)
843
"""
844
return self._make_CPRFanoToricVariety('dP6xdP6', names, base_ring)
845
846
def Cube_face_fan(self, names='z+', base_ring=QQ):
847
r"""
848
Construct the toric variety given by the face fan of the
849
3-dimensional unit lattice cube.
850
851
This variety has 6 conifold singularities but the fan is still
852
polyhedral.
853
854
INPUT:
855
856
- ``names`` -- string. Names for the homogeneous
857
coordinates. See
858
:func:`~sage.schemes.toric.variety.normalize_names`
859
for acceptable formats.
860
861
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
862
the toric variety.
863
864
OUTPUT:
865
866
A :class:`CPR-Fano toric variety
867
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
868
869
EXAMPLES::
870
871
sage: Cube_face_fan = toric_varieties.Cube_face_fan()
872
sage: Cube_face_fan
873
3-d CPR-Fano toric variety covered by 6 affine patches
874
sage: Cube_face_fan.fan().rays()
875
N( 1, 1, 1),
876
N( 1, -1, 1),
877
N(-1, 1, 1),
878
N(-1, -1, 1),
879
N(-1, -1, -1),
880
N(-1, 1, -1),
881
N( 1, -1, -1),
882
N( 1, 1, -1)
883
in 3-d lattice N
884
sage: Cube_face_fan.gens()
885
(z0, z1, z2, z3, z4, z5, z6, z7)
886
"""
887
return self._make_CPRFanoToricVariety('Cube_face_fan', names, base_ring)
888
889
def Cube_sublattice(self, names='z+', base_ring=QQ):
890
r"""
891
Construct the toric variety defined by a face fan over a
892
3-dimensional cube, but not the unit cube in the
893
N-lattice. See [FultonP65]_.
894
895
Its Chow group is `A_2(X)=\mathbb{Z}^5`, which distinguishes
896
it from the face fan of the unit cube.
897
898
INPUT:
899
900
- ``names`` -- string. Names for the homogeneous
901
coordinates. See
902
:func:`~sage.schemes.toric.variety.normalize_names`
903
for acceptable formats.
904
905
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
906
the toric variety.
907
908
OUTPUT:
909
910
A :class:`CPR-Fano toric variety
911
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
912
913
EXAMPLES::
914
915
sage: Cube_sublattice = toric_varieties.Cube_sublattice()
916
sage: Cube_sublattice
917
3-d CPR-Fano toric variety covered by 6 affine patches
918
sage: Cube_sublattice.fan().rays()
919
N( 1, 0, 0),
920
N( 0, 1, 0),
921
N( 0, 0, 1),
922
N(-1, 1, 1),
923
N(-1, 0, 0),
924
N( 0, -1, 0),
925
N( 0, 0, -1),
926
N( 1, -1, -1)
927
in 3-d lattice N
928
sage: Cube_sublattice.gens()
929
(z0, z1, z2, z3, z4, z5, z6, z7)
930
931
REFERENCES:
932
933
.. [FultonP65]
934
Page 65, 3rd exercise (Section 3.4) of Wiliam Fulton,
935
"Introduction to Toric Varieties", Princeton University
936
Press
937
"""
938
return self._make_CPRFanoToricVariety('Cube_sublattice', names, base_ring)
939
940
def Cube_nonpolyhedral(self, names='z+', base_ring=QQ):
941
r"""
942
Construct the toric variety defined by a fan that is not the
943
face fan of a polyhedron.
944
945
This toric variety is defined by a fan that is topologically
946
like the face fan of a 3-dimensional cube, but with a
947
different N-lattice structure.
948
949
INPUT:
950
951
- ``names`` -- string. Names for the homogeneous
952
coordinates. See
953
:func:`~sage.schemes.toric.variety.normalize_names`
954
for acceptable formats.
955
956
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
957
the toric variety.
958
959
OUTPUT:
960
961
A :class:`toric variety
962
<sage.schemes.toric.variety.ToricVariety_field>`.
963
964
NOTES:
965
966
* This is an example of an non-polyhedral fan.
967
968
* Its Chow group has torsion: `A_2(X)=\ZZ^5 \oplus \ZZ_2`
969
970
EXAMPLES::
971
972
sage: Cube_nonpolyhedral = toric_varieties.Cube_nonpolyhedral()
973
sage: Cube_nonpolyhedral
974
3-d toric variety covered by 6 affine patches
975
sage: Cube_nonpolyhedral.fan().rays()
976
N( 1, 2, 3),
977
N( 1, -1, 1),
978
N(-1, 1, 1),
979
N(-1, -1, 1),
980
N(-1, -1, -1),
981
N(-1, 1, -1),
982
N( 1, -1, -1),
983
N( 1, 1, -1)
984
in 3-d lattice N
985
sage: Cube_nonpolyhedral.gens()
986
(z0, z1, z2, z3, z4, z5, z6, z7)
987
"""
988
return self._make_ToricVariety('Cube_nonpolyhedral', names, base_ring)
989
990
def Cube_deformation(self,k, names=None, base_ring=QQ):
991
r"""
992
Construct, for each `k\in\ZZ_{\geq 0}`, a toric variety with
993
`\ZZ_k`-torsion in the Chow group.
994
995
The fans of this sequence of toric varieties all equal the
996
face fan of a unit cube topologically, but the
997
``(1,1,1)``-vertex is moved to ``(1,1,2k+1)``. This example
998
was studied in [FS]_.
999
1000
INPUT:
1001
1002
- ``k`` -- integer. The case ``k=0`` is the same as
1003
:meth:`Cube_face_fan`.
1004
1005
- ``names`` -- string. Names for the homogeneous
1006
coordinates. See
1007
:func:`~sage.schemes.toric.variety.normalize_names`
1008
for acceptable formats.
1009
1010
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1011
the toric variety.
1012
1013
OUTPUT:
1014
1015
A :class:`toric variety
1016
<sage.schemes.toric.variety.ToricVariety_field>`
1017
`X_k`. Its Chow group is `A_1(X_k)=\ZZ_k`.
1018
1019
EXAMPLES::
1020
1021
sage: X_2 = toric_varieties.Cube_deformation(2)
1022
sage: X_2
1023
3-d toric variety covered by 6 affine patches
1024
sage: X_2.fan().rays()
1025
N( 1, 1, 5),
1026
N( 1, -1, 1),
1027
N(-1, 1, 1),
1028
N(-1, -1, 1),
1029
N(-1, -1, -1),
1030
N(-1, 1, -1),
1031
N( 1, -1, -1),
1032
N( 1, 1, -1)
1033
in 3-d lattice N
1034
sage: X_2.gens()
1035
(z0, z1, z2, z3, z4, z5, z6, z7)
1036
1037
REFERENCES:
1038
1039
.. [FS]
1040
William Fulton, Bernd Sturmfels, "Intersection Theory on
1041
Toric Varieties", http://arxiv.org/abs/alg-geom/9403002
1042
"""
1043
# We are going to eventually switch off consistency checks, so we need
1044
# to be sure that the input is acceptable.
1045
try:
1046
k = ZZ(k) # make sure that we got a "mathematical" integer
1047
except TypeError:
1048
raise TypeError("cube deformations X_k are defined only for "
1049
"non-negative integer k!\nGot: %s" % k)
1050
if k < 0:
1051
raise ValueError("cube deformations X_k are defined only for "
1052
"non-negative k!\nGot: %s" % k)
1053
rays = lambda kappa: matrix([[ 1, 1, 2*kappa+1],[ 1,-1, 1],[-1, 1, 1],[-1,-1, 1],
1054
[-1,-1,-1],[-1, 1,-1],[ 1,-1,-1],[ 1, 1,-1]])
1055
cones = [[0,1,2,3],[4,5,6,7],[0,1,7,6],[4,5,3,2],[0,2,5,7],[4,6,1,3]]
1056
fan = Fan(cones, rays(k))
1057
return ToricVariety(fan, coordinate_names=names)
1058
1059
def BCdlOG(self, names='v1 v2 c1 c2 v4 v5 b e1 e2 e3 f g v6', base_ring=QQ):
1060
r"""
1061
Construct the 5-dimensional toric variety studied in
1062
[BCdlOG]_, [HLY]_
1063
1064
INPUT:
1065
1066
- ``names`` -- string. Names for the homogeneous
1067
coordinates. See
1068
:func:`~sage.schemes.toric.variety.normalize_names`
1069
for acceptable formats.
1070
1071
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1072
the toric variety.
1073
1074
OUTPUT:
1075
1076
A :class:`CPR-Fano toric variety
1077
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1078
1079
EXAMPLES::
1080
1081
sage: X = toric_varieties.BCdlOG()
1082
sage: X
1083
5-d CPR-Fano toric variety covered by 54 affine patches
1084
sage: X.fan().rays()
1085
N(-1, 0, 0, 2, 3),
1086
N( 0, -1, 0, 2, 3),
1087
N( 0, 0, -1, 2, 3),
1088
N( 0, 0, -1, 1, 2),
1089
N( 0, 0, 0, -1, 0),
1090
N( 0, 0, 0, 0, -1),
1091
N( 0, 0, 0, 2, 3),
1092
N( 0, 0, 1, 2, 3),
1093
N( 0, 0, 2, 2, 3),
1094
N( 0, 0, 1, 1, 1),
1095
N( 0, 1, 2, 2, 3),
1096
N( 0, 1, 3, 2, 3),
1097
N( 1, 0, 4, 2, 3)
1098
in 5-d lattice N
1099
sage: X.gens()
1100
(v1, v2, c1, c2, v4, v5, b, e1, e2, e3, f, g, v6)
1101
1102
REFERENCES:
1103
1104
.. [BCdlOG]
1105
Volker Braun, Philip Candelas, Xendia de la Ossa,
1106
Antonella Grassi, "Toric Calabi-Yau Fourfolds, Duality
1107
Between N=1 Theories and Divisors that Contribute to the
1108
Superpotential", http://arxiv.org/abs/hep-th/0001208
1109
1110
.. [HLY]
1111
Yi Hu, Chien-Hao Liu, Shing-Tung Yau, "Toric morphisms and
1112
fibrations of toric Calabi-Yau hypersurfaces",
1113
http://arxiv.org/abs/math/0010082
1114
"""
1115
return self._make_CPRFanoToricVariety('BCdlOG', names, base_ring)
1116
1117
def BCdlOG_base(self, names='d4 d3 r2 r1 d2 u d1', base_ring=QQ):
1118
r"""
1119
Construct the base of the `\mathbb{P}^2(1,2,3)` fibration
1120
:meth:`BCdlOG`.
1121
1122
INPUT:
1123
1124
- ``names`` -- string. Names for the homogeneous
1125
coordinates. See
1126
:func:`~sage.schemes.toric.variety.normalize_names`
1127
for acceptable formats.
1128
1129
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1130
the toric variety.
1131
1132
OUTPUT:
1133
1134
A :class:`toric variety
1135
<sage.schemes.toric.variety.ToricVariety_field>`.
1136
1137
EXAMPLES::
1138
1139
sage: base = toric_varieties.BCdlOG_base()
1140
sage: base
1141
3-d toric variety covered by 10 affine patches
1142
sage: base.fan().rays()
1143
N(-1, 0, 0),
1144
N( 0, -1, 0),
1145
N( 0, 0, -1),
1146
N( 0, 0, 1),
1147
N( 0, 1, 2),
1148
N( 0, 1, 3),
1149
N( 1, 0, 4)
1150
in 3-d lattice N
1151
sage: base.gens()
1152
(d4, d3, r2, r1, d2, u, d1)
1153
"""
1154
return self._make_ToricVariety('BCdlOG_base', names, base_ring)
1155
1156
def P2_112(self, names='z+', base_ring=QQ):
1157
r"""
1158
Construct the weighted projective space
1159
`\mathbb{P}^2(1,1,2)`.
1160
1161
INPUT:
1162
1163
- ``names`` -- string. Names for the homogeneous
1164
coordinates. See
1165
:func:`~sage.schemes.toric.variety.normalize_names`
1166
for acceptable formats.
1167
1168
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1169
the toric variety.
1170
1171
OUTPUT:
1172
1173
A :class:`CPR-Fano toric variety
1174
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1175
1176
EXAMPLES::
1177
1178
sage: P2_112 = toric_varieties.P2_112()
1179
sage: P2_112
1180
2-d CPR-Fano toric variety covered by 3 affine patches
1181
sage: P2_112.fan().rays()
1182
N( 1, 0),
1183
N( 0, 1),
1184
N(-1, -2)
1185
in 2-d lattice N
1186
sage: P2_112.gens()
1187
(z0, z1, z2)
1188
"""
1189
return self._make_CPRFanoToricVariety('P2_112', names, base_ring)
1190
1191
def P2_123(self, names='z+', base_ring=QQ):
1192
r"""
1193
Construct the weighted projective space
1194
`\mathbb{P}^2(1,2,3)`.
1195
1196
INPUT:
1197
1198
- ``names`` -- string. Names for the homogeneous
1199
coordinates. See
1200
:func:`~sage.schemes.toric.variety.normalize_names`
1201
for acceptable formats.
1202
1203
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1204
the toric variety.
1205
1206
OUTPUT:
1207
1208
A :class:`CPR-Fano toric variety
1209
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1210
1211
EXAMPLES::
1212
1213
sage: P2_123 = toric_varieties.P2_123()
1214
sage: P2_123
1215
2-d CPR-Fano toric variety covered by 3 affine patches
1216
sage: P2_123.fan().rays()
1217
N( 1, 0),
1218
N( 0, 1),
1219
N(-2, -3)
1220
in 2-d lattice N
1221
sage: P2_123.gens()
1222
(z0, z1, z2)
1223
"""
1224
return self._make_CPRFanoToricVariety('P2_123', names, base_ring)
1225
1226
def P4_11169(self, names='z+', base_ring=QQ):
1227
r"""
1228
Construct the weighted projective space
1229
`\mathbb{P}^4(1,1,1,6,9)`.
1230
1231
INPUT:
1232
1233
- ``names`` -- string. Names for the homogeneous
1234
coordinates. See
1235
:func:`~sage.schemes.toric.variety.normalize_names`
1236
for acceptable formats.
1237
1238
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1239
the toric variety.
1240
1241
OUTPUT:
1242
1243
A :class:`CPR-Fano toric variety
1244
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1245
1246
EXAMPLES::
1247
1248
sage: P4_11169 = toric_varieties.P4_11169()
1249
sage: P4_11169
1250
4-d CPR-Fano toric variety covered by 5 affine patches
1251
sage: P4_11169.fan().rays()
1252
N( 1, 0, 0, 0),
1253
N( 0, 1, 0, 0),
1254
N( 0, 0, 1, 0),
1255
N( 0, 0, 0, 1),
1256
N(-9, -6, -1, -1)
1257
in 4-d lattice N
1258
sage: P4_11169.gens()
1259
(z0, z1, z2, z3, z4)
1260
"""
1261
return self._make_CPRFanoToricVariety('P4_11169', names, base_ring)
1262
1263
def P4_11169_resolved(self, names='z+', base_ring=QQ):
1264
r"""
1265
Construct the blow-up of the weighted projective space
1266
`\mathbb{P}^4(1,1,1,6,9)` at its curve of `\ZZ_3` orbifold
1267
fixed points.
1268
1269
INPUT:
1270
1271
- ``names`` -- string. Names for the homogeneous
1272
coordinates. See
1273
:func:`~sage.schemes.toric.variety.normalize_names`
1274
for acceptable formats.
1275
1276
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1277
the toric variety.
1278
1279
OUTPUT:
1280
1281
A :class:`CPR-Fano toric variety
1282
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1283
1284
EXAMPLES::
1285
1286
sage: P4_11169_resolved = toric_varieties.P4_11169_resolved()
1287
sage: P4_11169_resolved
1288
4-d CPR-Fano toric variety covered by 9 affine patches
1289
sage: P4_11169_resolved.fan().rays()
1290
N( 1, 0, 0, 0),
1291
N( 0, 1, 0, 0),
1292
N( 0, 0, 1, 0),
1293
N( 0, 0, 0, 1),
1294
N(-9, -6, -1, -1),
1295
N(-3, -2, 0, 0)
1296
in 4-d lattice N
1297
sage: P4_11169_resolved.gens()
1298
(z0, z1, z2, z3, z4, z5)
1299
"""
1300
return self._make_CPRFanoToricVariety('P4_11169_resolved', names, base_ring)
1301
1302
def P4_11133(self, names='z+', base_ring=QQ):
1303
"""
1304
Construct the weighted projective space
1305
`\mathbb{P}^4(1,1,1,3,3)`.
1306
1307
INPUT:
1308
1309
- ``names`` -- string. Names for the homogeneous
1310
coordinates. See
1311
:func:`~sage.schemes.toric.variety.normalize_names`
1312
for acceptable formats.
1313
1314
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1315
the toric variety.
1316
1317
OUTPUT:
1318
1319
A :class:`CPR-Fano toric variety
1320
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1321
1322
EXAMPLES::
1323
1324
sage: P4_11133 = toric_varieties.P4_11133()
1325
sage: P4_11133
1326
4-d CPR-Fano toric variety covered by 5 affine patches
1327
sage: P4_11133.fan().rays()
1328
N( 1, 0, 0, 0),
1329
N( 0, 1, 0, 0),
1330
N( 0, 0, 1, 0),
1331
N( 0, 0, 0, 1),
1332
N(-3, -3, -1, -1)
1333
in 4-d lattice N
1334
sage: P4_11133.gens()
1335
(z0, z1, z2, z3, z4)
1336
"""
1337
return self._make_CPRFanoToricVariety('P4_11133', names, base_ring)
1338
1339
def P4_11133_resolved(self, names='z+', base_ring=QQ):
1340
"""
1341
Construct the weighted projective space
1342
`\mathbb{P}^4(1,1,1,3,3)`.
1343
1344
INPUT:
1345
1346
- ``names`` -- string. Names for the homogeneous
1347
coordinates. See
1348
:func:`~sage.schemes.toric.variety.normalize_names`
1349
for acceptable formats.
1350
1351
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1352
the toric variety.
1353
1354
OUTPUT:
1355
1356
A :class:`CPR-Fano toric variety
1357
<sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1358
1359
EXAMPLES::
1360
1361
sage: P4_11133_resolved = toric_varieties.P4_11133_resolved()
1362
sage: P4_11133_resolved
1363
4-d CPR-Fano toric variety covered by 9 affine patches
1364
sage: P4_11133_resolved.fan().rays()
1365
N( 1, 0, 0, 0),
1366
N( 0, 1, 0, 0),
1367
N( 0, 0, 1, 0),
1368
N( 0, 0, 0, 1),
1369
N(-3, -3, -1, -1),
1370
N(-1, -1, 0, 0)
1371
in 4-d lattice N
1372
sage: P4_11133_resolved.gens()
1373
(z0, z1, z2, z3, z4, z5)
1374
"""
1375
return self._make_CPRFanoToricVariety('P4_11133_resolved', names, base_ring)
1376
1377
def WP(self, *q, **kw):
1378
# Specific keyword arguments instead of **kw would be preferable,
1379
# later versions of Python might support specific (optional) keyword
1380
# arguments after *q.
1381
r"""
1382
Construct weighted projective `n`-space over a field.
1383
1384
INPUT:
1385
1386
- ``q`` -- a sequence of positive integers relatively prime to
1387
one another. The weights ``q`` can be given either as a list
1388
or tuple, or as positional arguments.
1389
1390
Two keyword arguments:
1391
1392
- ``base_ring`` -- a field (default: `\QQ`).
1393
1394
- ``names`` -- string or list (tuple) of strings (default 'z+'). See
1395
:func:`~sage.schemes.toric.variety.normalize_names` for
1396
acceptable formats.
1397
1398
OUTPUT:
1399
1400
- A :class:`toric variety
1401
<sage.schemes.toric.variety.ToricVariety_field>`. If
1402
`q=(q_0,\dots,q_n)`, then the output is the weighted
1403
projective space `\mathbb{P}(q_0,\dots,q_n)` over
1404
``base_ring``. ``names`` are the names of the generators of
1405
the homogeneous coordinate ring.
1406
1407
EXAMPLES:
1408
1409
A hyperelliptic curve `C` of genus 2 as a subscheme of the weighted
1410
projective plane `\mathbb{P}(1,3,1)`::
1411
1412
sage: X = toric_varieties.WP([1,3,1], names='x y z')
1413
sage: X.inject_variables()
1414
Defining x, y, z
1415
sage: g = y^2-(x^6-z^6)
1416
sage: C = X.subscheme([g]); C
1417
Closed subscheme of 2-d toric variety covered by 3 affine patches defined by:
1418
-x^6 + z^6 + y^2
1419
"""
1420
if len(q)==1:
1421
# tuples and lists of weights are acceptable input
1422
if isinstance(q[0], (list, tuple)):
1423
q = q[0]
1424
q = list(q)
1425
m = len(q)
1426
# allow case q=[1]? (not allowed presently)
1427
if m < 2:
1428
raise ValueError("more than one weight must be provided (got %s)" % q)
1429
for i in range(m):
1430
try:
1431
q[i] = ZZ(q[i])
1432
except(TypeError):
1433
raise TypeError("the weights (=%s) must be integers" % q)
1434
if q[i] <= 0:
1435
raise ValueError("the weights (=%s) must be positive integers" % q)
1436
if not gcd(q) == 1:
1437
raise ValueError("the weights (=%s) must be relatively prime" % q)
1438
1439
# set default values for base_ring and names
1440
base_ring = QQ
1441
names = 'z+'
1442
for key in kw:
1443
if key == 'K':
1444
base_ring = kw['K']
1445
elif key == 'base_ring':
1446
base_ring = kw['base_ring']
1447
elif key == 'names':
1448
names = kw['names']
1449
names = normalize_names(names, m, DEFAULT_PREFIX)
1450
else:
1451
raise TypeError("got an unexpected keyword argument %r" % key)
1452
if base_ring not in _Fields:
1453
raise TypeError("base_ring (=%r) must be a field" % base_ring)
1454
1455
L = ToricLattice(m)
1456
L_sub = L.submodule([L(q)])
1457
Q = L/L_sub
1458
rays = []
1459
cones = []
1460
w = range(m)
1461
L_basis = L.basis()
1462
for i in w:
1463
b = L_basis[i]
1464
v = Q.coordinate_vector(Q(b))
1465
rays = rays + [v]
1466
w_c = w[:i] + w[i+1:]
1467
cones = cones + [tuple(w_c)]
1468
fan = Fan(cones,rays)
1469
return ToricVariety(fan, coordinate_names=names, base_ring=base_ring)
1470
1471
def torus(self, n, names='z+', base_ring=QQ):
1472
r"""
1473
Construct the ``n``-dimensional algebraic torus `(\mathbb{F}^\times)^n`.
1474
1475
INPUT:
1476
1477
- ``n`` -- non-negative integer. The dimension of the algebraic torus.
1478
1479
- ``names`` -- string. Names for the homogeneous
1480
coordinates. See
1481
:func:`~sage.schemes.toric.variety.normalize_names`
1482
for acceptable formats.
1483
1484
- ``base_ring`` -- a ring (default: `\QQ`). The base ring for
1485
the toric variety.
1486
1487
OUTPUT:
1488
1489
A :class:`toric variety
1490
<sage.schemes.toric.variety.ToricVariety_field>`.
1491
1492
EXAMPLES::
1493
1494
sage: T3 = toric_varieties.torus(3); T3
1495
3-d affine toric variety
1496
sage: T3.fan().rays()
1497
Empty collection
1498
in 3-d lattice N
1499
sage: T3.fan().virtual_rays()
1500
N(1, 0, 0),
1501
N(0, 1, 0),
1502
N(0, 0, 1)
1503
in 3-d lattice N
1504
sage: T3.gens()
1505
(z0, z1, z2)
1506
sage: sorted(T3.change_ring(GF(3)).point_set().list())
1507
[[1 : 1 : 1], [1 : 1 : 2], [1 : 2 : 1], [1 : 2 : 2],
1508
[2 : 1 : 1], [2 : 1 : 2], [2 : 2 : 1], [2 : 2 : 2]]
1509
"""
1510
try:
1511
n = ZZ(n)
1512
except TypeError:
1513
raise TypeError('dimension of the torus must be an integer')
1514
if n < 0:
1515
raise ValueError('dimension must be non-negative')
1516
N = ToricLattice(n)
1517
fan = Fan([], lattice=N)
1518
return ToricVariety(fan, coordinate_names=names, base_field=base_ring)
1519
1520
toric_varieties = ToricVarietyFactory()
1521
1522