1 | LIB "tst.lib"; |
---|
2 | tst_init(); |
---|
3 | |
---|
4 | |
---|
5 | 2+3+4; |
---|
6 | //-> 9 |
---|
7 | 2+3; 3+5; |
---|
8 | //-> 5 |
---|
9 | //-> 8 |
---|
10 | |
---|
11 | 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 |
---|
12 | +1+1+1+1+1+1+1+1+1+1+1+1+1+1+1; |
---|
13 | //-> 42 |
---|
14 | |
---|
15 | 1/3 + 1/5; |
---|
16 | //-> ? no ring active |
---|
17 | //-> ? error occurred in STDIN line ...: `1/3 + 1/5;` |
---|
18 | |
---|
19 | ring R = 0, (x,y), dp; |
---|
20 | ring R1 = 0, x(1..7), dp; |
---|
21 | ring R2 = (0,i), (x,y), dp; |
---|
22 | minpoly = i^2+1; |
---|
23 | ring R3 = (2,a), (x,y), dp; |
---|
24 | minpoly = a^3+a+1; |
---|
25 | ring R3prime = (2^3,a), (x,y), dp; |
---|
26 | ring R4 = (32003,s,t), (x,y), dp; |
---|
27 | |
---|
28 | //====================== Example 3.2 ============================= |
---|
29 | ring R5 = 0, (w,x,y,z), dp; |
---|
30 | matrix m[2][3] = w,x,y,x,y,z; |
---|
31 | ideal I = minor(m,2); |
---|
32 | qring Q = groebner(I); |
---|
33 | basering; |
---|
34 | //-> // characteristic : 0 |
---|
35 | //-> // number of vars : 4 |
---|
36 | //-> // block 1 : ordering dp |
---|
37 | //-> // : names w x y z |
---|
38 | //-> // block 2 : ordering C |
---|
39 | //-> // quotient ring from ideal |
---|
40 | //-> _[1]=y2-xz |
---|
41 | //-> _[2]=xy-wz |
---|
42 | //-> _[3]=x2-wy |
---|
43 | |
---|
44 | setring R2; |
---|
45 | 1/3+1/5; |
---|
46 | //-> 8/15 |
---|
47 | setring R3; |
---|
48 | 1/3+1/5; |
---|
49 | //-> 0 |
---|
50 | |
---|
51 | varstr(R3); |
---|
52 | //-> x,y |
---|
53 | poly f = x+y; |
---|
54 | f; |
---|
55 | //-> x+y |
---|
56 | ring S3 = (2^3,a), (y,x), dp; |
---|
57 | poly f = x+y; |
---|
58 | f; |
---|
59 | //-> y+x |
---|
60 | |
---|
61 | |
---|
62 | kill R,R1,R2,R3,R3prime,R4,R5,Q,S3; |
---|
63 | //====================== new Session ============================== |
---|
64 | ring R = 0, x(1..7), (dp(3),wp(2,1),dp); |
---|
65 | basering; |
---|
66 | //-> // characteristic : 0 |
---|
67 | //-> // number of vars : 7 |
---|
68 | //-> // block 1 : ordering dp |
---|
69 | //-> // : names x(1) x(2) x(3) |
---|
70 | //-> // block 2 : ordering wp |
---|
71 | //-> // : names x(4) x(5) |
---|
72 | //-> // : weights 2 1 |
---|
73 | //-> // block 3 : ordering dp |
---|
74 | //-> // : names x(6) x(7) |
---|
75 | //-> // block 4 : ordering C |
---|
76 | |
---|
77 | kill R; |
---|
78 | ring R = 0, (x,y,z), M(1,1,1, 0,0,-1, 0,-1,0); |
---|
79 | |
---|
80 | kill R; |
---|
81 | ring R = 0, (x,y,z,w), (a(1,0,0,1),dp); |
---|
82 | |
---|
83 | kill R; |
---|
84 | //====================== Example 3.8 (new Session) ================ |
---|
85 | ring R = 0, (x,y), (c,dp); |
---|
86 | |
---|
87 | kill R; |
---|
88 | //====================== Remark 3.9 (new Session) ================= |
---|
89 | ring R = 0, (x,y,e(1..3)), wp(1,1,-1,-2,-4); |
---|
90 | ideal I = e(1..3); |
---|
91 | qring Q = groebner(I^2); |
---|
92 | |
---|
93 | |
---|
94 | kill Q,R; |
---|
95 | //====================== new Session ============================= |
---|
96 | ring R = 0, (x,y), dp; |
---|
97 | int i = 1; // object of ring independent type int |
---|
98 | poly f = x; // object of ring dependent type poly |
---|
99 | ring S = 0, (x,y), dp; // active ring is changed |
---|
100 | poly g = y; |
---|
101 | f; |
---|
102 | //-> ? `f` is undefined |
---|
103 | //-> ? error occurred in STDIN line 6: `f;` |
---|
104 | |
---|
105 | listvar(); |
---|
106 | //-> // S [0] *ring |
---|
107 | //-> // g [0] poly |
---|
108 | //-> // i [0] int 1 |
---|
109 | //-> // R [0] ring |
---|
110 | |
---|
111 | |
---|
112 | kill S,i,R; |
---|
113 | //====================== Example 3.10 (new Session) ============== |
---|
114 | ring R = 0, (x,y), dp; |
---|
115 | poly f = x2+y; |
---|
116 | ring S = 0, (a,b,c), dp; |
---|
117 | map F = R, a-b, c; // map F: R->S, sending x to a-b, y to c |
---|
118 | poly g = F(f); // apply the map |
---|
119 | g; |
---|
120 | //-> a2-2ab+b2+c |
---|
121 | ring S1 = 2, (a,b,c), lp; |
---|
122 | qring Q = std(a^2); |
---|
123 | map F1 = R, a-b, c; // target ring is qring, with another |
---|
124 | // characteristic and monomial order |
---|
125 | poly g=F1(f); |
---|
126 | g; // polynomial is not yet reduced |
---|
127 | //-> a2+b2+c |
---|
128 | reduce(g,std(0)); |
---|
129 | //-> b2+c |
---|
130 | |
---|
131 | |
---|
132 | ring R1 = 0, (a,b,c,x,y,z), dp; |
---|
133 | fetch(R,f); // fetch preserves order of variables |
---|
134 | //-> a2+b |
---|
135 | imap(R,f); // imap preserves names of variables |
---|
136 | //-> x2+y |
---|
137 | fetch(Q,g); |
---|
138 | //-> a2+b2+c |
---|
139 | |
---|
140 | |
---|
141 | kill R,S,S1,R1,Q; |
---|
142 | //====================== new Session ============================= |
---|
143 | ring R = 0, (x,y,z), dp; |
---|
144 | ideal I = x2-y, y4-z2; |
---|
145 | |
---|
146 | |
---|
147 | kill R; |
---|
148 | //====================== new Session ============================= |
---|
149 | ring R = 0, (x,y,z), dp; |
---|
150 | poly f = x2-y; |
---|
151 | poly g = y4-z2; |
---|
152 | ideal I = f,g; |
---|
153 | vector v = [f,0,0,g,0]; |
---|
154 | |
---|
155 | kill v; // ---- Alternatively: |
---|
156 | vector v = f*gen(1)+g*gen(4); |
---|
157 | |
---|
158 | kill R; |
---|
159 | ring R = 0, (x,y,z), (c,dp); |
---|
160 | vector v = [x,y]+[x2,1,z3,0]; |
---|
161 | v; |
---|
162 | //-> [x2+x,y+1,z3] |
---|
163 | |
---|
164 | ring S = 0, (x,y,z), (dp,c); |
---|
165 | vector v = fetch(R,v); |
---|
166 | v; |
---|
167 | //-> z3*gen(3)+x2*gen(1)+x*gen(1)+y*gen(2)+gen(2) |
---|
168 | |
---|
169 | print(v); |
---|
170 | //-> [x2+x,y+1,z3] |
---|
171 | |
---|
172 | |
---|
173 | kill S,R; |
---|
174 | //====================== new Session ============================= |
---|
175 | ring R = 0, (x,y), dp; |
---|
176 | module I = [x2,-y,y,-y,0], [0,0,y], [y,x]; |
---|
177 | print(I); |
---|
178 | //-> x2,0,y, |
---|
179 | //-> -y,0,x, |
---|
180 | //-> y, y,0, |
---|
181 | //-> -y,0,0 |
---|
182 | |
---|
183 | matrix MI[4][3] = x2, 0, y, |
---|
184 | -y, 0, x, |
---|
185 | y, y, 0, |
---|
186 | -y, 0, 0; |
---|
187 | |
---|
188 | kill MI; // ---- Alternatively: |
---|
189 | matrix MI = I; |
---|
190 | |
---|
191 | |
---|
192 | kill R; |
---|
193 | //====================== Section 3.4 (new Session) ================= |
---|
194 | ring R = 0, (w,x,y,z), dp; |
---|
195 | module I = [xz,0,-w,-1,0], [-yz2,y2, 0,-w,0], [y2z,0,-z2,0,-x], |
---|
196 | [y3,0,-yz,-x,0], [-z3,yz,0,0,-w], [-yz2,y2,0,-w,0], |
---|
197 | [0,0,-wy2+xz2,-y2,x2]; |
---|
198 | print(I); |
---|
199 | //-> xz,-yz2,y2z,y3, -z3,-yz2,0, |
---|
200 | //-> 0, y2, 0, 0, yz, y2, 0, |
---|
201 | //-> -w,0, -z2,-yz,0, 0, -wy2+xz2, |
---|
202 | //-> -1,-w, 0, -x, 0, -w, -y2, |
---|
203 | //-> 0, 0, -x, 0, -w, 0, x2 |
---|
204 | |
---|
205 | attrib(I,"isHomog"); // no attribute => empty output |
---|
206 | homog(I); |
---|
207 | //-> 1 |
---|
208 | attrib(I,"isHomog"); |
---|
209 | //-> 0,1,1,2,2 |
---|
210 | |
---|
211 | print(betti(I,0),"betti"); |
---|
212 | //-> 0 1 |
---|
213 | //-> ------------------ |
---|
214 | //-> 0: 1 - |
---|
215 | //-> 1: 2 1 |
---|
216 | //-> 2: 2 5 |
---|
217 | //-> 3: - 1 |
---|
218 | //-> ------------------ |
---|
219 | //-> total: 5 7 |
---|
220 | |
---|
221 | intvec DV = 2,3,3,4,4; |
---|
222 | attrib(I,"isHomog",DV); |
---|
223 | |
---|
224 | attrib(I,"isHomog"); |
---|
225 | //-> 2,3,3,4,4 |
---|
226 | print(betti(I,0),"betti"); |
---|
227 | //-> 0 1 |
---|
228 | //-> ------------------ |
---|
229 | //-> 2: 1 - |
---|
230 | //-> 3: 2 1 |
---|
231 | //-> 4: 2 5 |
---|
232 | //-> 5: - 1 |
---|
233 | //-> ------------------ |
---|
234 | //-> total: 5 7 |
---|
235 | |
---|
236 | intmat BI = betti(I,0); |
---|
237 | int d = attrib(BI,"rowShift"); |
---|
238 | d; |
---|
239 | //-> 2 |
---|
240 | |
---|
241 | |
---|
242 | kill R,DV,BI,d; |
---|
243 | //====================== Section 3.5 (new Session) ================= |
---|
244 | ring R = 0, (x,y,z), lp; |
---|
245 | ideal I = 2y+z,3x-y; |
---|
246 | std(I); |
---|
247 | //-> _[1]=2y+z |
---|
248 | //-> _[2]=3x-y |
---|
249 | option(redSB); |
---|
250 | ideal G = std(I); |
---|
251 | G; |
---|
252 | //-> G[1]=2y+z |
---|
253 | //-> G[2]=6x+z |
---|
254 | G = simplify(G,1); |
---|
255 | G; |
---|
256 | //-> G[1]=y+1/2z |
---|
257 | //-> G[2]=x+1/6z |
---|
258 | |
---|
259 | |
---|
260 | kill R; |
---|
261 | //====================== Example 3.13 (new Session) =============== |
---|
262 | ring R = 0, (x,y,z), dp; |
---|
263 | ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4; |
---|
264 | option(redSB); // force computation of reduced GBs |
---|
265 | int aa = timer; |
---|
266 | ideal SI = std(I); |
---|
267 | size(SI); dim(SI); |
---|
268 | |
---|
269 | ring S = 0, (x,y,z), lp; |
---|
270 | aa = timer; |
---|
271 | ideal J = fglm(R,SI); |
---|
272 | |
---|
273 | size(J); // number of generators |
---|
274 | //-> 8 |
---|
275 | size(string(J)) div 68; // number of lines with 68 characters |
---|
276 | // needed to display J: |
---|
277 | //-> 631 |
---|
278 | deg(J[1..size(J)]); // degrees of the generators |
---|
279 | //-> 35 34 34 34 34 34 34 34 |
---|
280 | leadmonom(J[1..size(J)]); // generators for L(I) w.r.t. lp |
---|
281 | //-> z35 yz6 y2z4 y3z2 y5 xz2 xy x3 |
---|
282 | leadcoef(J[8]); // leading coefficient of 8th generator |
---|
283 | //-> 6440093631623773985969509841859276602512807348986590906348582267651806942677443883093109641441627364249598438582596862938314965556548533870597328962260825040847335705757819599104 |
---|
284 | |
---|
285 | ideal I = fetch(R,I); |
---|
286 | // I = std(I); |
---|
287 | //-> error: no more memory |
---|
288 | |
---|
289 | |
---|
290 | kill S,aa,R; |
---|
291 | //====================== Example 3.14 (new Session) =============== |
---|
292 | LIB "grwalk.lib"; |
---|
293 | ring S = 0, (x,y,z), lp; |
---|
294 | ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4; |
---|
295 | option(redSB); // force computation of reduced GBs |
---|
296 | int aa = timer; |
---|
297 | ideal J = fwalk(I); |
---|
298 | size(J), dim(J); |
---|
299 | |
---|
300 | kill S,aa; |
---|
301 | //====================== Example 3.16 (new Session) =============== |
---|
302 | ring S = 0, (x,y,z), lp; |
---|
303 | ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4; |
---|
304 | option(redSB); |
---|
305 | ring Rhom = 0, (x,y,z,t), dp; |
---|
306 | ideal I = imap(S,I); |
---|
307 | ideal Ih = homog(I,t); // generators of I are homogenized |
---|
308 | int aa = timer; |
---|
309 | Ih = std(Ih); |
---|
310 | intvec H = hilb(Ih,1); |
---|
311 | ring Shom = 0, (x,y,z,t), lp; |
---|
312 | ideal Ih = imap(Rhom,Ih); |
---|
313 | Ih = std(Ih,H); |
---|
314 | Ih = subst(Ih,t,1); |
---|
315 | setring S; |
---|
316 | ideal J = imap(Shom,Ih); |
---|
317 | size(J); |
---|
318 | //-> 102 |
---|
319 | |
---|
320 | J = interred(J); |
---|
321 | //-> 3 |
---|
322 | size(J); |
---|
323 | //-> 8 |
---|
324 | dim(J); |
---|
325 | |
---|
326 | |
---|
327 | kill S,Rhom,aa,H,Shom; |
---|
328 | //====================== Remark 3.18 (new Session) =============== |
---|
329 | ring R = (32003,a,b,c,d), (t,u,v,w,x,y,z), dp; |
---|
330 | ideal I = -cw+bx, ct+2au-2bu-2cv-(ad+bd), |
---|
331 | -2tx+4wy+4xz+ct-2aw-2dw-2by-2cz+(ab+bd), |
---|
332 | t*(z-x)+(a-b+d)*(y-w)+c*(x-z), -tw+a*(t-x)+dx, |
---|
333 | -2tv+ct-2du+(ad+bd), ct2-(b2-ab+c2)*t-(acd-cd2); |
---|
334 | int aa = timer; |
---|
335 | ideal SI = slimgb(I); |
---|
336 | size(SI), dim(SI); |
---|
337 | |
---|
338 | SI = std(I); |
---|
339 | size(SI), dim(SI); |
---|
340 | |
---|
341 | |
---|
342 | |
---|
343 | kill R,aa; |
---|
344 | //====================== Example 3.20 (new Session) =============== |
---|
345 | ring S = 0, (x,y,z), lp; |
---|
346 | ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4; |
---|
347 | option(redSB); |
---|
348 | option(prot); |
---|
349 | int aa = timer; |
---|
350 | ideal J = groebner(I); |
---|
351 | //-> std in (0),(x,y,z,@t),(dp,C) |
---|
352 | //-> [255:1]4(2)sss5s6s7(3)s(4)s(5)s(6)s8(8)s(9)-ss(11)s(12)---9-s(9)-s( |
---|
353 | //-> 10)--s--10-s(8)s(9)-s---11------ |
---|
354 | //-> product criterion:9 chain criterion:124 |
---|
355 | //-> std with hilb in (0),(x,y,z,@t),(lp(3),C) |
---|
356 | //-> [255:1]4(2)sss5ss6s(3)s(5)s7(6)s(7)s(9)s(11)s(13)-s(14)s8(16)s(17)s |
---|
357 | //-> (19)s(21)s(23)s(25)s(27)s(28)-s(29)--shhhhh9(24)s(26)s(28)s(30)s(32 |
---|
358 | //-> )s(33)s(35)s(37)s(39)s(41)shhhhhhhhhhhhhhh10(28)ss(29)s(30)s(32)s(3 |
---|
359 | //-> 4)s(35)s(37)s(39)s(41)s(43)shhhhhhhhhhhhhhhhhh11(26)s(28)s(30)s(32) |
---|
360 | //-> s(34)s(35)shhhhhhhhhhhhhhhhhhhhh12(16)s(18)s(20)s(22)s(24)shhhhhhhh |
---|
361 | //-> hhhh13(14)s(15)s(17)s(19)s(21)shhhhhhhhhh14(13)s(15)s(17)s(19)shhhh |
---|
362 | //-> hhhhhh15(10)s(12)s(14)shhhhhhhh16(8)s(10)s(12)shhhhhh17(8)s(10)s(12 |
---|
363 | //-> )shhhhhh18(8)s(9)s(11)shhhhhh19(7)s(9)shhhhhh20(5)s(7)shhhh21(5)s(7 |
---|
364 | //-> )shhhh22(5)s(7)shhhh23(5)s(7)shhhh24(5)s(6)shhhh25(4)shhhh26(2)shh2 |
---|
365 | //-> 7shh28shh29shh30shh31shh32shh33shh34shh35shh36shh37shh38shhhh |
---|
366 | //-> product criterion:27 chain criterion:4846 |
---|
367 | //-> hilbert series criterion:175 |
---|
368 | //-> dehomogenization |
---|
369 | //-> imap to original ring |
---|
370 | //-> simplification |
---|
371 | //-> interreduction |
---|
372 | size(J); |
---|
373 | //-> 8 |
---|
374 | |
---|
375 | |
---|
376 | kill S,aa; |
---|
377 | option(noprot); |
---|
378 | //====================== Example 3.21 (new Session) =============== |
---|
379 | ring R = 0, (x,y), dp; |
---|
380 | ideal I = 4x2y2+3x, y3+2xy, 7x3+6y; |
---|
381 | std(I); |
---|
382 | //-> _[1]=y |
---|
383 | //-> _[2]=x |
---|
384 | |
---|
385 | ideal J = x; |
---|
386 | matrix A = lift(I,J); |
---|
387 | A; |
---|
388 | //-> A[1,1]=-3670016/18809541x2y+9604/6269847xy2-134217728/131666787y3-128/63xy-100352/6269847y2-458752/6269847y+1/3 |
---|
389 | //-> A[2,1]=536870912/131666787x2y2+401408/6269847x2y+1835008/6269847x2-4194304/6269847xy+10976/2089949y2+64/21x+50176/2089949y+229376/2089949 |
---|
390 | //-> A[3,1]=2097152/18809541xy3-5488/6269847y4-25088/6269847y3-114688/6269847y2 |
---|
391 | matrix(I)*A; |
---|
392 | //-> _[1,1]=x |
---|
393 | |
---|
394 | |
---|
395 | kill R; |
---|
396 | //====================== Example 3.22 (new Session) =============== |
---|
397 | ring R = 0, (x,y), dp; |
---|
398 | ideal I = x7+x5y2, y4-xy7; |
---|
399 | poly f1, f2 = x6y7+x3y5, x6y7+x7y2; |
---|
400 | ideal GI = groebner(I); |
---|
401 | reduce(f1,GI,1); // see Example 1.39 for reduce |
---|
402 | //-> y5-y4 |
---|
403 | reduce(f2,GI,1); |
---|
404 | //-> 0 |
---|
405 | lift(I,f1); |
---|
406 | //-> ? 2nd module lies not in the first |
---|
407 | //-> ? error occurred in STDIN line 8: `lift(I,f1); ` |
---|
408 | matrix C = lift(I,f2); |
---|
409 | C; |
---|
410 | //-> C[1,1]=x4y22-x2y24-x3y19+xy21+y2 |
---|
411 | //-> C[2,1]=x10y15-x6y19-x5 |
---|
412 | f2 - C[1,1]*I[1] - C[2,1]*I[2]; // check (result must be 0) |
---|
413 | //-> 0 |
---|
414 | |
---|
415 | ideal J1 = f1, f2; |
---|
416 | ideal J2 = f2, x5y9+x6y4; |
---|
417 | reduce(J1,GI,1); // normal form for the generators of J1 |
---|
418 | //-> _[1]=y5-y4 |
---|
419 | //-> _[2]=0 |
---|
420 | size(reduce(J2,GI,1)); |
---|
421 | //-> 0 |
---|
422 | |
---|
423 | |
---|
424 | kill R; |
---|
425 | //====================== Example 3.23 (new Session) =============== |
---|
426 | ring R = 0, (x,y), dp; |
---|
427 | ideal I = maxideal(3); // the ideal <x,y>^3 |
---|
428 | poly f1, f2 = x, 1-x; |
---|
429 | ring S = 0, (x,y,t), dp; |
---|
430 | ideal I = imap(R,I); |
---|
431 | poly f1 = imap(R,f1); |
---|
432 | ideal Jf1 = I, t*f1-1; |
---|
433 | Jf1 = std(Jf1); |
---|
434 | reduce(1,Jf1,1); // result is 0 iff f1 is in radical(I) |
---|
435 | //-> 0 |
---|
436 | poly f2 = imap(R,f2); |
---|
437 | ideal Jf2 = I, t*f2-1; |
---|
438 | Jf2 = std(Jf2); |
---|
439 | reduce(1,Jf2,1); |
---|
440 | //-> 1 |
---|
441 | |
---|
442 | setring R; // ---- Alternatively --------- |
---|
443 | if (not(defined(rad_con))){ LIB "poly.lib"; } |
---|
444 | rad_con(f1,I); // result is 1 iff f is in radical(I) |
---|
445 | //-> 1 |
---|
446 | rad_con(f2,I); |
---|
447 | //-> 0 |
---|
448 | |
---|
449 | |
---|
450 | kill R,S; |
---|
451 | //====================== Example 3.24 (new Session) =============== |
---|
452 | ring R = 0, (a,b,c,d,e,f,g,t,u,v,w,y,z), dp; |
---|
453 | ideal I = z2+e2-1, g2+w2+a2-1, t2+u2+b2-1, f2+v2+c2-1, y2+d2-1, |
---|
454 | zw+ea, gt+wu+ab, tf+uv+bc, fy+cd, a+b+c+d+e, f+g+t+y+1, |
---|
455 | u+v+w+z-1; |
---|
456 | ring Rhom = 0, (a,b,c,d,e,f,g,t,u,v,w,y,z,h), dp; |
---|
457 | ideal I = imap(R,I); |
---|
458 | ideal J = homog(I,h); // homogenize the given generators |
---|
459 | int aa = timer; |
---|
460 | ideal L = std(J); |
---|
461 | intvec H = hilb(L,1); // assign Hilbert series |
---|
462 | ideal K = eliminate(J,abcdefgtuvw,H); |
---|
463 | K = subst(K,h,1); // dehomogenize |
---|
464 | size(K); |
---|
465 | //-> 1 |
---|
466 | K[1]; // the equation |
---|
467 | //-> 790272y16z16-3612672y16z15+3612672y15z16-6530048y16z14-6006784y15z15 |
---|
468 | //-> -6530048y14z16+41607168y16z13-56159232y15z14+[...] |
---|
469 | |
---|
470 | |
---|
471 | kill R,Rhom,aa,H; |
---|
472 | //====================== Example 3.27 (new Session) =============== |
---|
473 | ring R = 0, x(1..3), dp; |
---|
474 | poly f1 = x(1)^6*x(3)^2-x(2)^6*x(3)^2; |
---|
475 | poly f2,f3,f4 = x(1)^3-x(2)^3, x(1)^3+x(2)^3, x(3)^3; |
---|
476 | ring S = 0, y(1..4), dp; |
---|
477 | setring R; |
---|
478 | ideal zero; // the zero ideal |
---|
479 | map phi = S,f1,f2,f3,f4; |
---|
480 | setring S; |
---|
481 | preimage(R,phi,zero); // the kernel of phi |
---|
482 | //-> _[1]=y(2)^3*y(3)^3*y(4)^2-y(1)^3 |
---|
483 | |
---|
484 | setring R; //--- Alternatively: |
---|
485 | kill S; |
---|
486 | if (not(defined(algDependent))){ LIB "algebra.lib"; } |
---|
487 | list L = algDependent(ideal(f1,f2,f3,f4)); |
---|
488 | L[1]; // first entry of L is 1 iff the polynomials are |
---|
489 | // algebraically dependent |
---|
490 | //-> 1 |
---|
491 | def S = L[2]; // second entry of L is a ring which contains |
---|
492 | // an ideal ker defining the algebraic relation |
---|
493 | setring S; |
---|
494 | ker; |
---|
495 | //-> ker[1]=y(2)^3*y(3)^3*y(4)^2-y(1)^3 |
---|
496 | |
---|
497 | |
---|
498 | kill R,S,L; |
---|
499 | //====================== Example 3.28 (new Session) =============== |
---|
500 | ring R = 0, x(1..3), dp; |
---|
501 | poly f = x(1)^6*x(2)^6-x(1)^6*x(3)^6; |
---|
502 | poly f1 = x(1)^3*x(2)^3-x(1)^3*x(3)^3; |
---|
503 | poly f2 = x(1)^3*x(2)^3+x(1)^3*x(3)^3; |
---|
504 | ring S = 0, (x(1..3),y(1..2)), (dp(3),dp(2)); |
---|
505 | ideal J = imap(R,f1)-y(1), imap(R,f2)-y(2); |
---|
506 | ideal G = groebner(J); |
---|
507 | reduce(imap(R,f),G); |
---|
508 | //-> y(1)*y(2) |
---|
509 | |
---|
510 | setring R; kill S; //--- Alternatively: |
---|
511 | if (not(defined(algebra_containment))){ LIB "algebra.lib"; } |
---|
512 | algebra_containment(f,ideal(f1,f2)); |
---|
513 | //-> // y(1)*y(2) |
---|
514 | //-> 1 |
---|
515 | def L = algebra_containment(f,ideal(f1,f2),1); |
---|
516 | def S = L[2]; |
---|
517 | setring S; |
---|
518 | check; // polynomial defining the algebraic relation |
---|
519 | //-> y(1)*y(2) |
---|
520 | |
---|
521 | |
---|
522 | kill R,S,L; |
---|
523 | //====================== Example 3.29 (new Session) =============== |
---|
524 | ring C = 0, (a,b,c,x,y,z), (dp(3),dp); |
---|
525 | ideal J = c-b3, 2a+b6-x, 7b-a2-y, c2-z; |
---|
526 | option(redSB); |
---|
527 | simplify(groebner(J),1); // the reduced Groebner basis for J |
---|
528 | //-> _[1]=x12-12x11z+66x10z2-220x9z3+495x8z4-792x7z5+[...] |
---|
529 | //-> _[2]=c-1/21952x6+3/10976x5z-15/21952x4z2+[...] |
---|
530 | //-> _[3]=b-1/28x2+1/14xz-1/28z2-1/7y |
---|
531 | //-> _[4]=a-1/2x+1/2z |
---|
532 | |
---|
533 | if (not(defined(is_surjective))){ LIB "algebra.lib"; } |
---|
534 | ring B = 0, (x,y,z), dp; |
---|
535 | ring A = 0, (a,b,c), dp; |
---|
536 | qring Q = groebner(c-b3); // quotient ring |
---|
537 | map psi = B, 2a+b6, 7b-a2, c2; |
---|
538 | is_surjective(psi); |
---|
539 | //-> 1 |
---|
540 | |
---|
541 | |
---|
542 | kill A,B,C,Q; |
---|
543 | //====================== Example 3.30 (new Session) =============== |
---|
544 | ring R = 0, (w,x,y,z), dp; |
---|
545 | poly f1, f2, f3 = y2-xz, xy-wz, x2z-wyz; |
---|
546 | ideal I = f1, f2, f3; |
---|
547 | module phi2 = syz(I); |
---|
548 | print(phi2); |
---|
549 | //-> x, wz, |
---|
550 | //-> -y,-xz, |
---|
551 | //-> 1, y |
---|
552 | size(syz(phi2)); // we check that there are no higher syzygies |
---|
553 | //-> 0 |
---|
554 | |
---|
555 | resolution FI = nres(I,0); |
---|
556 | typeof(FI[1]); // 'typeof' displays type of given object |
---|
557 | //-> ideal |
---|
558 | print(FI[1]); |
---|
559 | //-> y2-xz, |
---|
560 | //-> xy-wz |
---|
561 | //-> x2z-wyz |
---|
562 | typeof(FI[2]); |
---|
563 | //-> module |
---|
564 | print(FI[2]); |
---|
565 | //-> x, wz, |
---|
566 | //-> -y,-xz, |
---|
567 | //-> 1, y |
---|
568 | |
---|
569 | print(betti(FI),"betti"); |
---|
570 | //-> 0 1 2 |
---|
571 | //-> ------------------------ |
---|
572 | //-> 0: 1 - - |
---|
573 | //-> 1: - 2 - |
---|
574 | //-> 2: - - 1 |
---|
575 | //-> ------------------------ |
---|
576 | //-> total: 1 2 1 |
---|
577 | |
---|
578 | print(betti(FI,0),"betti"); |
---|
579 | //-> 0 1 2 |
---|
580 | //-> ------------------------ |
---|
581 | //-> 0: 1 - - |
---|
582 | //-> 1: - 2 1 |
---|
583 | //-> 2: - 1 1 |
---|
584 | //-> ------------------------ |
---|
585 | //-> total: 1 3 2 |
---|
586 | |
---|
587 | |
---|
588 | kill R; |
---|
589 | //====================== Example 3.35 (new Session) =============== |
---|
590 | ring R = 0, (w,x,y,z), dp; |
---|
591 | module I = [xz,0,-w,-1,0], [-yz2,y2, 0,-w,0], [y2z,0,-z2,0,-x], |
---|
592 | [y3,0,-yz,-x,0], [-z3,yz,0,0,-w], [-yz2,y2,0,-w,0], |
---|
593 | [0,0,-wy2+xz2,-y2,x2]; |
---|
594 | print(I); |
---|
595 | //-> xz,-yz2,y2z,y3, -z3,-yz2,0, |
---|
596 | //-> 0, y2, 0, 0, yz, y2, 0, |
---|
597 | //-> -w,0, -z2,-yz,0, 0, -wy2+xz2, |
---|
598 | //-> -1,-w, 0, -x, 0, -w, -y2, |
---|
599 | //-> 0, 0, -x, 0, -w, 0, x2 |
---|
600 | homog(I); |
---|
601 | //-> 1 |
---|
602 | attrib(I,"isHomog"); |
---|
603 | //-> 0,1,1,2,2 |
---|
604 | resolution FInres = nres(I,0); |
---|
605 | print(betti(FInres,0),"betti"); |
---|
606 | //-> 0 1 2 |
---|
607 | //-> ------------------------ |
---|
608 | //-> 0: 1 - - |
---|
609 | //-> 1: 2 1 1 |
---|
610 | //-> 2: 2 5 1 |
---|
611 | //-> 3: - 1 1 |
---|
612 | //-> ------------------------ |
---|
613 | //-> total: 5 7 3 |
---|
614 | print(FInres[1]); // the given generators |
---|
615 | //-> xz,-yz2,y2z,y3, -z3,-yz2,0, |
---|
616 | //-> 0, y2, 0, 0, yz, y2, 0, |
---|
617 | //-> -w,0, -z2,-yz,0, 0, -wy2+xz2, |
---|
618 | //-> -1,-w, 0, -x, 0, -w, -y2, |
---|
619 | //-> 0, 0, -x, 0, -w, 0, x2 |
---|
620 | print(FInres[2]); // display syzygies on the given generators |
---|
621 | //-> 0, y2,0, |
---|
622 | //-> -1,0, xz, |
---|
623 | //-> 0, -x,wy, |
---|
624 | //-> 0, 0, -wz, |
---|
625 | //-> 0, 0, -xy, |
---|
626 | //-> 1, 0, 0, |
---|
627 | //-> 0, -1,0 |
---|
628 | size((FInres[3])); |
---|
629 | //-> 0 |
---|
630 | resolution FImres = mres(I,0); |
---|
631 | print(betti(FImres,0),"betti"); |
---|
632 | //-> 0 1 2 |
---|
633 | //-> ------------------------ |
---|
634 | //-> 0: 1 - - |
---|
635 | //-> 1: 2 1 - |
---|
636 | //-> 2: 2 4 - |
---|
637 | //-> 3: - - 1 |
---|
638 | //-> ------------------------ |
---|
639 | //-> total: 5 5 1 |
---|
640 | print(FImres[1]); // the new generators |
---|
641 | //-> xz,z3, yz2,y2z,y3, |
---|
642 | //-> 0, -yz,-y2,0, 0, |
---|
643 | //-> -w,0, 0, -z2,-yz, |
---|
644 | //-> -1,0, w, 0, -x, |
---|
645 | //-> 0, w, 0, -x, 0 |
---|
646 | print(FImres[2]); // display syzygies on the new generators |
---|
647 | //-> 0, |
---|
648 | //-> xy, |
---|
649 | //-> -xz, |
---|
650 | //-> wy, |
---|
651 | //-> -wz |
---|
652 | module PI = prune(I); |
---|
653 | print(betti(PI,0),"betti"); |
---|
654 | //-> 0 1 |
---|
655 | //-> ------------------ |
---|
656 | //-> 0: 1 - |
---|
657 | //-> 1: 2 - |
---|
658 | //-> 2: 1 5 |
---|
659 | //-> 3: - 1 |
---|
660 | //-> ------------------ |
---|
661 | //-> total: 4 6 |
---|
662 | print(PI); |
---|
663 | //-> wxz+yz2,-y2z,-y3+x2z,z3, wxz+yz2,xy2z, |
---|
664 | //-> -y2, 0, 0, -yz,-y2, 0, |
---|
665 | //-> -w2, z2, -wx+yz, 0, -w2, -xz2, |
---|
666 | //-> 0, x, 0, w, 0, -x2 |
---|
667 | resolution FPImres = mres(PI,0); |
---|
668 | print(betti(FPImres,0),"betti"); |
---|
669 | //-> 0 1 2 |
---|
670 | //-> ------------------------ |
---|
671 | //-> 0: 1 - - |
---|
672 | //-> 1: 2 - - |
---|
673 | //-> 2: 1 4 - |
---|
674 | //-> 3: - - 1 |
---|
675 | //-> ------------------------ |
---|
676 | //-> total: 4 4 1 |
---|
677 | print(FPImres[1]); |
---|
678 | //-> z3, y2z,wxz+yz2,y3-x2z, |
---|
679 | //-> -yz,0, -y2, 0, |
---|
680 | //-> 0, -z2,-w2, wx-yz, |
---|
681 | //-> w, -x, 0, 0 |
---|
682 | print(FPImres[2]); |
---|
683 | //-> xy, |
---|
684 | //-> wy, |
---|
685 | //-> -xz, |
---|
686 | //-> -wz |
---|
687 | resolution FPIsres = sres(PI,0); |
---|
688 | //-> ? ideal not a standardbasis |
---|
689 | //-> ? error occurred in STDIN line 27: |
---|
690 | //-> `resolution FPIsres = sres(PI,0);` |
---|
691 | resolution FPIsres = sres(groebner(PI),0); |
---|
692 | print(betti(FPIsres,0),"betti"); |
---|
693 | //-> 0 1 2 3 4 |
---|
694 | //-> ------------------------------------ |
---|
695 | //-> 0: 1 - - - - |
---|
696 | //-> 1: 2 - - - - |
---|
697 | //-> 2: 1 4 1 - - |
---|
698 | //-> 3: - 1 5 1 - |
---|
699 | //-> 4: - 4 2 3 1 |
---|
700 | //-> 5: - 1 3 1 - |
---|
701 | //-> ------------------------------------ |
---|
702 | //-> total: 4 10 11 5 1 |
---|
703 | |
---|
704 | resolution FInresmin = minres(FInres); |
---|
705 | print(betti(FInresmin,0),"betti"); |
---|
706 | //-> 0 1 2 |
---|
707 | //-> ------------------------ |
---|
708 | //-> 0: 1 - - |
---|
709 | //-> 1: 2 1 - |
---|
710 | //-> 2: 2 4 - |
---|
711 | //-> 3: - - 1 |
---|
712 | //-> ------------------------ |
---|
713 | //-> total: 5 5 1 |
---|
714 | resolution FPIsresmin = minres(FPIsres); |
---|
715 | print(betti(FPIsresmin,0),"betti"); |
---|
716 | //-> 0 1 2 |
---|
717 | //-> ------------------------ |
---|
718 | //-> 0: 1 - - |
---|
719 | //-> 1: 2 - - |
---|
720 | //-> 2: 1 4 - |
---|
721 | //-> 3: - - 1 |
---|
722 | //-> ------------------------ |
---|
723 | //-> total: 4 4 1 |
---|
724 | |
---|
725 | |
---|
726 | kill R; |
---|
727 | listvar(); |
---|
728 | //====================== Example 3.40(1) (new Session) =============== |
---|
729 | ring D3 = 0, (x(1..3),d(1..3)), dp; |
---|
730 | int i,j; |
---|
731 | matrix C[6][6]; |
---|
732 | for (i=1; i<=6; i++) { for (j=i+1; j<=6; j++) { C[i,j] = 1; } } |
---|
733 | matrix H[6][6]; |
---|
734 | H[1,4] = 1; H[2,5] = 1; H[3,6] = 1; |
---|
735 | def @S=nc_algebra(C,H); setring @S; |
---|
736 | |
---|
737 | kill D3; // ---- Alternatively: |
---|
738 | if (not(defined(Exterior))){ LIB "nctools.lib"; } |
---|
739 | ring D3 = 0, (x(1..3),d(1..3)), dp; |
---|
740 | def @S3=Weyl(); setring @S3; |
---|
741 | |
---|
742 | basering; |
---|
743 | //-> // characteristic : 0 |
---|
744 | //-> // number of vars : 6 |
---|
745 | //-> // block 1 : ordering dp |
---|
746 | //-> // : names x(1) x(2) x(3) d(1) d(2) d(3) |
---|
747 | //-> // block 2 : ordering C |
---|
748 | //-> // noncommutative relations: |
---|
749 | //-> // d(1)x(1)=x(1)*d(1)+1 |
---|
750 | //-> // d(2)x(2)=x(2)*d(2)+1 |
---|
751 | //-> // d(3)x(3)=x(3)*d(3)+1 |
---|
752 | |
---|
753 | //================= Example 3.44 (continued Session) =============== |
---|
754 | ideal I = x(1)^2*d(2)^2+x(2)^2*d(3)^2, x(1)*d(2)+x(3); |
---|
755 | option(redSB); |
---|
756 | ideal LSI = std(I); |
---|
757 | LSI; |
---|
758 | //-> LSI[1]=x(1)*d(2)+x(3) |
---|
759 | //-> LSI[2]=x(3)^2 |
---|
760 | //-> LSI[3]=x(2)*x(3)-x(1) |
---|
761 | //-> LSI[4]=x(1)*x(3) |
---|
762 | //-> LSI[5]=x(2)^2 |
---|
763 | //-> LSI[6]=x(1)*x(2) |
---|
764 | //-> LSI[7]=x(1)^2 |
---|
765 | def D3_opp = opposite(@S3); |
---|
766 | setring D3_opp; // active ring is the opposite algebra of @S3 |
---|
767 | basering; |
---|
768 | //-> // characteristic : 0 |
---|
769 | //-> // number of vars : 6 |
---|
770 | //-> // block 1 : ordering a |
---|
771 | //-> // : names D(3) D(2) D(1) X(3) X(2) X(1) |
---|
772 | //-> // : weights 1 1 1 1 1 1 |
---|
773 | //-> // block 2 : ordering ls |
---|
774 | //-> // : names D(3) D(2) D(1) X(3) X(2) X(1) |
---|
775 | //-> // block 3 : ordering C |
---|
776 | //-> // noncommutative relations: |
---|
777 | //-> // X(3)D(3)=D(3)*X(3)+1 |
---|
778 | //-> // X(2)D(2)=D(2)*X(2)+1 |
---|
779 | //-> // X(1)D(1)=D(1)*X(1)+1 |
---|
780 | ideal I = oppose(@S3,I); // map I to opposite algebra |
---|
781 | ideal RSI_opp = std(I); |
---|
782 | setring @S3; |
---|
783 | ideal RSI = oppose(D3_opp,RSI_opp); |
---|
784 | RSI; |
---|
785 | //-> RSI[1]=x(1)*d(2)+x(3) |
---|
786 | //-> RSI[2]=x(3)^2 |
---|
787 | //-> RSI[3]=x(2)*x(3)+x(1) |
---|
788 | //-> RSI[4]=x(1)*x(3) |
---|
789 | //-> RSI[5]=x(2)^2 |
---|
790 | //-> RSI[6]=x(1)*x(2) |
---|
791 | //-> RSI[7]=x(1)^2 |
---|
792 | size(reduce(RSI,LSI)); |
---|
793 | //-> 1 |
---|
794 | ideal SI = twostd(I); |
---|
795 | SI; |
---|
796 | //-> SI[1]=1 |
---|
797 | |
---|
798 | |
---|
799 | kill i,j,D3,D3_opp,@S3; |
---|
800 | //====================== Example 3.40(2) (new Session) =============== |
---|
801 | ring R = 0, x(1..3), dp; |
---|
802 | int i,j; |
---|
803 | matrix C[3][3]; |
---|
804 | for (i=1; i<=3; i++) { for (j=i+1; j<=3; j++) { C[i,j] = -1; } } |
---|
805 | matrix H[3][3]; |
---|
806 | def @SS=nc_algebra(C,H); setring @SS; |
---|
807 | ideal Q = x(1)^2, x(2)^2, x(3)^2; |
---|
808 | Q = twostd(Q); // compute two-sided Groebner basis |
---|
809 | qring E3 = Q; |
---|
810 | |
---|
811 | kill E3,R; // ---- Alternatively: |
---|
812 | if (not(defined(Exterior))){ LIB "nctools.lib"; } |
---|
813 | ring R = 0, x(1..3), dp; |
---|
814 | def E3 = Exterior(); |
---|
815 | setring E3; |
---|
816 | basering; |
---|
817 | //-> // characteristic : 0 |
---|
818 | //-> // number of vars : 3 |
---|
819 | //-> // block 1 : ordering dp |
---|
820 | //-> // : names x(1) x(2) x(3) |
---|
821 | //-> // block 2 : ordering C |
---|
822 | //-> // noncommutative relations: |
---|
823 | //-> // x(2)x(1)=-x(1)*x(2) |
---|
824 | //-> // x(3)x(1)=-x(1)*x(3) |
---|
825 | //-> // x(3)x(2)=-x(2)*x(3) |
---|
826 | //-> // quotient ring from ideal |
---|
827 | //-> _[1]=x(3)^2 |
---|
828 | //-> _[2]=x(2)^2 |
---|
829 | //-> _[3]=x(1)^2 |
---|
830 | |
---|
831 | //================= Example 3.46 (continued Session) =============== |
---|
832 | ideal I = maxideal(1); |
---|
833 | def rI = mres(I,0); |
---|
834 | //-> // ** full resolution in a qring may be infinite, |
---|
835 | //-> // setting max length to 5 |
---|
836 | print(betti(rI),"betti"); |
---|
837 | //-> 0 1 2 3 4 5 |
---|
838 | //-> ------------------------------------------ |
---|
839 | //-> 0: 1 3 6 10 15 21 |
---|
840 | //-> ------------------------------------------ |
---|
841 | //-> total: 1 3 6 10 15 21 |
---|
842 | print(rI[1],""); |
---|
843 | //-> x(3),x(2),x(1) |
---|
844 | print(rI[2]); |
---|
845 | //-> x(3),x(2),0, x(1),0, 0, |
---|
846 | //-> 0, x(3),x(2),0, x(1),0, |
---|
847 | //-> 0, 0, 0, x(3),x(2),x(1) |
---|
848 | |
---|
849 | |
---|
850 | kill i,j,E3,R; |
---|
851 | //====================== Remark 3.52 (new Session) =============== |
---|
852 | ring R = (0,a), (x(1..3),y(1..2),z(1..2)), (dp(3),wp(2,5),lp); |
---|
853 | minpoly = a^2+1; |
---|
854 | qring Q = std(y(1)^2-x(1)); |
---|
855 | list L = ringlist(Q); |
---|
856 | size(L); |
---|
857 | //-> 4 |
---|
858 | L[1]; |
---|
859 | //-> [1]: |
---|
860 | //-> 0 |
---|
861 | //-> [2]: |
---|
862 | //-> [1]: |
---|
863 | //-> a |
---|
864 | //-> [3]: |
---|
865 | //-> [1]: |
---|
866 | //-> [1]: |
---|
867 | //-> lp |
---|
868 | //-> [2]: |
---|
869 | //-> 1 |
---|
870 | //-> [4]: |
---|
871 | //-> _[1]=(a^2+1) |
---|
872 | L[2][7]; |
---|
873 | //-> z(2) |
---|
874 | L[3]; |
---|
875 | //-> [1]: |
---|
876 | //-> [1]: |
---|
877 | //-> dp |
---|
878 | //-> [2]: |
---|
879 | //-> 1,1,1 |
---|
880 | //-> [2]: |
---|
881 | //-> [1]: |
---|
882 | //-> wp |
---|
883 | //-> [2]: |
---|
884 | //-> 2,5 |
---|
885 | //-> [3]: |
---|
886 | //-> [1]: |
---|
887 | //-> lp |
---|
888 | //-> [2]: |
---|
889 | //-> 1,1 |
---|
890 | //-> [4]: |
---|
891 | //-> [1]: |
---|
892 | //-> C |
---|
893 | //-> [2]: |
---|
894 | //-> 0 |
---|
895 | L[4]; |
---|
896 | //-> _[1]=x(1)-y(1)^2 |
---|
897 | L[1][2][1] = "b"; // new name for the parameter |
---|
898 | L[2][8] = "w"; // append a new variable with name w |
---|
899 | L[3][3][2] = intvec(1,1,1); // raise the size of the third block |
---|
900 | // of the monomial order |
---|
901 | def S = ring(L); |
---|
902 | setring S; |
---|
903 | basering; |
---|
904 | //-> // characteristic : 0 |
---|
905 | //-> // 1 parameter : b |
---|
906 | //-> // minpoly : (b^2+1) |
---|
907 | //-> // number of vars : 8 |
---|
908 | //-> // block 1 : ordering dp |
---|
909 | //-> // : names x(1) x(2) x(3) |
---|
910 | //-> // block 2 : ordering wp |
---|
911 | //-> // : names y(1) y(2) |
---|
912 | //-> // : weights 2 5 |
---|
913 | //-> // block 3 : ordering lp |
---|
914 | //-> // : names z(1) z(2) w |
---|
915 | //-> // block 4 : ordering C |
---|
916 | //-> // quotient ring from ideal |
---|
917 | //-> _[1]=x(1)-y(1)^2 |
---|
918 | |
---|
919 | |
---|
920 | |
---|
921 | tst_status(1);$ |
---|
922 | |
---|