1 | LIB "tst.lib"; |
---|
2 | tst_init(); |
---|
3 | |
---|
4 | |
---|
5 | //====================== Example 8.6 ============================= |
---|
6 | LIB "finvar.lib"; |
---|
7 | ring R = (0,a), (x(0..4)), dp; |
---|
8 | minpoly = a4+a3+a2+a+1; // need fifth roots of unity |
---|
9 | matrix Si[5][5] = 0,0,0,0,1, |
---|
10 | 1,0,0,0,0, |
---|
11 | 0,1,0,0,0, |
---|
12 | 0,0,1,0,0, |
---|
13 | 0,0,0,1,0; |
---|
14 | matrix Ta[5][5]; |
---|
15 | Ta[1,1] = 1; Ta[2,2] = a; Ta[3,3] = a2; Ta[4,4] = a3; |
---|
16 | Ta[5,5] = a4; |
---|
17 | int aa = timer; // time in seconds |
---|
18 | matrix P,S,IS = invariant_ring(Si,Ta,intvec(0,0,1)); |
---|
19 | |
---|
20 | //-> Generating the entire matrix group. Whenever a new group element is |
---|
21 | //-> found, the corresponding ring homomorphism of the Reynolds operator |
---|
22 | //-> and the corresponding term of the Molien series is generated. |
---|
23 | |
---|
24 | //-> Group element 3 has been found. |
---|
25 | //-> [...] |
---|
26 | //-> Group element 125 has been found. |
---|
27 | |
---|
28 | //-> Now we are done calculating Molien series and Reynolds operator. |
---|
29 | |
---|
30 | //-> We can start looking for primary invariants... |
---|
31 | |
---|
32 | //-> Computing primary invariants in degree 5: |
---|
33 | //-> We find: x(0)*x(1)*x(2)*x(3)*x(4) |
---|
34 | //-> We find: x(0)^3*x(2)*x(3)+x(0)*x(1)*x(3)^3+x(0)*x(2)^3*x(4)+[...] |
---|
35 | //-> We find: x(0)*x(1)^3*x(2)+x(1)*x(2)^3*x(3)+x(0)^3*x(1)*x(4)+[...] |
---|
36 | //-> Computing primary invariants in degree 10: |
---|
37 | //-> We find: x(0)^10+x(1)^10+x(2)^10+x(3)^10+x(4)^10 |
---|
38 | //-> We find: -x(0)^5*x(1)^5+x(0)^5*x(2)^5-[...] |
---|
39 | |
---|
40 | //-> We found all primary invariants. |
---|
41 | |
---|
42 | //-> Polynomial telling us where to look for secondary invariants: |
---|
43 | //-> x(0)^30+3*x(0)^25+24*x(0)^20+44*x(0)^15+24*x(0)^10+3*x(0)^5+1 |
---|
44 | |
---|
45 | //-> In degree 0 we have: 1 |
---|
46 | |
---|
47 | //-> Searching in degree 5, we need to find 3 invariant(s)... |
---|
48 | //-> We find: x(0)^2*x(1)^2*x(3)+x(0)*x(2)^2*x(3)^2+[...] |
---|
49 | //-> We find: x(0)^2*x(1)*x(2)^2+x(1)^2*x(2)*x(3)^2+[...] |
---|
50 | //-> We find: x(0)^5+x(1)^5+x(2)^5+x(3)^5+x(4)^5 . |
---|
51 | |
---|
52 | //-> Searching in degree 10, we need to find 24 invariant(s)... |
---|
53 | //-> [...] |
---|
54 | //-> Searching in degree 15, we need to find 44 invariant(s)... |
---|
55 | //-> [...] |
---|
56 | //-> Searching in degree 20, we need to find 24 invariant(s)... |
---|
57 | //-> [...] |
---|
58 | //-> Searching in degree 25, we need to find 3 invariant(s)... |
---|
59 | //-> [...] |
---|
60 | //-> Searching in degree 30, we need to find 1 invariant(s)... |
---|
61 | //-> We find: x(0)^15*x(1)^10*x(3)^5+x(0)^10*x(1)^15*x(3)^5+[...] |
---|
62 | |
---|
63 | //-> We're done! |
---|
64 | |
---|
65 | ideal HMQ = invariant_basis(5,Si,Ta); |
---|
66 | print(HMQ); |
---|
67 | //-> x(0)*x(1)*x(2)*x(3)*x(4), |
---|
68 | //-> x(0)^2*x(1)*x(2)^2+x(1)^2*x(2)*x(3)^2+x(0)^2*x(3)^2*x(4)+[...] |
---|
69 | //-> x(0)^2*x(1)^2*x(3)+x(0)*x(2)^2*x(3)^2+x(1)^2*x(2)^2*x(4)+[...] |
---|
70 | //-> x(0)^3*x(2)*x(3)+x(0)*x(1)*x(3)^3+x(0)*x(2)^3*x(4)+[...] |
---|
71 | //-> x(0)*x(1)^3*x(2)+x(1)*x(2)^3*x(3)+x(0)^3*x(1)*x(4)+[...] |
---|
72 | //-> x(0)^5+x(1)^5+x(2)^5+x(3)^5+x(4)^5 |
---|
73 | |
---|
74 | |
---|
75 | kill R,aa; |
---|
76 | //================== Remark 8.7(new Session) ========================= |
---|
77 | if (not(defined(invariant_ring))){ LIB "finvar.lib"; } |
---|
78 | ring R = 101, (x(0..4)), dp; |
---|
79 | matrix Si[5][5] = 0,0,0,0,1, |
---|
80 | 1,0,0,0,0, |
---|
81 | 0,1,0,0,0, |
---|
82 | 0,0,1,0,0, |
---|
83 | 0,0,0,1,0; |
---|
84 | number a = 36; // primitive fifth root of unity |
---|
85 | matrix Ta[5][5]; |
---|
86 | Ta[1,1] = 1; Ta[2,2] = a; Ta[3,3] = a^2; Ta[4,4] = a^3; |
---|
87 | Ta[5,5] = a^4; |
---|
88 | int aa = timer; // time in seconds |
---|
89 | matrix P,S,IS = invariant_ring(Si,Ta,intvec(0,0,0)); |
---|
90 | size(S); |
---|
91 | //-> 100 |
---|
92 | print(S[100]); |
---|
93 | //-> [x(0)^15*x(1)^10*x(3)^5+x(0)^10*x(1)^15*x(3)^5+[...] |
---|
94 | ideal HMQ = invariant_basis(5,Si,Ta); |
---|
95 | |
---|
96 | //================== Example 8.8 (continued Session) =================== |
---|
97 | ring P4 = 101, (x(0..4)), dp; |
---|
98 | ideal HMQ = fetch(R,HMQ); |
---|
99 | ideal CI = HMQ[1], HMQ[2]; |
---|
100 | list DEG = primdecGTZ(CI); |
---|
101 | size(DEG); |
---|
102 | //-> 10 |
---|
103 | ideal I6 = DEG[6][1]; I6; |
---|
104 | //-> I6[1]=x(1)^2*x(3)+x(2)*x(4)^2 |
---|
105 | //-> I6[2]=x(0) |
---|
106 | degree(std(I6)); |
---|
107 | //-> // dimension (proj.) = 2 |
---|
108 | //-> // degree (proj.) = 3 |
---|
109 | ideal I10 = DEG[10][1]; I10; |
---|
110 | //-> I10[1]=x(2)^2 |
---|
111 | //-> I10[2]=x(2)*x(3)^2+x(0)*x(4)^2 |
---|
112 | //-> I10[3]=x(0)*x(2) |
---|
113 | //-> I10[4]=x(0)^2 |
---|
114 | degree(std(I10)); |
---|
115 | //-> // dimension (proj.) = 2 |
---|
116 | //-> // degree (proj.) = 2 |
---|
117 | ideal IX = intersect(DEG[3][1],DEG[4][1],DEG[8][1],DEG[9][1], |
---|
118 | DEG[10][1]); |
---|
119 | degree(std(IX)); |
---|
120 | //-> // dimension (proj.) = 2 |
---|
121 | //-> // degree (proj.) = 10 |
---|
122 | resolution FIX = mres(IX,0); |
---|
123 | print(betti(FIX),"betti"); |
---|
124 | //-> 0 1 2 3 4 |
---|
125 | //-> ------------------------------------ |
---|
126 | //-> 0: 1 - - - - |
---|
127 | //-> 1: - - - - - |
---|
128 | //-> 2: - - - - - |
---|
129 | //-> 3: - - - - - |
---|
130 | //-> 4: - 3 - - - |
---|
131 | //-> 5: - 15 35 20 - |
---|
132 | //-> 6: - - - - 2 |
---|
133 | //-> ------------------------------------ |
---|
134 | //-> total: 1 18 35 20 2 |
---|
135 | |
---|
136 | module N = transpose(FIX[3]); |
---|
137 | homog(N); |
---|
138 | //-> 1 |
---|
139 | intvec deg_N = attrib(N,"isHomog"); |
---|
140 | attrib(N,"isHomog",deg_N-3); // set degrees |
---|
141 | resolution FN = mres(N,0); |
---|
142 | print(betti(FN),"betti"); |
---|
143 | //-> 0 1 2 3 4 5 |
---|
144 | //-> ------------------------------------------ |
---|
145 | //-> -3: 20 35 15 - - - |
---|
146 | //-> -2: - - 4 - - - |
---|
147 | //-> -1: - - - - - - |
---|
148 | //-> 0: - - 5 15 10 2 |
---|
149 | //-> ------------------------------------------ |
---|
150 | //-> total: 20 35 24 15 10 2 |
---|
151 | matrix NN = FN[2]; |
---|
152 | matrix PRESMHM[35][19] = NN[1..35,1..19]; |
---|
153 | PRESMHM = transpose(PRESMHM); |
---|
154 | resolution FMHM = mres(PRESMHM,0); |
---|
155 | print(betti(FMHM),"betti"); |
---|
156 | //-> 0 1 2 3 |
---|
157 | //-> ------------------------------ |
---|
158 | //-> 0: 4 - - - |
---|
159 | //-> 1: 15 35 20 - |
---|
160 | //-> 2: - - - 2 |
---|
161 | //-> ------------------------------ |
---|
162 | //-> total: 19 35 20 2 |
---|
163 | |
---|
164 | matrix zero[1][15]; |
---|
165 | matrix ran = random(100,1,4); |
---|
166 | matrix psi = transpose(concat(zero,ran)); |
---|
167 | matrix pres = PRESMHM + module(psi); |
---|
168 | module dir = transpose(pres); |
---|
169 | resolution fdir = mres(dir,2); |
---|
170 | print(betti(fdir),"betti"); |
---|
171 | //-> 0 1 2 |
---|
172 | //-> ------------------------ |
---|
173 | //-> 0: 35 15 - |
---|
174 | //-> 1: - 3 - |
---|
175 | //-> 2: - - - |
---|
176 | //-> 3: - - - |
---|
177 | //-> 4: - - - |
---|
178 | //-> 5: - - 1 |
---|
179 | //-> ------------------------ |
---|
180 | //-> total: 35 18 1 |
---|
181 | ideal IA = groebner(flatten(fdir[2])); |
---|
182 | int codimIA = nvars(P4) - dim(IA); |
---|
183 | ideal sIA = minor(jacob(IA),codimIA)+IA; |
---|
184 | nvars(P4) - dim(groebner(sIA)); |
---|
185 | //-> 5 |
---|
186 | |
---|
187 | matrix dummy[1][3] = IA[1..3]; // the 3 quintics in IA |
---|
188 | ideal CI2 = dummy*random(100,3,2); |
---|
189 | ideal IA' = sat(CI2,IA)[1]; |
---|
190 | resolution FIA' = mres(IA',0); |
---|
191 | print(betti(FIA'),"betti"); |
---|
192 | //-> 0 1 2 3 4 |
---|
193 | //-> ------------------------------------ |
---|
194 | //-> 0: 1 - - - - |
---|
195 | //-> 1: - - - - - |
---|
196 | //-> 2: - - - - - |
---|
197 | //-> 3: - - - - - |
---|
198 | //-> 4: - 3 - - - |
---|
199 | //-> 5: - - - - - |
---|
200 | //-> 6: - 5 15 10 2 |
---|
201 | //-> ------------------------------------ |
---|
202 | //-> total: 1 8 15 10 2 |
---|
203 | int codimIA' = nvars(P4) - dim(IA'); |
---|
204 | ideal sIA' = minor(jacob(IA'),codimIA')+IA'; |
---|
205 | nvars(P4) - dim(groebner(sIA')); |
---|
206 | //-> 5 |
---|
207 | |
---|
208 | ideal QA = IA[1..3]; |
---|
209 | ideal HMlines = sat(QA,IA)[1]; // result is a Groebner basis |
---|
210 | degree(HMlines); |
---|
211 | //-> // dimension (proj.) = 1 |
---|
212 | //-> // degree (proj.) = 25 |
---|
213 | |
---|
214 | |
---|
215 | kill R,aa,P4,codimIA,codimIA',deg_N; |
---|
216 | //================== Example 8.9 (new Session) ========================= |
---|
217 | ring R = 2, (x(1..4)), dp; |
---|
218 | matrix A[4][4]; |
---|
219 | A[1,4] = 1; A[2,1] = 1; A[3,2] = 1; A[4,3] = 1; |
---|
220 | print(A); |
---|
221 | //-> 0,0,0,1, |
---|
222 | //-> 1,0,0,0, |
---|
223 | //-> 0,1,0,0, |
---|
224 | //-> 0,0,1,0 |
---|
225 | if (not(defined(invariant_ring))){ LIB "finvar.lib"; } |
---|
226 | matrix P,S = invariant_ring(A); |
---|
227 | P; |
---|
228 | //-> P[1,1]=x(1)+x(2)+x(3)+x(4) |
---|
229 | //-> P[1,2]=x(1)*x(3)+x(2)*x(4) |
---|
230 | //-> P[1,3]=x(1)*x(2)+x(2)*x(3)+x(1)*x(4)+x(3)*x(4) |
---|
231 | //-> P[1,4]=x(1)*x(2)*x(3)*x(4) |
---|
232 | size(S); |
---|
233 | //-> 5 |
---|
234 | |
---|
235 | |
---|
236 | kill R; |
---|
237 | //================== Example 8.10 (new Session) ========================= |
---|
238 | if (not(defined(invariant_ring))){ LIB "finvar.lib"; } |
---|
239 | ring R = (0,a), (x(0..3)), dp; |
---|
240 | minpoly = a4+a3+a2+a+1; |
---|
241 | matrix A[4][4]; |
---|
242 | A[1,1] = a; A[2,2] = a2; A[3,3] = a3; A[4,4] = a4; |
---|
243 | matrix P,S,IS = invariant_ring(A,intvec(0,0,0)); |
---|
244 | size(P); |
---|
245 | //-> 4 |
---|
246 | size(S); |
---|
247 | //-> 12 |
---|
248 | |
---|
249 | proc min_generating_set (matrix P,S) |
---|
250 | "USAGE: min_generating_set(P,S); P,S matrix |
---|
251 | ASSUME: The entries of P,S are homogeneous and ordered by ascending |
---|
252 | degrees. The first entry of S equals 1. (As satisfied by |
---|
253 | the first two output matrices of invariant_ring(G).) |
---|
254 | RETURN: ideal |
---|
255 | NOTE: The given generators for the output ideal form a minimal |
---|
256 | generating set for the ring generated by the entries of |
---|
257 | P,S. The generators are homogeneous and ordered by |
---|
258 | descending degrees. |
---|
259 | " |
---|
260 | { |
---|
261 | if (defined(flatten)==0) { LIB "matrix.lib"; } |
---|
262 | ideal I1,I2 = flatten(P),flatten(S); |
---|
263 | int i1,i2 = size(I1),size(I2); |
---|
264 | // We order the generators by descending degrees |
---|
265 | // (the first generator 1 of I2 is omitted): |
---|
266 | int i,j,s = i1,i2,i1+i2-1; |
---|
267 | ideal I; |
---|
268 | for (int k=1; k<=s; k++) |
---|
269 | { |
---|
270 | if (i==0) { I[k]=I2[j]; j--; } |
---|
271 | else |
---|
272 | { |
---|
273 | if (j==0) { I[k]=I1[i]; i--; } |
---|
274 | else |
---|
275 | { |
---|
276 | if (deg(I1[i])>deg(I2[j])) { I[k]=I1[i]; i--; } |
---|
277 | else { I[k]=I2[j]; j--; } |
---|
278 | } |
---|
279 | } |
---|
280 | } |
---|
281 | intvec deg_I = deg(I[1..s]); |
---|
282 | int n = nvars(basering); |
---|
283 | def BR = basering; |
---|
284 | |
---|
285 | // Create a new ring with elimination order: |
---|
286 | //--------------------------------------------------------------- |
---|
287 | // **** this part uses the command ringlist which is **** |
---|
288 | // **** only available in SINGULAR-3-0-0 or newer **** |
---|
289 | //--------------------------------------------------------------- |
---|
290 | list rData = ringlist(BR); |
---|
291 | intvec wDp; |
---|
292 | for (k=1; k<=n; k++) { |
---|
293 | rData[2][k] ="x("+string(k)+ ")"; |
---|
294 | wDp[k]=1; |
---|
295 | } |
---|
296 | for (k=1; k<=s; k++) { rData[2][n+k] ="y("+string(k)+ ")"; } |
---|
297 | rData[3][1] = list("dp",wDp); |
---|
298 | rData[3][2] = list("wp",deg_I); |
---|
299 | def R_aux = ring(rData); |
---|
300 | setring R_aux; |
---|
301 | //--------------------------------------------------------------- |
---|
302 | |
---|
303 | ideal J; |
---|
304 | map phi = BR, x(1..n); |
---|
305 | ideal I = phi(I); |
---|
306 | for (k=1; k<=s; k++) { J[k] = y(k)-I[k]; } |
---|
307 | option(redSB); |
---|
308 | J = std(J); |
---|
309 | |
---|
310 | // Remove all generators that are depending on some x(i) from J: |
---|
311 | int s_J = size(J); |
---|
312 | for (k=1; k<=s_J; k++) { if (J[k]>=x(n)) {J[k]=0;} } |
---|
313 | |
---|
314 | // The monomial order on K[y] is chosen such that linear leading |
---|
315 | // terms in J are in 1-1 correspondence to superfluous generators |
---|
316 | // in I : |
---|
317 | ideal J_1jet = std(jet(lead(J),1)); |
---|
318 | intvec to_remove; |
---|
319 | i=1; |
---|
320 | for (k=1; k<=s; k++) |
---|
321 | { |
---|
322 | if (reduce(y(k),J_1jet)==0){ to_remove[i]=k; i++; } |
---|
323 | } |
---|
324 | setring BR; |
---|
325 | if (to_remove == 0) { return(ideal(I)); } |
---|
326 | for (i=1; i<=size(to_remove); i++) |
---|
327 | { |
---|
328 | I[to_remove[i]] = 0; |
---|
329 | } |
---|
330 | I = simplify(I,2); |
---|
331 | return(I); |
---|
332 | } |
---|
333 | |
---|
334 | ideal FSI = min_generating_set(P,S); |
---|
335 | size(FSI); |
---|
336 | //-> 14 |
---|
337 | ring Rnew = 0, (x(0..3)), dp; // coefficient field is now Q |
---|
338 | ideal FSI = fetch(R,FSI); |
---|
339 | ideal ZERO; |
---|
340 | ring R1 = 0, (y(0..13)), wp(5,5,5,5,4,4,4,4,3,3,3,3,2,2); |
---|
341 | ideal REL = preimage(Rnew,FSI,ZERO); |
---|
342 | homog(REL); // check that REL is homogeneous |
---|
343 | //-> 1 |
---|
344 | size(REL); |
---|
345 | //-> 54 |
---|
346 | setring Rnew; |
---|
347 | FSI[4]; |
---|
348 | //-> x(0)^5+x(1)^5+x(2)^5+x(3)^5 |
---|
349 | ideal F = FSI[4]; |
---|
350 | setring R1; |
---|
351 | ideal GODEAUX = preimage(Rnew,FSI,F); |
---|
352 | size(GODEAUX); |
---|
353 | //-> 55 |
---|
354 | GODEAUX[1]; |
---|
355 | //-> y(3) |
---|
356 | dim(std(GODEAUX)); |
---|
357 | //-> 3 |
---|
358 | |
---|
359 | tst_status(1);$ |
---|
360 | |
---|