# source:git/Tst/BuchDL/Sol_Exe_3.tst@9558c5f

spielwiese
Last change on this file since 9558c5f was 9558c5f, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes/lossen: very long examples from DL-Book git-svn-id: file:///usr/local/Singular/svn/trunk@8762 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;
106  }
107  else
108  {
109    vv = vv+m;
110  }
111  attrib(L,"isHomog",vv);
112  return(L);
113}
114
115proc CM_regularity (module phi)
116"USAGE:   CM_regularity(phi);    phi module
117ASSUME:  phi comes assigned with an admissible degree vector as an
118         attribute
119RETURN:  integer
120NOTE:    Output is the Castelnuovo-Mumford regularity of coker(phi).
121"
122{
123  if ( typeof(attrib(phi,"isHomog"))=="string" )
124  {
125    ERROR("No admissible degree vector assigned");
126  }
127  def L = mres(phi,0);
128  intmat BeL = betti(L);
129  int r = nrows(module(matrix(BeL)));
130  int shift = attrib(BeL,"rowShift");  // See Section 3.4
131  return(r+shift-1);
132}
133
134ring R = 0, (w,x,y,z), dp;
135module I = [xz,0,-w,-1,0], [-yz2,y2, 0,-w,0], [y2z,0,-z2,0,-x],
136           [y3,0,-yz,-x,0], [-z3,yz,0,0,-w], [-yz2,y2,0,-w,0],
137           [0,0,-wy2+xz2,-y2,x2];
138homog(I);
139CM_regularity(I);
140//->  3
141def T2 = mres(truncate(I,2),0);
142print (betti(T2),"betti");
143//->             0     1     2     3
144//->  ------------------------------
145//->      2:    19    36    23     6
146//->      3:     -     -     1     -
147//->  ------------------------------
148//->  total:    19    36    24     6
149
150def T3 = mres(truncate(I,3),0);
151print (betti(T3),"betti");
152//->             0     1     2     3
153//->  ------------------------------
154//->      3:    40    91    71    19
155//->  ------------------------------
156//->  total:    40    91    71    19
157
158
159kill R;
160//======================  Exercise 3.4 =============================
161//===== Procedures are stored in the library file sol_3_4.lib ======
162//==================================================================
163LIB "sol_3_4.lib";
164example ker_Mod;
165example Ext_Mod;
166
167
168//======================  Exercise 3.5 =============================
169ring S = 32003, x(0..4), dp;
170resolution kos = nres(maxideal(1),0);
171print(betti(kos),"betti");
172matrix alpha0 = random(32002,10,5);
173matrix pres = module(alpha0)+kos[4];
174matrix dir = transpose(pres);
175resolution fdir = mres(dir,2);
176print(betti(fdir),"betti");
177if (not(defined(flatten))) { LIB "matrix.lib"; }
178ideal I = flatten(fdir[2]);
179resolution FI = mres(I,0);
180print(betti(FI),"betti");
181
182ring S1 = 32003, x(0..4), dp;
183resolution kos = nres(maxideal(1),0);
184betti(kos);
185matrix gammatilde = random(32002,20,19);
186matrix kos1 = matrix(kos[1]);
187matrix kos2 = kos[2];
188if (not(defined(dsum))){ LIB"matrix.lib"; }
189matrix kos2pluskos1pluskos1 = dsum(kos2,kos1,kos1);
190module delta = kos2pluskos1pluskos1*gammatilde;
191attrib(delta,"isHomog",intvec(-1,-1,-1,-1,-1,-1,-1));
192resolution fdelta = mres(delta,0);
193print(betti(fdelta),"betti");
194//->             0     1     2     3     4     5
195//->  ------------------------------------------
196//->     -1:     7    19    25    15     3     -
197//->      0:     -     -     -     2     3     1
198//->  ------------------------------------------
199//->  total:     7    19    25    17     6     1
200
201matrix psi = matrix(fdelta[3]);
202matrix talpha1 = random(32002,3,15);
203matrix zero[3][2];
204talpha1 = concat(talpha1,zero);
205matrix kos5 = kos[5];
206matrix tphi = transpose(dsum(kos5,kos5,kos5));
207matrix talpha1tilde = talpha1*transpose(psi);
208matrix talpha0 = lift(tphi,talpha1tilde);
209
210matrix dir = transpose(concat(psi,transpose(talpha0)));
211resolution fdir = mres(dir,2);
212print(betti(fdir),"betti");
213ideal I = groebner(flatten(fdir[2]));
214resolution FI = mres(I,0);
215print(betti(FI),"betti");
216// ---------- Check Smoothness ------------
217int codimI = nvars(S1)-dim(I);
218nvars(S1) - dim(groebner(minor(jacob(I),codimI) + I));
219//-> 5
220// ----------------------------------------
221
222tst_status(1);\$
223
Note: See TracBrowser for help on using the repository browser.