source: git/Tst/BuchDL/Ex_L3.tst @ 853a8a

spielwiese
Last change on this file since 853a8a was ed7a55c, checked in by Hans Schoenemann <hannes@…>, 13 years ago
use div instead of /, part 3 git-svn-id: file:///usr/local/Singular/svn/trunk@14194 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 24.7 KB
Line 
1LIB "tst.lib";
2tst_init();
3
4
52+3+4;
6//->   9
72+3; 3+5;
8//->   5
9//->   8
10
111+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
151/3 + 1/5;
16//->      ? no ring active
17//->      ? error occurred in STDIN line ...: `1/3 + 1/5;`
18
19ring R = 0, (x,y), dp;
20ring R1 = 0, x(1..7), dp;
21ring R2 = (0,i), (x,y), dp;
22minpoly = i^2+1;
23ring R3 = (2,a), (x,y), dp;
24minpoly = a^3+a+1;
25ring R3prime = (2^3,a), (x,y), dp;
26ring R4 = (32003,s,t), (x,y), dp;
27
28//======================  Example 3.2 =============================
29ring R5 = 0, (w,x,y,z), dp;
30matrix m[2][3] = w,x,y,x,y,z;
31ideal I = minor(m,2);
32qring Q = groebner(I);
33basering;
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
44setring R2;
451/3+1/5;
46//->   8/15
47setring R3;
481/3+1/5;
49//->   0
50
51varstr(R3);
52//->   x,y
53poly f = x+y;
54f;
55//->   x+y
56ring S3 = (2^3,a), (y,x), dp;
57poly f = x+y;
58f;
59//->   y+x
60
61
62kill R,R1,R2,R3,R3prime,R4,R5,Q,S3;
63//====================== new Session ==============================
64ring R = 0, x(1..7), (dp(3),wp(2,1),dp);
65basering;
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
77kill R;
78ring R = 0, (x,y,z), M(1,1,1, 0,0,-1, 0,-1,0);
79
80kill R;
81ring R = 0, (x,y,z,w), (a(1,0,0,1),dp);
82
83kill R;
84//====================== Example 3.8 (new Session) ================
85ring R = 0, (x,y), (c,dp);
86
87kill R;
88//====================== Remark 3.9 (new Session) =================
89ring R = 0, (x,y,e(1..3)), wp(1,1,-1,-2,-4);
90ideal I = e(1..3);
91qring Q = groebner(I^2);
92
93
94kill Q,R;
95//======================  new Session =============================
96ring R = 0, (x,y), dp;
97int i = 1;              // object of ring independent type int
98poly f = x;             // object of ring dependent type poly
99ring S = 0, (x,y), dp;  // active ring is changed
100poly g = y;
101f;
102//->      ? `f` is undefined
103//->      ? error occurred in STDIN line 6: `f;`
104
105listvar();
106//->   // S                    [0]  *ring
107//->   //      g                    [0]  poly
108//->   // i                    [0]  int 1
109//->   // R                    [0]  ring
110
111
112kill S,i,R;
113//======================  Example 3.10 (new Session) ==============
114ring R = 0, (x,y), dp;
115poly f = x2+y;
116ring S = 0, (a,b,c), dp;
117map F = R, a-b, c;  // map F: R->S, sending x to a-b, y to c
118poly g = F(f);      // apply the map
119g;
120//->   a2-2ab+b2+c
121ring S1 = 2, (a,b,c), lp;
122qring Q = std(a^2);
123map F1 = R, a-b, c; // target ring is qring, with another
124                    // characteristic and monomial order
125poly g=F1(f);
126g;                  // polynomial is not yet reduced
127//->   a2+b2+c
128reduce(g,std(0));
129//->   b2+c
130
131
132ring R1 = 0, (a,b,c,x,y,z), dp;
133fetch(R,f);         // fetch preserves order of variables
134//->   a2+b
135imap(R,f);          // imap preserves names of variables
136//->   x2+y
137fetch(Q,g);
138//->   a2+b2+c
139
140
141kill R,S,S1,R1,Q;
142//======================  new Session =============================
143ring R = 0, (x,y,z), dp;   
144ideal I = x2-y, y4-z2;
145
146
147kill R;
148//======================  new Session =============================
149ring R = 0, (x,y,z), dp;   
150poly f = x2-y;
151poly g = y4-z2;
152ideal I = f,g;
153vector v = [f,0,0,g,0];
154
155kill v; // ---- Alternatively:
156vector v = f*gen(1)+g*gen(4);
157
158kill R;
159ring R = 0, (x,y,z), (c,dp);
160vector v = [x,y]+[x2,1,z3,0]; 
161v;
162//->   [x2+x,y+1,z3]
163
164ring S = 0, (x,y,z), (dp,c); 
165vector v = fetch(R,v);
166v;
167//->   z3*gen(3)+x2*gen(1)+x*gen(1)+y*gen(2)+gen(2)
168
169print(v);
170//->   [x2+x,y+1,z3]
171
172
173kill S,R;
174//======================  new Session =============================
175ring R = 0, (x,y), dp;
176module I = [x2,-y,y,-y,0], [0,0,y], [y,x];
177print(I);
178//->   x2,0,y,
179//->   -y,0,x,
180//->   y, y,0,
181//->   -y,0,0
182
183matrix MI[4][3] =  x2, 0, y,
184                   -y, 0, x,
185                    y, y, 0,
186                   -y, 0, 0;
187
188kill MI; // ---- Alternatively:
189matrix MI = I;
190
191
192kill R;
193//====================== Section 3.4 (new Session) =================
194ring R = 0, (w,x,y,z), dp;
195module 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];
198print(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
205attrib(I,"isHomog");     // no attribute => empty output
206homog(I);
207//->   1
208attrib(I,"isHomog");
209//->   0,1,1,2,2
210
211print(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
221intvec DV =  2,3,3,4,4;
222attrib(I,"isHomog",DV);
223
224attrib(I,"isHomog");
225//->   2,3,3,4,4
226print(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
236intmat BI = betti(I,0);
237int d = attrib(BI,"rowShift");
238d;
239//->   2
240
241
242kill R,DV,BI,d;
243//====================== Section 3.5 (new Session) =================
244ring R = 0, (x,y,z), lp;
245ideal  I = 2y+z,3x-y;
246std(I);
247//->   _[1]=2y+z
248//->   _[2]=3x-y
249option(redSB);
250ideal G = std(I);
251G;
252//->   G[1]=2y+z
253//->   G[2]=6x+z
254G = simplify(G,1);
255G;
256//->   G[1]=y+1/2z
257//->   G[2]=x+1/6z
258
259
260kill R;
261//====================== Example 3.13 (new Session) ===============
262ring R = 0, (x,y,z), dp;
263ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4;
264option(redSB);          // force computation of reduced GBs
265int aa = timer;
266ideal SI = std(I);     
267size(SI);  dim(SI);
268
269ring S = 0, (x,y,z), lp;
270aa = timer;
271ideal J = fglm(R,SI);   
272
273size(J);                  // number of generators
274//->   8
275size(string(J)) div 68;   // number of lines with 68 characters
276                          // needed to display J:
277//->   631
278deg(J[1..size(J)]);       // degrees of the generators
279//->   35 34 34 34 34 34 34 34
280leadmonom(J[1..size(J)]); // generators for L(I) w.r.t. lp
281//->   z35 yz6 y2z4 y3z2 y5 xz2 xy x3
282leadcoef(J[8]);           // leading coefficient of 8th generator
283//->   6440093631623773985969509841859276602512807348986590906348582267651806942677443883093109641441627364249598438582596862938314965556548533870597328962260825040847335705757819599104
284
285ideal I = fetch(R,I);
286// I = std(I);
287//->   error: no more memory
288
289
290kill S,aa,R;
291//====================== Example 3.14 (new Session) ===============
292LIB "grwalk.lib";
293ring S = 0, (x,y,z), lp;
294ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4;
295option(redSB);          // force computation of reduced GBs
296int aa = timer;
297ideal J = fwalk(I);
298size(J), dim(J);
299
300kill S,aa;
301//====================== Example 3.16 (new Session) ===============
302ring S = 0, (x,y,z), lp;
303ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4;
304option(redSB);
305ring Rhom = 0, (x,y,z,t), dp;
306ideal I = imap(S,I);
307ideal Ih = homog(I,t);   // generators of I are homogenized
308int aa = timer; 
309Ih = std(Ih);
310intvec H = hilb(Ih,1);
311ring Shom = 0, (x,y,z,t), lp;
312ideal Ih = imap(Rhom,Ih);
313Ih = std(Ih,H);
314Ih = subst(Ih,t,1);
315setring S;
316ideal J = imap(Shom,Ih);
317size(J);
318//->   102
319
320J = interred(J);
321//->   3
322size(J);
323//->   8
324dim(J);
325
326
327kill S,Rhom,aa,H,Shom;
328//====================== Remark 3.18 (new Session) ===============
329ring R = (32003,a,b,c,d), (t,u,v,w,x,y,z), dp;
330ideal 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);
334int aa = timer;
335ideal SI = slimgb(I); 
336size(SI), dim(SI);
337
338SI = std(I); 
339size(SI), dim(SI);
340
341
342
343kill R,aa;
344//====================== Example 3.20 (new Session) ===============
345ring S = 0, (x,y,z), lp;
346ideal I = 3x3y+x3+xy3+y2z2, 2x3z-xy-xz3-y4-z2, 2x2yz-2xy2+xz2-y4;
347option(redSB);
348option(prot);
349int aa = timer;
350ideal 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
372size(J);
373//->   8
374
375
376kill S,aa;
377option(noprot);
378//====================== Example 3.21 (new Session) ===============
379ring R = 0, (x,y), dp;
380ideal I = 4x2y2+3x, y3+2xy, 7x3+6y;
381std(I);
382//->   _[1]=y
383//->   _[2]=x
384
385ideal J = x;
386matrix A = lift(I,J);
387A;
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
391matrix(I)*A;
392//->   _[1,1]=x
393
394
395kill R;
396//====================== Example 3.22 (new Session) ===============
397ring R = 0, (x,y), dp;       
398ideal I = x7+x5y2, y4-xy7;
399poly f1, f2 = x6y7+x3y5, x6y7+x7y2;
400ideal GI = groebner(I);
401reduce(f1,GI,1);     // see Example 1.39 for reduce
402//->   y5-y4
403reduce(f2,GI,1);
404//->   0
405lift(I,f1); 
406//->      ? 2nd module lies not in the first
407//->      ? error occurred in STDIN line 8: `lift(I,f1);  `
408matrix C = lift(I,f2);
409C;
410//->   C[1,1]=x4y22-x2y24-x3y19+xy21+y2
411//->   C[2,1]=x10y15-x6y19-x5
412f2 - C[1,1]*I[1] - C[2,1]*I[2];  // check (result must be 0)
413//->   0
414
415ideal J1 = f1, f2;
416ideal J2 = f2, x5y9+x6y4;
417reduce(J1,GI,1);     // normal form for the generators of J1
418//->   _[1]=y5-y4
419//->   _[2]=0
420size(reduce(J2,GI,1));
421//->   0
422
423
424kill R;
425//====================== Example 3.23 (new Session) ===============
426ring R = 0, (x,y), dp;       
427ideal I = maxideal(3);  // the ideal <x,y>^3
428poly f1, f2 = x, 1-x;
429ring S = 0, (x,y,t), dp; 
430ideal I = imap(R,I);
431poly f1 = imap(R,f1);
432ideal Jf1 = I, t*f1-1;
433Jf1 = std(Jf1);
434reduce(1,Jf1,1);    // result is 0 iff f1 is in radical(I)
435//->   0
436poly f2 = imap(R,f2);
437ideal Jf2 = I, t*f2-1;
438Jf2 = std(Jf2);
439reduce(1,Jf2,1);
440//->   1
441
442setring R; // ---- Alternatively ---------
443if (not(defined(rad_con))){ LIB "poly.lib"; }
444rad_con(f1,I);      // result is 1 iff f is in radical(I)
445//->   1
446rad_con(f2,I);
447//->   0
448
449
450kill R,S;
451//====================== Example 3.24 (new Session) ===============
452ring R = 0, (a,b,c,d,e,f,g,t,u,v,w,y,z), dp;
453ideal 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;
456ring Rhom = 0, (a,b,c,d,e,f,g,t,u,v,w,y,z,h), dp;
457ideal I = imap(R,I);
458ideal J = homog(I,h);    // homogenize the given generators
459int aa = timer;
460ideal L = std(J);
461intvec H = hilb(L,1);    // assign Hilbert series
462ideal K = eliminate(J,abcdefgtuvw,H);
463K = subst(K,h,1);        // dehomogenize
464size(K);   
465//->   1
466K[1];                    // the equation
467//->   790272y16z16-3612672y16z15+3612672y15z16-6530048y16z14-6006784y15z15
468//->   -6530048y14z16+41607168y16z13-56159232y15z14+[...]
469
470
471kill R,Rhom,aa,H;
472//====================== Example 3.27 (new Session) ===============
473ring R = 0, x(1..3), dp;
474poly f1 = x(1)^6*x(3)^2-x(2)^6*x(3)^2;
475poly f2,f3,f4 = x(1)^3-x(2)^3, x(1)^3+x(2)^3, x(3)^3;
476ring S = 0, y(1..4), dp;
477setring R;
478ideal zero;              // the zero ideal
479map phi = S,f1,f2,f3,f4;
480setring S;
481preimage(R,phi,zero);    // the kernel of phi
482//->   _[1]=y(2)^3*y(3)^3*y(4)^2-y(1)^3
483
484setring R; //--- Alternatively:
485kill S;
486if (not(defined(algDependent))){ LIB "algebra.lib"; }
487list L = algDependent(ideal(f1,f2,f3,f4));
488L[1];            // first entry of L is 1 iff the polynomials are
489                 // algebraically dependent
490//->   1
491def S = L[2];    // second entry of L is a ring which contains
492                 // an ideal ker defining the algebraic relation
493setring S;
494ker;
495//->   ker[1]=y(2)^3*y(3)^3*y(4)^2-y(1)^3
496
497
498kill R,S,L;
499//====================== Example 3.28 (new Session) ===============
500ring R = 0, x(1..3), dp;
501poly f = x(1)^6*x(2)^6-x(1)^6*x(3)^6;
502poly f1 = x(1)^3*x(2)^3-x(1)^3*x(3)^3;
503poly f2 = x(1)^3*x(2)^3+x(1)^3*x(3)^3; 
504ring S = 0, (x(1..3),y(1..2)), (dp(3),dp(2));
505ideal J = imap(R,f1)-y(1), imap(R,f2)-y(2);
506ideal G = groebner(J);
507reduce(imap(R,f),G);
508//->   y(1)*y(2) 
509
510setring R; kill S; //--- Alternatively:
511if (not(defined(algebra_containment))){ LIB "algebra.lib"; }
512algebra_containment(f,ideal(f1,f2));
513//->   // y(1)*y(2)
514//->   1
515def L = algebra_containment(f,ideal(f1,f2),1);
516def S = L[2];
517setring S;
518check;              // polynomial defining the algebraic relation
519//->   y(1)*y(2)
520
521
522kill R,S,L;
523//====================== Example 3.29 (new Session) ===============
524ring C = 0, (a,b,c,x,y,z), (dp(3),dp);
525ideal J = c-b3, 2a+b6-x, 7b-a2-y, c2-z;
526option(redSB);
527simplify(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
533if (not(defined(is_surjective))){ LIB "algebra.lib"; }
534ring B = 0, (x,y,z), dp;
535ring A = 0, (a,b,c), dp;
536qring Q = groebner(c-b3);   // quotient ring
537map psi = B, 2a+b6, 7b-a2, c2;
538is_surjective(psi);
539//->   1
540
541
542kill A,B,C,Q;
543//====================== Example 3.30 (new Session) ===============
544ring R = 0, (w,x,y,z), dp;
545poly f1, f2, f3 = y2-xz, xy-wz, x2z-wyz;
546ideal I = f1, f2, f3;
547module phi2 = syz(I);
548print(phi2);
549//->   x, wz,
550//->   -y,-xz,
551//->   1, y 
552size(syz(phi2));  // we check that there are no higher syzygies
553//->   0
554
555resolution FI = nres(I,0);
556typeof(FI[1]);        // 'typeof' displays type of given object
557//->   ideal
558print(FI[1]);
559//->   y2-xz,
560//->   xy-wz
561//->   x2z-wyz
562typeof(FI[2]);
563//->   module
564print(FI[2]);
565//->   x, wz,
566//->   -y,-xz,
567//->   1, y   
568
569print(betti(FI),"betti");
570//->              0     1     2
571//->   ------------------------
572//->       0:     1     -     -
573//->       1:     -     2     -
574//->       2:     -     -     1
575//->   ------------------------
576//->   total:     1     2     1
577
578print(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
588kill R;
589//====================== Example 3.35 (new Session) ===============
590ring R = 0, (w,x,y,z), dp;
591module 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];
594print(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
600homog(I);
601//->   1
602attrib(I,"isHomog");
603//->   0,1,1,2,2
604resolution FInres = nres(I,0); 
605print(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
614print(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
620print(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
628size((FInres[3]));
629//->   0
630resolution FImres = mres(I,0);
631print(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
640print(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
646print(FImres[2]);   // display syzygies on the new generators
647//->   0,
648//->   xy,
649//->   -xz,
650//->   wy,
651//->   -wz
652module PI = prune(I);
653print(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
662print(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
667resolution FPImres = mres(PI,0);
668print(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
677print(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
682print(FPImres[2]);
683//->   xy,
684//->   wy,
685//->   -xz,
686//->   -wz
687resolution FPIsres = sres(PI,0);
688//->      ? ideal not a standardbasis
689//->      ? error occurred in STDIN line 27:
690//->        `resolution FPIsres = sres(PI,0);`
691resolution FPIsres = sres(groebner(PI),0);
692print(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
704resolution FInresmin = minres(FInres);
705print(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
714resolution FPIsresmin = minres(FPIsres);
715print(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
726kill R;
727listvar();
728//====================== Example 3.40(1) (new Session) ===============
729ring D3 = 0, (x(1..3),d(1..3)), dp;
730int i,j;
731matrix C[6][6];
732for (i=1; i<=6; i++) { for (j=i+1; j<=6; j++) { C[i,j] = 1; } }
733matrix H[6][6];
734H[1,4] = 1;  H[2,5] = 1;  H[3,6] = 1;
735def @S=nc_algebra(C,H); setring @S;
736
737kill D3;   // ---- Alternatively:
738if (not(defined(Exterior))){ LIB "nctools.lib"; }
739ring D3 = 0, (x(1..3),d(1..3)), dp;
740def @S3=Weyl(); setring @S3;
741
742basering;
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) ===============
754ideal I = x(1)^2*d(2)^2+x(2)^2*d(3)^2, x(1)*d(2)+x(3);
755option(redSB);
756ideal LSI = std(I);
757LSI;
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
765def D3_opp = opposite(@S3);
766setring D3_opp;   // active ring is the opposite algebra of @S3
767basering;
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
780ideal I = oppose(@S3,I);   // map I to opposite algebra
781ideal RSI_opp = std(I);
782setring @S3;
783ideal RSI = oppose(D3_opp,RSI_opp);
784RSI;
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
792size(reduce(RSI,LSI));
793//->   1
794ideal SI = twostd(I);
795SI;
796//->   SI[1]=1
797
798
799kill i,j,D3,D3_opp,@S3;
800//====================== Example 3.40(2) (new Session) ===============
801ring R = 0, x(1..3), dp;
802int i,j;
803matrix C[3][3];
804for (i=1; i<=3; i++) { for (j=i+1; j<=3; j++) { C[i,j] = -1; } }
805matrix H[3][3];
806def @SS=nc_algebra(C,H); setring @SS;
807ideal Q = x(1)^2, x(2)^2, x(3)^2;
808Q = twostd(Q);     // compute two-sided Groebner basis
809qring E3 = Q;
810
811kill E3,R;   // ---- Alternatively:
812if (not(defined(Exterior))){ LIB "nctools.lib"; }
813ring R = 0, x(1..3), dp;
814def E3 = Exterior();
815setring E3;
816basering;
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) ===============
832ideal I = maxideal(1);
833def rI = mres(I,0);
834//->   // ** full resolution in a qring may be infinite,
835//->   //    setting max length to 5
836print(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
842print(rI[1],"");
843//->   x(3),x(2),x(1)
844print(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
850kill i,j,E3,R;
851//====================== Remark 3.52 (new Session) ===============
852ring R = (0,a), (x(1..3),y(1..2),z(1..2)), (dp(3),wp(2,5),lp);
853minpoly = a^2+1;
854qring Q = std(y(1)^2-x(1));
855list L = ringlist(Q);
856size(L);
857//->   4
858L[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)
872L[2][7];
873//->   z(2)
874L[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
895L[4];
896//->   _[1]=x(1)-y(1)^2
897L[1][2][1] = "b";            // new name for the parameter
898L[2][8] = "w";               // append a new variable with name w
899L[3][3][2] = intvec(1,1,1);  // raise the size of the third block
900                             // of the monomial order
901def S = ring(L);
902setring S;
903basering;
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
921tst_status(1);$
922
Note: See TracBrowser for help on using the repository browser.