Changeset 6f2edc in git for Singular/LIB/homolog.lib
- Timestamp:
- Apr 28, 1997, 9:27:25 PM (27 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 8c5a578cc8481c8a133a58030c4c4c8227d82bb1
- Parents:
- 6d09c564c80f079b501f7187cf6984d040603849
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/homolog.lib
r6d09c56 r6f2edc 1 // $Id: homolog.lib,v 1. 1.1.1 1997-04-25 15:13:26obachman Exp $2 //(BM 11/95)1 // $Id: homolog.lib,v 1.2 1997-04-28 19:27:19 obachman Exp $ 2 //(BM/GMG, last modified 22.06.96) 3 3 /////////////////////////////////////////////////////////////////////////////// 4 4 5 LIBRARY: homolog.lib PROCEDURES FOR HOMOLOGICAL ALGEBRA 6 7 Ext_R(k,id); Ext^k(R/id,R), id = ideal 8 Ext(k,M,N); Ext^k(M,N), M,N = modules 9 Hom(M,N); Hom(M,N), M,N = modules 10 kohom(A,k); Hom(R^k,A), A = matrix 11 kontrahom(A,k); Hom(A,R^k), A = matrix 12 5 LIBRARY: homolog.lib PROCEDURES FOR HOMOLOGICAL ALGEBRA 6 7 cup(M); cup: Ext^1(M',M') x Ext^1() --> Ext^2() 8 cupproduct(M,N,P,p,q); cup: Ext^p(M',N') x Ext^q(N',P') --> Ext^p+q(M',P') 9 Ext_R(k,M); Ext^k(M',R), M module, R basering, M'=coker(M) 10 Ext(k,M,N); Ext^k(M',N'), M,N modules, M'=coker(M), N'=coker(N) 11 Hom(M,N); Hom(M',N'), M,N modules, M'=coker(M), N'=coker(N) 12 homology(A,B,M,N) ker(B)/im(A), homology of complex R^k--A->M'--B->N' 13 kernel(A,M,N); ker(M'--A->N') M,N modules, A matrix 14 kohom(A,k); Hom(R^k,A), A matrix over basering R 15 kontrahom(A,k); Hom(A,R^k), A matrix over basering R 16 17 LIB "general.lib"; 18 LIB "deform.lib"; 13 19 LIB "matrix.lib"; 20 LIB "poly.lib"; 14 21 /////////////////////////////////////////////////////////////////////////////// 15 22 16 proc Ext_R (int k, ideal I, list #) 17 USAGE: Ext_R(k,id[,any]); k=integer, id=ideal 18 DISPLAY: degree of Ext^k(P/id,P) 19 RETURN: Ext^k(P/id,P), presentation as a quotient of a free module. 20 If a third argument is given (of any type) return a list of two 21 modules: 22 [1] = module Ext^k(P/id,P) 23 [2] = SB of Ext^k(P/id,P) 24 EXAMPLE: example Ext_R; shows an example 23 proc cup (module M,list #) 24 USAGE: cup(M,[,any,any]); M=module 25 COMPUTE: cup-product Ext^1(M',M') x Ext^1(M',M') ---> Ext^2(M',M'), 26 where M':=R^m/M, if M in R^m, R basering (i.e. M':=coker(matrix(M))) 27 in case of a second argument: symmetrized cup-product 28 ASSUME: all Ext's are finite dimensional 29 RETURN: matrix of the associated linear map, 30 i.e. the columns of <matrix> present the coordinates of b_i & b_j 31 (resp. (1/2)(b_i & b_j + b_j & b_i) in the symmetric version) 32 with respect to a kbase of Ext^2, 33 (where b_1,b_2,... is a kbase of Ext^1 and & denotes cup product) 34 in case of a third argument return a list: 35 L[1] = matrix see above (and symmetric case) 36 L[2] = matrix of kbase of Ext^1 37 L[3] = matrix of kbase of Ext^2 38 NOTE: printlevel >=1; shows what is going on 39 printlevel >=2; shows result in another representation 40 For computing cupproduct of M itself, apply proc to syz(M)! 41 EXAMPLE: example cup; shows examples 25 42 { 26 module m1,m2,ret,ret0; 27 //------------------ compute resolution of P/I -------------------------------- 28 mres(I,k+1,resI); 29 //----------------- apply Hom(_,P) at k-th place ----------------------------- 30 m2 = transpose(resI(k+1)); 31 m1 = transpose(resI(k)); 32 //----------------- ker(m2)/im(m1) ------------------------------------------- 33 m2 = simplify(m2,10); 34 if (m2[1]==0) { ret = m1; } 35 else { ret = modulo(syz(m2),m1); } 36 ret0 = std(ret); 37 "// degree of Ext^"+string(k)+"(P/I,P):";degree(ret0); 38 if (size(#)>0) { return(ret,ret0); } 39 return(ret); 43 //---------- initialization --------------------------------------------------- 44 int i,j,k,f0,f1,f2,f3,e1,e2; 45 module M1,M2,A,B,C,ker,ima,ext1,ext2,ext10,ext20; 46 matrix cup[1][0]; 47 matrix kb1,lift1,kb2,mA,mB,mC; 48 ideal tes1,tes2,null; 49 int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) 50 //----------------------------------------------------------------------------- 51 //take a resolution of M<--F(0)<--- ... <---F(3) 52 //apply Hom(-,M) and compute the Ext's 53 //----------------------------------------------------------------------------- 54 list resM = res(M,3); 55 M1 = resM[2]; 56 M2 = resM[3]; 57 f0 = nrows(M); 58 f1 = ncols(M); 59 f2 = ncols(M1); 60 f3 = ncols(M2); 61 tes1 = simplify(ideal(M),10); 62 tes2=simplify(ideal(M1),10); 63 if ((tes1[1]*tes2[1]==0) or (tes1[1]==1) or (tes2[1]==1)) 64 { 65 dbprint(p,"// Ext == 0 , hence 'cup' is the zero-map"); 66 return(@cup); 67 } 68 //------ compute Ext^1 -------------------------------------------------------- 69 B = kohom(M,f2); 70 A = kontrahom(M1,f0); 71 C = intersect(A,B); 72 C = reduce(C,std(null));C = simplify(C,10); 73 ker = lift(A,C)+syz(A); 74 ima = kohom(M,f1); 75 ima = ima + kontrahom(M,f0); 76 ext1 = modulo(ker,ima); 77 ext10 = std(ext1); 78 e1 = vdim(ext10); 79 dbprint(p-1,"// vdim (Ext^1) = "+string(e1)); 80 if (e1 < 0) 81 { 82 "// Ext^1 not of finite dimension"; 83 return(cup); 84 } 85 kb1 = kbase(ext10); 86 kb1 = matrix(ker)*kb1; 87 dbprint(p-1,"// kbase of Ext^1(M,M)", 88 "// - the columns present the kbase elements in Hom(F(1),F(0))", 89 "// - F(*) a free resolution of M",kb1); 90 91 //------ compute the liftings of Ext^1 ---------------------------------------- 92 mC = matrix(A)*kb1; 93 lift1 =lift(B,mC); 94 dbprint(p-1,"// lift kbase of Ext^1:", 95 "// - the columns present liftings of kbase elements into Hom(F(2),F(1))", 96 "// - F(*) a free resolution of M ",lift1); 97 98 //------ compute Ext^2 ------------------------------------------------------- 99 B = kohom(M,f3); 100 A = kontrahom(M2,f0); 101 C = intersect(A,B); 102 C = reduce(C,std(null));C = simplify(C,10); 103 ker = lift(A,C)+syz(A); 104 ima = kohom(M,f2); 105 ima = ima + kontrahom(M1,f0); 106 ext2 = modulo(ker,ima); 107 ext20= std(ext2); 108 e2 = vdim(ext20); 109 if (e2<0) 110 { 111 "// Ext^2 not of finite dimension"; 112 return(cup); 113 } 114 dbprint(p-1,"// vdim (Ext^2) = "+string(e2)); 115 kb2 = kbase(ext20); 116 kb2 = matrix(ker)*kb2; 117 dbprint(p-1,"// kbase of Ext^2(M,M)", 118 "// - the columns present the kbase elements in Hom(F(2),F(0))", 119 "// - F(*) is a a free resolution of M ",kb2); 120 //------- compute: cup-products of base-elements ----------------------------- 121 for (i=1;i<=e1;i=i+1) 122 { 123 for (j=1;j<=e1;j=j+1) 124 { 125 mA = matrix(ideal(lift1[j]),f1,f2); 126 mB = matrix(ideal(kb1[i]),f0,f1); 127 mC = mB*mA; 128 if (size(#)==0) 129 { //non symmestric 130 mC = matrix(ideal(mC),f0*f2,1); 131 cup= concat(cup,mC); 132 } 133 else //symmetric version 134 { 135 if (j>=i) 136 { 137 if (j>i) 138 { 139 mA = matrix(ideal(lift1[i]),f1,f2); 140 mB = matrix(ideal(kb1[j]),f0,f1); 141 mC = mC+mB*mA;mC=(1/2)*mC; 142 } 143 mC = matrix(ideal(mC),f0*f2,1); 144 cup= concat(cup,mC); 145 } 146 } 147 } 148 } 149 dbprint(p-1,"// matrix of cup-products (in Ext^2)",cup,"////// end level 2 //////"); 150 //------- comptute: presentation of base-elements ----------------------------- 151 cup = lift(ker,cup); 152 cup = lift_kbase(cup,ext20); 153 if( p>2 ) 154 { 155 "// the associated matrices of the bilinear mapping 'cup' "; 156 "// corresponding to the kbase elements of Ext^2(M,M) are shown,"; 157 "// i.e. the rows of the final matrix are written as matrix of"; 158 "// a bilinear form on Ext^1 x Ext^1"; 159 matrix BL[e1][e1]; 160 for (k=1;k<=e2;k=k+1) 161 { 162 "//_____"+string(k)+". component:"; 163 for (i=1;i<=e1;i=i+1) 164 { 165 for (j=1;j<=e1;j=j+1) 166 { 167 if (size(#)==0) { BL[i,j]=cup[k,j+e1*(i-1)]; } 168 else 169 { 170 if (i<=j) 171 { 172 BL[i,j]=cup[k,j+e1*(i-1)-binomial(i,2)]; 173 BL[j,i]=BL[i,j]; 174 } 175 } 176 } 177 } 178 print(BL); 179 } 180 "////// end level 3 //////"; 181 } 182 if (size(#)>2) { return(cup,kb1,kb2);} 183 else {return(cup);} 40 184 } 41 185 example 42 { "EXAMPLE:"; echo=2; 43 ring r=0,(x,y,z),dp; 44 ideal i = x2y,y2z,z3x; 45 module E = Ext_R(1,i);""; 46 E = Ext_R(2,i); 47 show(E);""; 48 list LE = Ext_R(3,i,""); 49 kbase(LE[2]);""; 50 E = Ext_R(4,i); 186 {"EXAMPLE"; echo=2; 187 int p = printlevel; 188 ring rr = 32003,(x,y,z),(dp,C); 189 ideal I = x4+y3+z2; 190 qring o = std(I); 191 module M = [x,y,0,z],[y2,-x3,z,0],[z,0,-y,-x3],[0,z,x,-y2]; 192 print(cup(M)); 193 print(cup(M,1)); 194 // 2nd EXAMPLE (shows what is going on) 195 printlevel = 3; 196 ring r = 0,(x,y),(dp,C); 197 ideal i = x2-y3; 198 qring q = std(i); 199 module M = [-x,y],[-y2,x]; 200 print(cup(M)); 201 printlevel = p; 51 202 } 52 203 /////////////////////////////////////////////////////////////////////////////// 53 204 54 proc Ext (int k, module M, module N, list #) 55 USAGE: Ext(k,M,N[,any]); k=integer, M,N=modules 56 DISPLAY: degree of Ext^k(M,N) 57 RETURN: Ext^k(M,N), presentation as a quotient of a free module. 58 If a third argument is given (of any type) return a list of two 59 modules: 60 [1] = module Ext^k(M,N) 61 [2] = SB of Ext^k(M,N) 62 EXAMPLE: example Ext; shows an example 205 proc cupproduct (module M,N,P,int p,q,list #) 206 USAGE: cupproduct(M,N,P,p,q[,any]); M,N,P modules, p,q integers 207 COMPUTE: cup-product Ext^p(M',N') x Ext^q(N',P') ---> Ext^p+q(M',P') 208 where M':=R^m/M, if M in R^m, R basering (i.e. M':=coker(matrix(M))) 209 ASSUME: all Ext's are of finite dimension 210 RETURN: matrix of the associated linear map Ext^p(tensor)Ext^q-->Ext^p+q 211 i.e. the columnes of <matrix> present the coordinates of 212 the cup products (b_i & c_j) with respect to a kbase of Ext^p+q 213 (b_i resp. c_j are choosen bases of Ext^p resp. Ext^q) 214 in case of a 6th argument: 215 return a list 216 L[1] = matrix (see above) 217 L[2] = matrix of kbase of Ext^p(M',N') 218 L[3] = matrix of kbase of Ext^q(N',P') 219 L[4] = matrix of kbase of Ext^p+q(N',P') 220 NOTE: printlevel >=1; shows what is going on 221 printlevel >=2; shows result in another representation 222 For computing cupproduct of M,N itself, apply proc to syz(M),syz(N)! 223 EXAMPLE: example cupproduct; shows examples 63 224 { 64 module A,B,C,M1,M2,ker,imag,extMN,extMN0; 65 ideal test1,test2; 66 //---------- resolution of M and N ------------------------------------------ 67 if (k>0) 68 { 69 mres(M,k+1,resM); 70 M1 = resM(k); 71 M2 = resM(k+1); 72 test1 = simplify(ideal(M1),10); 73 test2 = simplify(ideal(N),10); 74 if ((test1[1]==0) or (test2[1]==0)) 75 { "//Ext(M,N)=0";return(extMN); } 76 else 77 { 78 test1 = simplify(ideal(M2),10); 79 if (test1[1]==0) //Ker(Hom(m2,N)) 80 { ker = freemodule(ncols(M1)*nrows(N));} 81 else 82 { 83 A = kontrahom(M2,nrows(N)); 84 B = kohom(N,ncols(M2)); 85 C = intersect(A,B); 86 C = reduce(C,std(ideal(0)));C=simplify(C,10); 87 ker = lift(A,C)+syz(A); 88 } 89 imag = kohom(N,ncols(M1)); 90 A = kontrahom(M1,nrows(N)); 91 imag = imag+A; //im(Hom(m1,M)) 92 extMN = modulo(ker,imag); 93 extMN0= std(extMN); 94 "// degree of Ext^"+string(k)+"(M,N):";degree(extMN0); 225 //---------- initialization --------------------------------------------------- 226 int e1,e2,e3,i,j,k,f0,f1,f2; 227 module M1,M2,N1,N2,P1,P2,A,B,C,ker,ima,extMN,extMN0,extMP, 228 extMP0,extNP,extNP0; 229 matrix cup[1][0]; 230 matrix kbMN,kbMP,kbNP,lift1,mA,mB,mC; 231 ideal test1,test2,null; 232 int pp = printlevel-voice+3; // pp=printlevel+1 (default: p=1) 233 //----------------------------------------------------------------------------- 234 //compute resolutions of M and N 235 // M<--F(0)<--- ... <---F(p+q+1) 236 // N<--G(0)<--- ... <---G(q+1) 237 //----------------------------------------------------------------------------- 238 list resM = res(M,p+q+1); 239 M1 = resM[p]; 240 M2 = resM[p+1]; 241 list resN = res(N,q+1); 242 N1 = resN[q]; 243 N2 = resN[q+1]; 244 P1 = resM[p+q]; 245 P2 = resM[p+q+1]; 246 //-------test: Ext==0?--------------------------------------------------------- 247 test1 = simplify(ideal(M1),10); 248 test2 = simplify(ideal(N),10); 249 if (test1[1]==0) { dbprint(pp,"//Ext(M,N)=0");return(cup); } 250 test1 = simplify(ideal(N1),10); 251 test2 = simplify(ideal(P),10); 252 if (test1[1]==0) { dbprint(pp,"//Ext(N,P)=0");return(cup); } 253 test1 = simplify(ideal(P1),10); 254 if (test1[1]==0) { dbprint(pp,"//Ext(M,P)=0");return(cup); } 255 //------ compute kbases of Ext's --------------------------------------------- 256 //------ Ext(M,N) 257 test1 = simplify(ideal(M2),10); 258 if (test1[1]==0) { ker = freemodule(ncols(M1)*nrows(N));} 259 else 260 { 261 A = kontrahom(M2,nrows(N)); 262 B = kohom(N,ncols(M2)); 263 C = intersect(A,B); 264 C = reduce(C,std(ideal(0)));C=simplify(C,10); 265 ker = lift(A,C)+syz(A); 266 } 267 ima = kohom(N,ncols(M1)); 268 A = kontrahom(M1,nrows(N)); 269 ima = ima+A; 270 extMN = modulo(ker,ima); 271 extMN0= std(extMN); 272 e1 = vdim(extMN0); 273 dbprint(pp-1,"// vdim Ext(M,N) = "+string(e1)); 274 if (e1 < 0) 275 { 276 "// Ext(M,N) not of finite dimension"; 277 return(cup); 278 } 279 kbMN = kbase(extMN0); 280 kbMN = matrix(ker)*kbMN; 281 dbprint(pp-1,"// kbase of Ext^p(M,N)", 282 "// - the columns present the kbase elements in Hom(F(p),G(0))", 283 "// - F(*),G(*) are free resolutions of M and N",kbMN); 284 //------- Ext(N,P) 285 test1 = simplify(ideal(N2),10); 286 if (test1[1]==0) { ker = freemodule(ncols(N1)*nrows(P)); } 287 else 288 { 289 A = kontrahom(N2,nrows(P)); 290 B = kohom(P,ncols(N2)); 291 C = intersect(A,B); 292 C = reduce(C,std(ideal(0)));C=simplify(C,10); 293 ker = lift(A,C)+syz(A); 294 } 295 ima = kohom(P,ncols(N1)); 296 A = kontrahom(N1,nrows(P)); 297 ima = ima+A; 298 extNP = modulo(ker,ima); 299 extNP0= std(extNP); 300 e2 = vdim(extNP0); 301 dbprint(pp-1,"// vdim Ext(N,P) = "+string(e2)); 302 if (e2 < 0) 303 { 304 "// Ext(N,P) not of finite dimension"; 305 return(cup); 306 } 307 kbNP = kbase(extNP0); 308 kbNP = matrix(ker)*kbNP; 309 dbprint(pp-1,"// kbase of Ext(N,P):",kbNP, 310 "// kbase of Ext^q(N,P)", 311 "// - the columns present the kbase elements in Hom(G(q),H(0))", 312 "// - G(*),H(*) are free resolutions of N and P",kbNP); 313 314 //------ Ext(M,P) 315 test1 = simplify(ideal(P2),10); 316 if (test1[1]==0) { ker = freemodule(ncols(P1)*nrows(P)); } 317 else 318 { 319 A = kontrahom(P2,nrows(P)); 320 B = kohom(P,ncols(P2)); 321 C = intersect(A,B); 322 C = reduce(C,std(ideal(0)));C=simplify(C,10); 323 ker = lift(A,C)+syz(A); 324 } 325 ima = kohom(P,ncols(P1)); 326 A = kontrahom(P1,nrows(P)); 327 ima = ima+A; 328 extMP = modulo(ker,ima); 329 extMP0= std(extMP); 330 e3 = vdim(extMP0); 331 dbprint(pp-1,"// vdim Ext(M,P) = "+string(e3)); 332 if (e3 < 0) 333 { 334 "// Ext(M,P) not of finite dimension"; 335 return(cup); 336 } 337 kbMP = kbase(extMP0); 338 kbMP = matrix(ker)*kbMP; 339 dbprint(pp-1,"// kbase of Ext^p+q(M,P)", 340 "// - the columns present the kbase elements in Hom(F(p+q),H(0))", 341 "// - F(*),H(*) are free resolutions of M and P",kbMP); 342 //----- lift kbase of Ext(M,N) ------------------------------------------------ 343 lift1 = kbMN; 344 for (i=1;i<=q;i=i+1) 345 { 346 mA = kontrahom(resM[p+i],nrows(resN[i])); 347 mB = kohom(resN[i],ncols(resM[p+i])); 348 lift1 = lift(mB,mA*lift1); 349 } 350 dbprint(pp-1,"// lifting of kbase of Ext^p(M,N)", 351 "// - the columns present the lifting of kbase elements in Hom(F(p+q),G(q))",lift1); 352 //------- compute: cup-products of base-elements ----------------------------- 353 f0 = nrows(P); 354 f1 = ncols(N1); 355 f2 = ncols(resM[p+q]); 356 for (i=1;i<=e1;i=i+1) 357 { 358 for (j=1;j<=e2;j=j+1) 359 { 360 mA = matrix(ideal(lift1[j]),f1,f2); 361 mB = matrix(ideal(kbMP[i]),f0,f1); 362 mC = mB*mA; 363 mC = matrix(ideal(mC),f0*f2,1); 364 cup= concat(cup,mC); 95 365 } 96 } 97 else { extMN,extMN0 = Hom(M,N,1); } 98 if (size(#)>0) { return(extMN,extMN0); } 99 return(extMN ); 366 } 367 dbprint(pp-1,"// matrix of cup-products (in Ext^p+q)",cup,"////// end level 2 //////"); 368 //------- comptute: presentation of base-elements ----------------------------- 369 cup = lift(ker,cup); 370 cup = lift_kbase(cup,extMP0); 371 //------- special output ------------------------------------------------------ 372 if (pp>2) 373 { 374 "// the associated matrices of the bilinear mapping 'cup' "; 375 "// corresponding to the kbase elements of Ext^p+q(M,P) are shown,"; 376 "// i.e. the rows of the final matrix are written as matrix of"; 377 "// a bilinear form on Ext^p x Ext^q"; 378 matrix BL[e1][e2]; 379 for (k=1;k<=e3;k=k+1) 380 { 381 "//----"+string(k)+". component:"; 382 for (i=1;i<=e1;i=i+1) 383 { 384 for (j=1;j<=e2;j=j+1) 385 { 386 BL[i,j]=cup[k,j+e1*(i-1)]; 387 } 388 } 389 print(BL); 390 } 391 "////// end level 3 //////"; 392 } 393 if (size(#)) { return(cup,kbMN,kbNP,kbMP);} 394 else { return(cup); } 100 395 } 101 396 example 102 { "EXAMPLE:"; echo=2; 103 ring r=0,(x,y),(c,dp); 104 ideal i=x2-y3; 105 qring qr=std(i); 106 module M=[-x,y],[-y2,x]; 107 list EXT1=Ext(1,M,M,""); 108 kbase(EXT1[2]); 109 } 110 //////////////////////////////////////////////////////////////////////////////// 111 112 proc Hom (module M, module N, list #) 113 USAGE: Hom(M,N); M,N=modules 114 DISPLAY: degree of Hom(M,N); 115 RETURN: Hom(M,N), presentation as a quotient of a free module. 116 If a third argument is given (of any type) return a list of two 117 modules: 118 [1] = module Hom(M,N) 119 [2] = SB of Hom(M,N) 120 EXAMPLE: example Hom; shows an example 397 {"EXAMPLE"; echo=2; 398 int p = printlevel; 399 ring rr = 32003,(x,y,z),(dp,C); 400 ideal I = x4+y3+z2; 401 qring o = std(I); 402 module M = [x,y,0,z],[y2,-x3,z,0],[z,0,-y,-x3],[0,z,x,-y2]; 403 print(cupproduct(M,M,M,1,3)); 404 printlevel = 3; 405 list l = (cupproduct(M,M,M,1,3,"any")); 406 show(l[1]);show(l[2]); 407 printlevel = p; 408 } 409 /////////////////////////////////////////////////////////////////////////////// 410 411 proc Ext_R (intvec v, module M, list #) 412 USAGE: Ext_R(v,M[,p]); v=int/intvec , M=module, p=int 413 COMPUTE: A presentation of Ext^k(M',R); for k=v[1],v[2],..., M'=coker(M). 414 Let ...--> F2 --> F1 --M-> F0-->M'-->0 be a free resolution of M'. If 415 0 <-- F0* <-A1-- F1* <-A2-- F2* <-A3--... denotes the dual sequence, 416 Fi*=Hom(Fi,R), then Ext^k = ker(Ak)/im(Ak+1) is presented as in the 417 following exact sequences: 418 Fk-1* <-Ak-- Fk* <-syz(Ak)-- R^p 419 Fk*/im(Ak+1) <-syz(Ak)-- R^p <-Ext^k-- R^q 420 Hence Ext^k=modulo(syz(Ak),Ak+1) presents Ext^k(M',R); 421 RETURN: Ext^k, of type module, a presentation of Ext^k(M',R) if v is of type 422 int, resp. a list of Ext^k (k=v[1],v[2],...) if v is of type intvec. 423 In case of a third argument of type int return a list: 424 [1] = module Ext^k/list of Ext^k 425 [2] = SB of Ext^k/list of SB of Ext^k 426 [3] = matrix/list of matrices, each representing kbase of Ext^k 427 (if finite dimensional) 428 DISPLAY: printlevel >=0: degree of Ext^k for each k (default) 429 printlevel >=1: Ak, Ak+1 and kbase of Ext^k in Fk* 430 NOTE: In order to compute Ext^k(M,R) use the command Ext_R(k,syz(M)); 431 or the 2 commands: list L=mres(M,2); Ext_R(k,L[2]); 432 EXAMPLE: example Ext_R; shows examples 433 { 434 435 //Bemerkung (nur fuer internen Gebrauch): Ext_R(v,M[,"sres",p]); bewirkt folgendes: 436 // Es wird der input mit sres statt mres aufgeloest. Bei den bisherigen Versuchen 437 // ist dies insgesamt langsamer, da sres zu gro§e Objekte zurueckliefert. 438 // Der Versuch, auch spaeter sres statt mres zu verwenden, ist ganz aufgegeben, 439 // da mit sres spaeter syz und modulo viel laenger dauern! 440 // In case M is known to be a SB, set attrib(M,"isSB",1); in order to 441 // avoid unnecessary SB computations 442 443 //------------ initialisation ------------------------------------------------- 444 module m1,m2,ret,ret0; 445 matrix ker,kb; 446 list L1,L2,L3,L,resl,K; 447 int k,max,ii,t1,t2; 448 int s = size(v); 449 intvec v1 = sort(v)[1]; 450 max = v1[s]; // the maximum integer occuring in intvec v 451 int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) 452 // --------------- Variante mit sres 453 for( ii=1; ii<=size(#); ii++ ) 454 { 455 t2=1; // return a list if t2=1 456 if( typeof(#[ii])=="string" ) 457 { 458 if ( #[ii]=="sres" ) { t1=1; t2=0; } // use sres instead of mres if t1=1 459 } 460 } 461 //----------------- compute resolution of coker(M) ---------------------------- 462 if( max<0 ) { dbprint(p,"// Ext^i=0 for i<0!"); return([1]); } 463 if( t1==1 ) 464 { 465 if( attrib(M,"isSB")==0 ) { M=std(M); } 466 resl = sres(M,max+1); 467 } 468 else { resl = mres(M,max+1); } 469 for( ii=1; ii<=s; ii++ ) 470 { 471 //----------------- apply Hom(_,R) at k-th place ----------------------------- 472 k=v[ii]; 473 if( k<0 ) // Ext^k=0 for negative k 474 { 475 dbprint(p-1,"// Ext^i=0 for i<0!"); 476 ret = gen(1); 477 ret0 = std(ret); 478 L1[ii] = ret; 479 L2[ii] = ret0; 480 L3[ii] = matrix(kbase(ret0)); 481 dbprint(p,"// degree of Ext^"+string(k)+":"); 482 if( p>=0 ) { degree(ret0);"";} 483 } 484 else 485 { 486 m2 = transpose(resl[k+1]); 487 if( k==0 ) { m1=0*gen(nrows(m2)); } 488 else { m1 = transpose(resl[k]); } 489 //----------------- presentation of ker(m2)/im(m1) ---------------------------- 490 ker = syz(m2); 491 ret = modulo(ker,m1); 492 dbprint(p-1,"// Computing Ext^"+string(k)+":", 493 "// Let 0<--coker(M)<--F0<--F1<--F2<--... be a resolution of M,", 494 "// then F"+string(k)+"*-->F"+string(k+1)+"* is given by:",m2, 495 "// and F"+string(k-1)+"*-->F"+string(k)+"* is given by:",m1,""); 496 ret0 = std(ret); 497 dbprint(p,"// degree of Ext^"+string(k)+":"); 498 if( p>0 ) { degree(ret0);"";} 499 if( t2 ) 500 { 501 if( vdim(ret0)>=0 ) 502 { 503 kb = kbase(ret0); 504 if ( size(ker)!=0 ) { kb = matrix(ker)*kb; } 505 dbprint(p-1, 506 "// columns of matrix are kbase of Ext^"+string(k)+" in F"+string(k)+"*:",kb,""); 507 L3[ii] = kb; 508 } 509 L2[ii] = ret0; 510 } 511 L1[ii] = ret; 512 } 513 } 514 if( t2 ) 515 { 516 if( s>1 ) { L = L1,L2,L3; return(L); } 517 else { L = ret,ret0,kb; return(L); } 518 } 519 else 520 { 521 if( s>1 ) { return(L1); } 522 else { return(ret); } 523 } 524 } 525 example 526 {"EXAMPLE:"; echo=2; 527 int p = printlevel; 528 printlevel = 1; 529 ring r = 0,(x,y,z),dp; 530 ideal i = x2y,y2z,z3x; 531 module E = Ext_R(1,i); //computes Ext^1(r/i,r) 532 is_zero(E); 533 module m = [x],[0,y]; 534 list L = Ext_R(2..3,m); //computes Ext^i(r^2/m,r), i=2,3 535 show(L);""; 536 qring R = std(x2+yz); 537 intvec v = 0,2,4; 538 printlevel = 2; //shows what is going on 539 ideal i = x,y,z; //computes Ext^i(r/(x,y,z),r/(x2+yz)), i=0,2,4 540 list L = Ext_R(v,i,1); //over the qring R=r/(x2+yz), std and kbase 541 printlevel = p; 542 } 543 /////////////////////////////////////////////////////////////////////////////// 544 545 proc Ext (intvec v, module M, module N, list #) 546 USAGE: Ext(v,M,N[,any]); v=int/intvec, M,N=modules 547 COMPUTE: A presentation of Ext^k(M',N'); for k=v[1],v[2],... where 548 M'=coker(M) and N'=coker(N). Let 549 0<--M'<-- F0 <-M-- F1 <-- F2 <--... resp. 0<--N'<-- G0 <--N- G1 be 550 a free resolution of M' resp. a presentations of N'. Consider 551 0 0 0 552 |^ |^ |^ 553 --> Hom(Fk-1,N') -Ak-> Hom(Fk,N') -Ak+1-> Hom(Fk+1,N') 554 |^ |^ |^ 555 --> Hom(Fk-1,G0) -Ak-> Hom(Fk,G0) -Ak+1-> Hom(Fk+1,G0) 556 |^ |^ 557 |C |B 558 Hom(Fk,G1) -----> Hom(Fk+1,G1) 559 (Ak,Ak+1 induced by M and B,C induced by N). 560 Let K=modulo(Ak+1,B), J=module(Ak)+module(C) and Ext=modulo(K,J), 561 then we have exact sequences 562 R^p --K-> Hom(Fk,G0) --Ak+1-> Hom(Fk+1,G0)/im(B) 563 R^q -Ext-> R^p --K->Hom(Fk,G0)/im(Ak)+im(C) --Ak+1->Hom(Fk+1,G0)/im(B) 564 Hence Ext presents Ext^k(M',N') 565 RETURN: Ext, of type module, a presentation of Ext^k(M',N') if v is of type 566 int, resp. a list of Ext^k (k=v[1],v[2],...) if v is of type intvec. 567 In case of a third argument of any type return a list: 568 [1] = module Ext/list of Ext^k 569 [2] = SB of Ext/list of SB of Ext^k 570 [3] = matrix/list of matrices, each representing a kbase of Ext^k 571 (if finite dimensional) 572 DISPLAY: printlevel >=0: degree of Ext^k for each k (default) 573 printlevel >=1: Ak, Ak+1 and kbase of Ext^k in Hom(Fk,G0) 574 (if finite dimensional) 575 NOTE: In order to compute Ext^k(M,N) use the command Ext(k,syz(M),syz(N)); 576 or: list P=mres(M,2); list Q=mres(N,2); Ext(k,P[2],Q[2]); 577 EXAMPLE: example Ext; shows examples 121 578 { 122 579 //---------- initialisation --------------------------------------------------- 123 module A,B,C,ker,imag,homMN,homMN0; 124 ideal tes; 125 tes = simplify(ideal(M),10); 126 if (tes[1]==0) 127 { 128 "// Hom(ring,N)=N"; 129 if (size(#)>0) { return(N,std(N)); } 130 return(N); 131 } 132 tes = simplify(ideal(N),10); 133 if (tes[1]==0) 134 { 135 "// Hom(M,ring)=M^*"; 136 homMN = transpose(M); 137 if (size(#)>0) { return(homMN,std(homMN));} 138 return(homMN); 139 } 140 B = kohom(N,ncols(M)); 141 A = kontrahom(M,nrows(N)); 142 C = intersect(A,B); 143 C = reduce(C,std(ideal(0)));C=simplify(C,10); 144 ker = lift(A,C)+syz(A); //ker(Hom(m,N)) 145 imag = kohom(N,ncols(M)); //im(Hom(M,n)) 146 homMN = modulo(ker,imag); 147 homMN0= std(homMN); 148 "// degree of Hom(M,N):";degree(homMN0); 149 if (size(#)>0) { return(homMN,homMN0); } 150 return(homMN); 580 int k,max,ii,l,row,col; 581 module A,B,C,D,M1,M2,N1,ker,imag,extMN,extMN0; 582 matrix kb; 583 list L1,L2,L3,L,resM,K; 584 ideal test1; 585 intmat Be; 586 int s = size(v); 587 intvec v1 = sort(v)[1]; 588 max = v1[s]; // the maximum integer occuring in intvec v 589 int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) 590 //---------- test: coker(N)=basering, coker(N)=0 ? ---------------------------- 591 if( max<0 ) { dbprint(p,"// Ext^i=0 for i<0!"); return([1]); } 592 N1 = std(N); 593 if( size(N1)==0 ) //coker(N)=basering, in this case proc Ext_R is faster 594 { printlevel=printlevel+1; 595 if( size(#)==0 ) 596 { def E = Ext_R(v,M); 597 printlevel=printlevel-1; 598 return(E); 599 } 600 else 601 { def E = Ext_R(v,M,#[1]); 602 printlevel=printlevel-1; 603 return(E); 604 } 605 } 606 if( dim(N1)==-1 ) //coker(N)=0, all Ext-groups are 0 607 { dbprint(p-1,"2nd module presents 0, hence Ext^k=0, for all k"); 608 for( ii=1; ii<=s; ii++ ) 609 { k=v[ii]; 610 extMN = gen(1); 611 extMN0 = std(extMN); 612 L1[ii] = extMN; 613 L2[ii] = extMN0; 614 L3[ii] = matrix(kbase(extMN0)); 615 if( p>0 ) { "// degree of Ext^"+string(k)+":"; degree(extMN0);""; } 616 } 617 } 618 else 619 { 620 if( size(N1) < size(N) ) { N=N1;} 621 row = nrows(N); 622 //---------- resolution of M ------------------------------------------------- 623 resM = mres(M,max+1); 624 for( ii=1; ii<=s; ii++ ) 625 { k=v[ii]; 626 if( k<0 ) // Ext^k is 0 for negative k 627 { dbprint(p-1,"// Ext^k=0 for k<0!"); 628 extMN = gen(1); 629 extMN0 = std(extMN); 630 L1[ii] = extMN; 631 L2[ii] = extMN0; 632 L3[ii] = matrix(kbase(extMN0)); 633 if( p>0 ) { "// degree of Ext^"+string(k)+":"; degree(extMN0);""; } 634 } 635 else 636 { M2 = resM[k+1]; 637 if( k==0 ) { M1=0*gen(nrows(M2)); } 638 else { M1 = resM[k]; } 639 col = ncols(M1); 640 D = kohom(N,col); 641 //---------- computing homology ---------------------------------------------- 642 imag = kontrahom(M1,row); 643 A = kontrahom(M2,row); 644 B = kohom(N,ncols(M2)); 645 ker = modulo(A,B); 646 imag = imag,D; 647 extMN = modulo(ker,imag); 648 dbprint(p-1,"// Computing Ext^"+string(k)+":", 649 "// Let 0<--coker(M)<--F0<--F1<--F2<--... be a resolution of coker(M),", 650 "// and 0<--coker(N)<--G0<--G1 a presentation of coker(N),", 651 "// then Hom(F"+string(k)+",G0)-->Hom(F"+string(k+1)+",G0) is given by:",A, 652 "// and Hom(F"+string(k-1)+",G0) + Hom(F"+string(k)+",G1)-->Hom(F"+string(k)+",G0) is given by:",imag,""); 653 extMN0 = std(extMN); 654 if( p>0 ) { "// degree of Ext^"+string(k)+":"; degree(extMN0);""; } 655 //---------- more information ------------------------------------------------- 656 if( size(#)>0 ) 657 { if( vdim(extMN0) >= 0 ) 658 { kb = kbase(extMN0); 659 if ( size(ker)!=0) { kb = matrix(ker)*kb; } 660 dbpri(p-1,"// columns of matrix are kbase of Ext^"+ 661 string(k)+" in Hom(F"+string(k)+",G0)",kb,""); 662 if( p>0 ) 663 { for (l=1;l<=ncols(kb);l=l+1) 664 { 665 "// element",l,"of kbase of Ext^"+string(k)+" in Hom(F"+string(k)+",G0)"; 666 "// as matrix: F"+string(k)+"-->G0"; 667 print(matrix(ideal(kb[l]),row,col)); 668 } 669 ""; 670 } 671 L3[ii] = matrix(kb); 672 } 673 L2[ii] = extMN0; 674 } 675 L1[ii] = extMN; 676 } 677 } 678 } 679 if( size(#) ) 680 { if( s>1 ) { L = L1,L2,L3; return(L); } 681 else { L = extMN,extMN0,matrix(kb); return(L); } 682 } 683 else 684 { if( s>1 ) { return(L1); } 685 else { return(extMN); } 686 } 151 687 } 152 688 example 153 { "EXAMPLE:"; echo = 2; 154 ring r=0,(x,y),(c,dp); 155 ideal i=x2-y3; 156 qring q=std(i); 157 module M=[-x,y],[-y2,x]; 158 module hom=Hom(M,M); 159 print(hom); newline; 160 ring s=3,(x,y,z),(c,dp); 161 ideal i=x2+y5+z4;i=jacob(i); 162 qring rq=std(i); 163 matrix M[2][2]=xy,x3,5y,z2,x2; 164 matrix N[4][4]=x,y,z,x2,xyx2y,y3,xz2,x2z,z3; 165 print(M); 166 print(N); 167 print(Hom(M,N)); 689 {"EXAMPLE:"; echo=2; 690 int p = printlevel; 691 printlevel = 1; 692 ring r = 0,(x,y),dp; 693 ideal i = x2-y3; 694 ideal j = x2-y5; 695 list E = Ext(0..2,i,j); // Ext^k(r/i,r/j) for k=0,1,2 over r 696 qring R = std(i); 697 ideal j = fetch(r,j); 698 module M = [-x,y],[-y2,x]; 699 printlevel = 2; 700 module E1 = Ext(1,M,j); // Ext^1(R^2/M,R/j) over R=r/i 701 list l = Ext(4,M,M,1); // Ext^4(R^2/M,R^2/M) over R=r/i 702 printlevel = p; 168 703 } 169 704 //////////////////////////////////////////////////////////////////////////////// 170 705 171 proc qmod (module M, module N) 172 USAGE: qmod(M,N); M,N=modules, N a submodule of M 173 COMPUTE: presentation S of M/N, i.e. M/N<<--F<--[S], F free of rank = size(M) 174 RETURN: module S 175 { 176 return(lift(M,N)+syz(M)); 706 proc Hom (module M, module N, list #) 707 USAGE: Hom(M,N,[any]); M,N=modules 708 COMPUTE: A presentation of Hom(M',N'), M'=coker(M), N'=coker(N) as follows: 709 Let ...-->F1 --M-> F0-->M'-->0 and ...-->G1 --N-> G0-->N'-->0 be 710 presentations of M' and N'. Consider 711 0 0 712 |^ |^ 713 0 --> Hom(M',N') ----> Hom(F0,N') ----> Hom(F1,N') 714 |^ |^ 715 (A: induced by M) Hom(F0,G0) --A-> Hom(F1,G0) 716 |^ |^ 717 (B,C:induced by N) |C |B 718 Hom(F0,G1) ----> Hom(F1,G1) 719 720 Let D=modulo(A,B) and Hom=modulo(D,C), then we have exact sequences 721 R^p --D-> Hom(F0,G0) --A-> Hom(F1,G0)/im(B) 722 R^q -Hom-> R^p --D-> Hom(F0,G0)/im(C) --A-> Hom(F1,G0)/im(B). 723 Hence Hom presents Hom(M',N') 724 RETURN: Hom, of type module, presentation of Hom(M',N') or, 725 in case of 3 arguments, a list: 726 [1] = Hom 727 [2] = SB of Hom 728 [3] = kbase of coker(Hom) (if finite dimensional), represented by 729 elements in Hom(F0,G0) via mapping D 730 DISPLAY: printlevel >=0: degree of Hom (default) 731 printlevel >=1: D and C and kbase of coker(Hom) in Hom(F0,G0) 732 printlevel >=2: elements of kbase of coker(Hom) as matrix :F0-->G0 733 NOTE: DISPLAY is as described only for a direct call of 'Hom'. Calling 'Hom' 734 from another proc has the same effect as decreasing printlevel by 1. 735 EXAMPLE: example Hom; shows examples 736 { 737 //---------- initialisation --------------------------------------------------- 738 int l,p; 739 matrix kb; 740 module A,B,C,D,homMN,homMN0; 741 list L; 742 //---------- computation of Hom ----------------------------------------------- 743 B = kohom(N,ncols(M)); 744 A = kontrahom(M,nrows(N)); 745 C = kohom(N,nrows(M)); 746 D = modulo(A,B); 747 homMN = modulo(D,C); 748 homMN0= std(homMN); 749 p = printlevel-voice+3; // p=printlevel+1 (default: p=1) 750 if( p>=0 ) { "// degree of Hom:"; degree(homMN0); ""; } 751 dbprint(p-1,"// given ...--> F1 --M-> F0 -->M'--> 0 and ...--> G1 --N-> G0 -->N'--> 0,", 752 "// show D=ker(Hom(F0,G0) --> Hom(F1,G0)/im(Hom(F1,G1) --> Hom(F1,G0)))",D, 753 "// show C=im(Hom(F0,G1) --> Hom(F0,G0))",C,""); 754 //---------- extra output if size(#)>0 ---------------------------------------- 755 if( size(#)>0 ) 756 { if( vdim(homMN0)>0 ) 757 { kb = kbase(homMN0); 758 kb = matrix(D)*kb; 759 if( p>2 ) 760 { for (l=1;l<=ncols(kb);l=l+1) 761 { 762 "// element",l,"of kbase of Hom in Hom(F0,G0) as matrix: F0-->G0:"; 763 print(matrix(ideal(kb[l]),nrows(N),nrows(M))); 764 } 765 } 766 else 767 { dbprint(p-1,"// columns of matrix are kbase of Hom in Hom(F0,G0)",kb); } 768 L=homMN,homMN0,kb; return(L); 769 } 770 L=homMN,homMN0; return(L); 771 } 772 return(homMN); 773 } 774 example 775 {"EXAMPLE:"; echo = 2; 776 int p = printlevel; 777 printlevel= 1; //in 'example proc' printlevel has to be increased by 1 778 ring r = 0,(x,y),dp; 779 ideal i = x2-y3,xy; 780 qring q = std(i); 781 ideal i = fetch(r,i); 782 module M = [-x,y],[-y2,x],[x3]; 783 module H = Hom(M,i); 784 print(H); 785 printlevel= 2; 786 list L = Hom(M,i,1);""; 787 ring s = 3,(x,y,z),(c,dp); 788 ideal i = jacob(ideal(x2+y5+z4)); 789 qring rq=std(i); 790 matrix M[2][2]=xy,x3,5y,4z,x2; 791 matrix N[3][2]=x2,x,y3,3xz,x2z,z; 792 print(M); 793 print(N); 794 list l=Hom(M,N,1); 795 printlevel = p; 796 } 797 //////////////////////////////////////////////////////////////////////////////// 798 799 proc homology (matrix A,matrix B,module M,module N,list #) 800 USAGE: homology(A,B,M,N); 801 COMPUTE: Let M and N be submodules of R^m and R^n presenting M'=R^m/M, N'=R^n/N 802 (R=basering) and let A,B matrices inducing maps R^k--A-->R^m--B-->R^n. 803 Compute a presentation R^q --H-> R^m of the module 804 ker(B)/im(A) := ker(M'/im(A) --B--> N'/im(BM)+im(BA)). 805 If B induces a map M'--B-->N' (i.e BM=0) and if R^k--A-->M'--B-->N' is 806 a complex (i.e. BA=0) then ker(B)/im(A) is the homology of this complex 807 RETURN: module H, a presentation of ker(B)/im(A) 808 NOTE: homology returns a free module of rank m if ker(B)=im(A) 809 EXAMPLE: example homology; shows examples 810 { 811 module ker,ima; 812 ker = modulo(B,N); 813 ima = A,M; 814 return(modulo(ker,ima)); 815 } 816 example 817 {"EXAMPLE"; echo=2; 818 ring r; 819 ideal id=maxideal(4); 820 qring qr=std(id); 821 module N=maxideal(3)*freemodule(2); 822 module M=maxideal(2)*freemodule(2); 823 module B=[2x,0],[x,y],[z2,y]; 824 module A=M; 825 degree(std(homology(A,B,M,N)));""; 826 ring s=0,x,ds; 827 qring qs=std(x4); 828 module A=[x];module B=A; 829 module M=[x3];module N=M; 830 homology(A,B,M,N); 177 831 } 178 832 ////////////////////////////////////////////////////////////////////////////// 179 833 834 proc kernel (matrix A,module M,module N) 835 USAGE: kernel(A,M,N); 836 COMPUTE: Let M and N be submodules of R^m and R^n presenting M'=R^m/M, N'=R^n/N 837 (R=basering) and let A:R^m-->R^n a matrix inducing a map A':M'-->N'. 838 Compute a presentation K of ker(A') as in the commutative diagram: 839 ker(A') ---> M' --A'--> N' 840 |^ |^ |^ 841 | | | 842 R^r ---> R^m --A--> R^n 843 |^ |^ |^ 844 |K |M |N 845 | | | 846 R^s ---> R^p -----> R^q 847 RETURN: module K, a presentation of ker(A') 848 EXAMPLE: example kernel; shows examples 849 { 850 module M1 = modulo(A,N); 851 return(modulo(M1,M)); 852 } 853 example 854 {"EXAMPLE"; echo=2; 855 ring r; 856 module N=[2x,x],[0,y]; 857 module M=maxideal(1)*freemodule(2); 858 matrix A[2][2]=2x,0,x,y,z2,y; 859 module K=kernel(A,M,N); 860 degree(std(K)); 861 print(K); 862 } 863 //////////////////////////////////////////////////////////////////////////////// 864 865 proc kohom (matrix M, int j) 866 USAGE: kohom(A,k); A=matrix, k=integer 867 RETURN: matrix Hom(R^k,A) i.e. let A be a matrix defining a map: F1 --> F2 of 868 free R-modules, the matrix of Hom(R^k,F1)-->Hom(R^k,F2) is computed 869 EXAMPLE: example kohom; shows an example 870 { 871 if (j==1) 872 { return(M);} 873 if (j>1) 874 { return(outer(M,diag(1,j))); } 875 else { return(0);} 876 } 877 example 878 {"EXAMPLE:"; echo=2; 879 ring r; 880 matrix n[2][3]=x,y,5,z,77,33; 881 print(kohom(n,3)); 882 } 883 ///////////////////////////////////////////////////////////////////////////////// 884 180 885 proc kontrahom (matrix M, int j) 181 USAGE: qmod(M,N); M,N=modules, N a submodule of M182 886 USAGE: kontrahom(A,k); A=matrix, k=integer 183 RETURN: Hom(A,P^k), i.e. let A be a matrix defining a map: F1 --> F2 of free184 P-modules, the matrix of Hom(F2,P^k)-->Hom(F1,P^k) is computed887 RETURN: matrix Hom(A,R^k), i.e. let A be a matrix defining a map: F1 --> F2 of 888 free R-modules, the matrix of Hom(F2,R^k)-->Hom(F1,R^k) is computed 185 889 EXAMPLE: example kontrahom; shows an example 186 890 { 187 return(transpose(outer(diag(1,j),M))); 891 if (j==1) 892 { return(transpose(M));} 893 if (j>1) 894 { return(transpose(outer(diag(1,j),M)));} 895 else { return(0);} 188 896 } 189 897 example 190 { 191 192 193 898 {"EXAMPLE:"; echo=2; 899 ring r; 900 matrix n[2][3]=x,y,5,z,77,33; 901 print(kontrahom(n,3)); 194 902 } 195 903 /////////////////////////////////////////////////////////////////////////////// 196 197 proc kohom (matrix M, int j)198 USAGE: kohom(A,k); A=matrix, k=integer199 RETURN: Hom(P^k,A) i.e. let A be a matrix defining a map: F1 --> F2 of free200 P-modules, the matrix of Hom(P^k,F1)-->Hom(P^k,F2) is computed201 EXAMPLE: example kohom; shows an example202 {203 return(outer(M,diag(1,j)));204 }205 example206 { "EXAMPLE:"; echo=2;207 ring r;208 matrix n[2][3]=x,y,5,z,77,33;209 print(kohom(n,3));210 }211 ///////////////////////////////////////////////////////////////////////////////212
Note: See TracChangeset
for help on using the changeset viewer.