source: git/Tst/BuchDL/Sol_Exe_3.tst @ 8f1d129

spielwiese
Last change on this file since 8f1d129 was 4657b0, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes: diffrent homog and attrib git-svn-id: file:///usr/local/Singular/svn/trunk@9305 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.5 KB
Line 
1LIB "tst.lib";
2tst_init();
3
4
5//======================  Exercise 3.1 =============================
6proc is_reg_sequence (ideal I)
7"USAGE:   is_reg_sequence(I);  I ideal,
8RETURN:  1 if the given (ordered) list of generators for I is a
9           regular sequence;
10         0 otherwise.
11"
12{
13  int i;
14  ideal J;
15  while(i<size(I))
16  {
17    i++;
18    if (size(reduce(quotient(J,I[i]),J))!=0)
19    {
20      return(0);
21    }
22    J = groebner(J+I[i]);
23  }
24  if (size(reduce(1,J))==0) { return(0); }
25  return(1);
26}
27
28ring R = 0, (x,y,z), dp;
29ideal I = (x-1)*z, (x-1)*y, x;
30is_reg_sequence (I);
31//-> 0
32I = (x-1)*z, x, (x-1)*y;
33is_reg_sequence (I);
34//-> 1
35
36
37kill R;
38//======================  Exercise 3.2 =============================
39if (not(defined(isCM))){ LIB "homolog.lib"; }
40ring R1 = 0, (x,y,z), dp;
41ideal I =  xy, yz, xz;
42ring R1_loc = 0, (x,y,z), ds;
43ideal I = imap(R1,I);  // ideal generated by I in localized ring
44isCM(I);
45
46ring R2 = 0, (s,t,x,y,z,w), dp;
47ideal I =  x-s4, y-s3t, z-st3, w-t4;
48ideal IC = eliminate(I,st);
49ring R2_loc = 0, (x,y,z,w), ds;
50ideal IC = imap(R2,IC);
51isCM(IC);
52
53
54kill R1,R1_loc,R2,R2_loc;
55//======================  Exercise 3.3 =============================
56proc truncate(module phi, int d)
57"USAGE:   truncate(phi,d);  phi module, d int
58ASSUME:  phi comes assigned with an admissible degree vector as an
59         attribute
60RETURN:  module
61NOTE:    Output is a presentation matrix for the truncation of
62         coker(phi) at d.
63"
64{
65  if ( typeof(attrib(phi,"isHomog"))=="string" )
66  { 
67    ERROR("No admissible degree vector assigned");
68  }
69  else
70  {
71    intvec v=attrib(phi,"isHomog");
72  }
73  int s = nrows(phi);
74  int i,m,dummy;
75  module L;
76  for (i=1; i<=s; i++)
77  {
78    if (d>v[i])
79    {
80      L = L+maxideal(d-v[i])*gen(i);
81    }
82    else
83    {
84      L = L+gen(i);
85    }
86  }
87  L = modulo(L,phi);
88  L = prune(L);
89  if (size(L)==0) {return(L);}
90
91  // it only remains to set the degrees for L:
92  // ------------------------------------------
93  m = v[1];
94  for(i=2; i<=size(v); i++)
95  {
96    if(v[i]<m)
97    {
98      m = v[i];
99    }
100  }
101  dummy = homog(L);
102  intvec vv = attrib(L,"isHomog");
103  if (d>m)
104  {
105    vv = vv+d-m;
106  }
107  attrib(L,"isHomog",vv);
108  return(L);
109}
110
111proc CM_regularity (module phi)
112"USAGE:   CM_regularity(phi);    phi module
113ASSUME:  phi comes assigned with an admissible degree vector as an
114         attribute
115RETURN:  integer
116NOTE:    Output is the Castelnuovo-Mumford regularity of coker(phi).
117"
118{
119  if ( typeof(attrib(phi,"isHomog"))=="string" )
120  { 
121    ERROR("No admissible degree vector assigned");
122  }
123  def L = mres(phi,0);
124  intmat BeL = betti(L);
125  int r = nrows(module(matrix(BeL)));
126  int shift = attrib(BeL,"rowShift");  // See Section 3.4
127  return(r+shift-1);
128}
129
130ring R = 0, (w,x,y,z), dp;
131module I = [xz,0,-w,-1,0], [-yz2,y2, 0,-w,0], [y2z,0,-z2,0,-x],
132           [y3,0,-yz,-x,0], [-z3,yz,0,0,-w], [-yz2,y2,0,-w,0],
133           [0,0,-wy2+xz2,-y2,x2]; 
134homog(I);
135CM_regularity(I);
136//->  3
137def T2 = mres(truncate(I,2),0);
138print (betti(T2),"betti");
139//->             0     1     2     3
140//->  ------------------------------
141//->      2:    19    36    23     6
142//->      3:     -     -     1     -
143//->  ------------------------------
144//->  total:    19    36    24     6
145
146def T3 = mres(truncate(I,3),0);
147print (betti(T3),"betti");
148//->             0     1     2     3
149//->  ------------------------------
150//->      3:    40    91    71    19
151//->  ------------------------------
152//->  total:    40    91    71    19
153
154
155kill R;
156//======================  Exercise 3.4 =============================
157//===== Procedures are stored in the library file sol_3_4.lib ======
158//==================================================================
159LIB "sol_3_4.lib";
160example ker_Mod;
161example Ext_Mod;
162
163
164//======================  Exercise 3.5 =============================
165ring S = 32003, x(0..4), dp;
166resolution kos = nres(maxideal(1),0);
167print(betti(kos),"betti");
168matrix alpha0 = random(32002,10,5);
169matrix pres = module(alpha0)+kos[4];
170matrix dir = transpose(pres);
171resolution fdir = mres(dir,2);
172print(betti(fdir),"betti");
173if (not(defined(flatten))) { LIB "matrix.lib"; }
174ideal I = flatten(fdir[2]);
175resolution FI = mres(I,0);
176print(betti(FI),"betti");
177
178ring S1 = 32003, x(0..4), dp;
179resolution kos = nres(maxideal(1),0);
180betti(kos);
181matrix gammatilde = random(32002,20,19);
182matrix kos1 = matrix(kos[1]);
183matrix kos2 = kos[2];
184if (not(defined(dsum))){ LIB"matrix.lib"; }
185matrix kos2pluskos1pluskos1 = dsum(kos2,kos1,kos1);
186module delta = kos2pluskos1pluskos1*gammatilde;
187attrib(delta,"isHomog",intvec(-1,-1,-1,-1,-1,-1,-1));
188resolution fdelta = mres(delta,0);
189print(betti(fdelta),"betti");
190//->             0     1     2     3     4     5
191//->  ------------------------------------------
192//->     -1:     7    19    25    15     3     -
193//->      0:     -     -     -     2     3     1
194//->  ------------------------------------------
195//->  total:     7    19    25    17     6     1
196
197matrix psi = matrix(fdelta[3]);
198matrix talpha1 = random(32002,3,15);
199matrix zero[3][2];
200talpha1 = concat(talpha1,zero);
201matrix kos5 = kos[5];
202matrix tphi = transpose(dsum(kos5,kos5,kos5));
203matrix talpha1tilde = talpha1*transpose(psi);
204matrix talpha0 = lift(tphi,talpha1tilde);
205
206matrix dir = transpose(concat(psi,transpose(talpha0)));
207resolution fdir = mres(dir,2);
208print(betti(fdir),"betti");
209ideal I = groebner(flatten(fdir[2]));
210resolution FI = mres(I,0);
211print(betti(FI),"betti");
212// ---------- Check Smoothness ------------
213int codimI = nvars(S1)-dim(I);
214nvars(S1) - dim(groebner(minor(jacob(I),codimI) + I));
215//-> 5
216// ----------------------------------------
217
218tst_status(1);$
219
Note: See TracBrowser for help on using the repository browser.