7
7
8
8
.. MATH::
9
9
10
- R^{n_1 } \xleftarrow{d_1} R^{n_1} \xleftarrow{d_2}
10
+ R^{n_0 } \xleftarrow{d_1} R^{n_1} \xleftarrow{d_2}
11
11
\cdots \xleftarrow{d_k} R^{n_k} \xleftarrow{d_{k+1}} 0
12
12
13
13
terminating with a zero module at the end that is exact (all homology groups
@@ -242,9 +242,20 @@ def _repr_module(self, i):
242
242
'S^2'
243
243
sage: r # indirect doctest
244
244
S^1 <-- S^3 <-- S^2 <-- 0
245
+
246
+ TESTS::
247
+
248
+ sage: S.<x,y,z> = PolynomialRing(QQ)
249
+ sage: I = S.ideal(0)
250
+ sage: C = I.free_resolution()
251
+ sage: C
252
+ S^1 <-- 0
245
253
"""
246
254
if i == 0 :
247
- r = self ._maps [0 ].nrows ()
255
+ if self ._length > 0 :
256
+ r = self ._maps [0 ].nrows ()
257
+ else :
258
+ r = self ._initial_differential .domain ().dimension ()
248
259
s = f'{ self ._name } ^{ r } '
249
260
return s
250
261
elif i > self ._length :
@@ -422,6 +433,8 @@ def __getitem__(self, i):
422
433
raise IndexError ('invalid index' )
423
434
elif i > self ._length :
424
435
F = FreeModule (self ._base_ring , 0 )
436
+ elif i == 0 :
437
+ F = self .differential (0 ).domain ()
425
438
elif i == self ._length :
426
439
F = FreeModule (self ._base_ring , self ._maps [i - 1 ].ncols ())
427
440
else :
@@ -444,11 +457,12 @@ def differential(self, i):
444
457
sage: r
445
458
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
446
459
sage: r.differential(3)
447
- Free module morphism defined by the matrix []
448
- Domain: Ambient free module of rank 0 over the integral domain
449
- Multivariate Polynomial Ring in x, y, z, w over Rational Field
450
- Codomain: Ambient free module of rank 2 over the integral domain
451
- Multivariate Polynomial Ring in x, y, z, w over Rational Field
460
+ Free module morphism defined as left-multiplication by the matrix
461
+ []
462
+ Domain: Ambient free module of rank 0 over the integral domain
463
+ Multivariate Polynomial Ring in x, y, z, w over Rational Field
464
+ Codomain: Ambient free module of rank 2 over the integral domain
465
+ Multivariate Polynomial Ring in x, y, z, w over Rational Field
452
466
sage: r.differential(2)
453
467
Free module morphism defined as left-multiplication by the matrix
454
468
[-y x]
@@ -476,6 +490,31 @@ def differential(self, i):
476
490
[-z^2 + y*w]
477
491
[ y*z - x*w]
478
492
[-y^2 + x*z]
493
+
494
+ TESTS::
495
+
496
+ sage: P2.<x,y,z> = ProjectiveSpace(QQ, 2)
497
+ sage: S = P2.coordinate_ring()
498
+ sage: I = S.ideal(0)
499
+ sage: C = I.graded_free_resolution(); C
500
+ S(0) <-- 0
501
+ sage: C[1]
502
+ Ambient free module of rank 0 over the integral domain
503
+ Multivariate Polynomial Ring in x, y, z over Rational Field
504
+ sage: C[0]
505
+ Ambient free module of rank 1 over the integral domain
506
+ Multivariate Polynomial Ring in x, y, z over Rational Field
507
+ sage: C.differential(1)
508
+ Free module morphism defined as left-multiplication by the matrix
509
+ []
510
+ Domain: Ambient free module of rank 0 over the integral domain
511
+ Multivariate Polynomial Ring in x, y, z over Rational Field
512
+ Codomain: Ambient free module of rank 1 over the integral domain
513
+ Multivariate Polynomial Ring in x, y, z over Rational Field
514
+ sage: C.differential(1).matrix()
515
+ []
516
+ sage: C.differential(1).matrix().dimensions()
517
+ (1, 0)
479
518
"""
480
519
if i < 0 :
481
520
raise IndexError ('invalid index' )
@@ -484,14 +523,17 @@ def differential(self, i):
484
523
return self ._initial_differential
485
524
except AttributeError :
486
525
raise ValueError ('0th differential map undefined' )
487
- elif i == self ._length + 1 :
488
- s = FreeModule (self ._base_ring , 0 )
489
- t = FreeModule (self ._base_ring , self ._maps [i - 2 ].ncols ())
490
- m = s .hom (0 , t )
491
526
elif i > self ._length + 1 :
492
527
s = FreeModule (self ._base_ring , 0 )
493
528
t = FreeModule (self ._base_ring , 0 )
494
- m = s .hom (0 , t )
529
+ m = s .hom (0 , t , side = 'right' )
530
+ elif i == self ._length + 1 :
531
+ s = FreeModule (self ._base_ring , 0 )
532
+ if self ._length > 0 :
533
+ t = FreeModule (self ._base_ring , self ._maps [i - 2 ].ncols ())
534
+ else :
535
+ t = self ._initial_differential .domain ()
536
+ m = s .hom (0 , t , side = 'right' )
495
537
else :
496
538
s = FreeModule (self ._base_ring , self ._maps [i - 1 ].ncols ())
497
539
t = FreeModule (self ._base_ring , self ._maps [i - 1 ].nrows ())
0 commit comments