1 | LIB "tst.lib"; |
---|
2 | tst_init(); |
---|
3 | |
---|
4 | |
---|
5 | //====================== Example 4.9 ============================= |
---|
6 | ring R = 0, (w,x,y,z), dp; |
---|
7 | matrix m[2][3] = w,x,y,x,y,z; |
---|
8 | ideal I = minor(m,2); |
---|
9 | I; |
---|
10 | //-> I[1]=-y2+xz |
---|
11 | //-> I[2]=xy-wz |
---|
12 | //-> I[3]=x2-wy |
---|
13 | qring Q = groebner(I); |
---|
14 | resolution F=mres(maxideal(1),0); |
---|
15 | //-> // ** full resolution in a qring may be infinite, |
---|
16 | //-> setting max length to 6 |
---|
17 | print(betti(F),"betti"); |
---|
18 | //-> 0 1 2 3 4 5 6 |
---|
19 | //-> ------------------------------------------------ |
---|
20 | //-> 0: 1 4 9 18 36 72 144 |
---|
21 | //-> ------------------------------------------------ |
---|
22 | //-> total: 1 4 9 18 36 72 144 |
---|
23 | |
---|
24 | |
---|
25 | kill F; //------- Alternatively: |
---|
26 | resolution F = mres(maxideal(1),7); |
---|
27 | print(betti(F),"betti"); |
---|
28 | //-> 0 1 2 3 4 5 6 7 |
---|
29 | //-> ------------------------------------------------------ |
---|
30 | //-> 0: 1 4 9 18 36 72 144 288 |
---|
31 | //-> ------------------------------------------------------ |
---|
32 | //-> total: 1 4 9 18 36 72 144 288 |
---|
33 | |
---|
34 | print(F[1],""); |
---|
35 | //-> z,y,x,w |
---|
36 | print(F[2]); |
---|
37 | //-> y, 0, 0, x, 0, 0, w, 0, 0, |
---|
38 | //-> -z,y, 0, 0, x, 0, 0, w, 0, |
---|
39 | //-> 0, -z,y, -z,0, x, 0, 0, w, |
---|
40 | //-> 0, 0, -z,0, -z,-y,-z,-y,-x |
---|
41 | |
---|
42 | if (not(defined(Ext))){ LIB "homolog.lib"; } |
---|
43 | module M = Ext(7,F[1],F[1]); |
---|
44 | //-> // dimension of Ext^7: 0 |
---|
45 | //-> // vdim of Ext^7: 288 |
---|
46 | |
---|
47 | |
---|
48 | kill Q,R; |
---|
49 | //====================== Example 4.11 (new session) ======================= |
---|
50 | ring S = 0, x(0..3), dp; |
---|
51 | resolution kos = mres(maxideal(1),0); |
---|
52 | print(betti(kos),"betti"); |
---|
53 | //-> 0 1 2 3 4 |
---|
54 | //-> ------------------------------------ |
---|
55 | //-> 0: 1 4 6 4 1 |
---|
56 | //-> ------------------------------------ |
---|
57 | //-> total: 1 4 6 4 1 |
---|
58 | |
---|
59 | matrix alpha1 = random(1000,4,1); // randomly created intmat |
---|
60 | matrix tphi = transpose(kos[4]); |
---|
61 | matrix psi = kos[3]; |
---|
62 | matrix talpha1tilde = transpose(psi*alpha1); |
---|
63 | matrix talpha0 = lift(tphi,talpha1tilde); |
---|
64 | print(talpha0); |
---|
65 | |
---|
66 | |
---|
67 | kill S; |
---|
68 | //====================== Example 4.13 (new session) ======================= |
---|
69 | ring S = 32003, x(0..4), dp; |
---|
70 | module MI=maxideal(1); |
---|
71 | attrib(MI,"isHomog",intvec(-1)); |
---|
72 | resolution kos = nres(MI,0); |
---|
73 | print(betti(kos),"betti"); |
---|
74 | //-> 0 1 2 3 4 5 |
---|
75 | //-> ------------------------------------------ |
---|
76 | //-> -1: 1 5 10 10 5 1 |
---|
77 | //-> ------------------------------------------ |
---|
78 | //-> total: 1 5 10 10 5 1 |
---|
79 | |
---|
80 | matrix alpha0 = random(32002,10,3); |
---|
81 | module pres = module(alpha0)+kos[3]; |
---|
82 | |
---|
83 | attrib(pres,"isHomog",intvec(1,1,1,1,1,1,1,1,1,1)); |
---|
84 | resolution fcokernel = mres(pres,0); |
---|
85 | print(betti(fcokernel),"betti"); |
---|
86 | //-> 0 1 2 3 |
---|
87 | //-> ------------------------------ |
---|
88 | //-> 1: 7 10 5 1 |
---|
89 | //-> ------------------------------ |
---|
90 | //-> total: 7 10 5 1 |
---|
91 | |
---|
92 | module dir = transpose(pres); |
---|
93 | intvec w = -1,-1,-1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2; |
---|
94 | attrib(dir,"isHomog",w); |
---|
95 | resolution fdir = mres(dir,2); |
---|
96 | print(betti(fdir),"betti"); |
---|
97 | //-> 0 1 2 |
---|
98 | //-> ------------------------ |
---|
99 | //-> -2: 10 7 - |
---|
100 | //-> -1: - - - |
---|
101 | //-> 0: - - 1 |
---|
102 | //-> ------------------------ |
---|
103 | //-> total: 10 7 1 |
---|
104 | |
---|
105 | if (not(defined(flatten))){ LIB "matrix.lib"; } |
---|
106 | ideal I = groebner(flatten(fdir[2])); |
---|
107 | resolution FI = mres(I,0); |
---|
108 | print(betti(FI),"betti"); |
---|
109 | //-> 0 1 2 3 4 |
---|
110 | //-> ------------------------------------ |
---|
111 | //-> 0: 1 - - - - |
---|
112 | //-> 1: - - - - - |
---|
113 | //-> 2: - 7 10 5 1 |
---|
114 | //-> ------------------------------------ |
---|
115 | //-> total: 1 7 10 5 1 |
---|
116 | |
---|
117 | int codimI = nvars(S)-dim(I); |
---|
118 | codimI; |
---|
119 | //-> 2 |
---|
120 | degree(I); |
---|
121 | //-> 4 |
---|
122 | nvars(S)-dim(groebner(minor(jacob(I),codimI) + I)); |
---|
123 | //-> 5 |
---|
124 | |
---|
125 | |
---|
126 | kill S,w,codimI; |
---|
127 | //====================== Example 4.14 (new session) ======================= |
---|
128 | if (not(defined(dsum))){ LIB "matrix.lib"; } |
---|
129 | ring S = 32003, x(0..4), dp; |
---|
130 | resolution kos = nres(maxideal(1),0); |
---|
131 | betti(kos); |
---|
132 | //-> 1,5,10,10,5,1 |
---|
133 | matrix kos5 = kos[5]; |
---|
134 | matrix tphi = transpose(dsum(kos5,kos5)); |
---|
135 | matrix kos3 = kos[3]; |
---|
136 | matrix psi = dsum(kos3,kos3); |
---|
137 | matrix beta1 = random(32002,20,2); |
---|
138 | matrix tbeta1tilde = transpose(psi*beta1); |
---|
139 | matrix tbeta0 = lift(tphi,tbeta1tilde); |
---|
140 | if (not(defined(Ext_R))){ LIB "homolog.lib"; } |
---|
141 | def E = Ext_R(1,kos[4]); |
---|
142 | //-> // dimension of Ext^1: -1 |
---|
143 | matrix kos4 = kos[4]; |
---|
144 | matrix tkos4pluskos4 = transpose(dsum(kos4,kos4)); |
---|
145 | matrix tgammamin1 = random(32002,20,1); |
---|
146 | matrix tgamma0 = tkos4pluskos4*tgammamin1; |
---|
147 | matrix talpha0 = concat(tbeta0,tgamma0); |
---|
148 | matrix zero[20][1]; |
---|
149 | matrix tpsi = transpose(psi); |
---|
150 | matrix tpresg = concat(tpsi,zero); |
---|
151 | matrix pres = module(transpose(talpha0)) |
---|
152 | + module(transpose(tpresg)); |
---|
153 | module dir = transpose(pres); |
---|
154 | dir = prune(dir); |
---|
155 | homog(dir); |
---|
156 | //-> 1 |
---|
157 | intvec deg_dir = attrib(dir,"isHomog"); |
---|
158 | attrib(dir,"isHomog",deg_dir-2); // set degrees |
---|
159 | resolution fdir = mres(prune(dir),2); |
---|
160 | print(betti(fdir),"betti"); |
---|
161 | //-> 0 1 2 |
---|
162 | //-> ------------------------ |
---|
163 | //-> -2: 20 10 - |
---|
164 | //-> -1: - 1 - |
---|
165 | //-> 0: - - - |
---|
166 | //-> 1: - - - |
---|
167 | //-> 2: - - 1 |
---|
168 | //-> ------------------------ |
---|
169 | //-> total: 20 11 1 |
---|
170 | ideal I = groebner(flatten(fdir[2])); |
---|
171 | resolution FI = mres(I,0); |
---|
172 | print(betti(FI),"betti"); |
---|
173 | //-> 0 1 2 3 4 |
---|
174 | //-> ------------------------------------ |
---|
175 | //-> 0: 1 - - - - |
---|
176 | //-> 1: - - - - - |
---|
177 | //-> 2: - - - - - |
---|
178 | //-> 3: - 1 - - - |
---|
179 | //-> 4: - 10 18 10 2 |
---|
180 | //-> ------------------------------------ |
---|
181 | //-> total: 1 11 18 10 2 |
---|
182 | |
---|
183 | |
---|
184 | //------- check smoothness ---------- |
---|
185 | int codimI = nvars(S)-dim(I); |
---|
186 | codimI; |
---|
187 | //-> 2 |
---|
188 | nvars(S)-dim(groebner(minor(jacob(I),codimI) + I)); |
---|
189 | //-> 5 |
---|
190 | |
---|
191 | tst_status(1);$ |
---|
192 | |
---|