1 | LIB "tst.lib"; |
---|
2 | tst_init(); |
---|
3 | |
---|
4 | |
---|
5 | //====================== Example 1.19 ============================= |
---|
6 | ring R = 0, (w,x,y,z), dp; |
---|
7 | ideal I = xz-y2, wz-xy, wy-x2; |
---|
8 | I; |
---|
9 | //-> I[1]=-y2+xz |
---|
10 | //-> I[2]=-xy+wz |
---|
11 | //-> I[3]=-x2+wy |
---|
12 | |
---|
13 | resolution fI = mres(I,0); |
---|
14 | fI; |
---|
15 | //-> 1 3 2 |
---|
16 | //-> R <-- R <-- R |
---|
17 | //-> 0 1 2 |
---|
18 | |
---|
19 | print(fI[1]); // the first syzygy matrix of R/I |
---|
20 | //-> y2-xz, |
---|
21 | //-> xy-wz, |
---|
22 | //-> x2-wy |
---|
23 | |
---|
24 | print(fI[2]); // the second syzygy matrix of R/I |
---|
25 | //-> x, w, |
---|
26 | //-> -y,-x, |
---|
27 | //-> z, y |
---|
28 | |
---|
29 | print(betti(fI),"betti"); // the Betti diagram |
---|
30 | // (see the remark below) |
---|
31 | //-> 0 1 2 |
---|
32 | //-> ------------------------ |
---|
33 | //-> 0: 1 - - |
---|
34 | //-> 1: - 3 2 |
---|
35 | //-> ------------------------ |
---|
36 | //-> total: 1 3 2 |
---|
37 | |
---|
38 | |
---|
39 | //================== continued in Example 1.26 ==================== |
---|
40 | ideal GI = groebner(I); |
---|
41 | hilb(GI); |
---|
42 | //-> // 1 t^0 |
---|
43 | //-> // -3 t^2 |
---|
44 | //-> // 2 t^3 |
---|
45 | //-> |
---|
46 | //-> // 1 t^0 |
---|
47 | //-> // 2 t^1 |
---|
48 | //-> // dimension (proj.) = 1 |
---|
49 | //-> // degree = 3 |
---|
50 | |
---|
51 | intvec co1 = hilb(GI,1); |
---|
52 | co1; |
---|
53 | //-> 1,0,-3,2,0 |
---|
54 | intvec co2 = hilb(GI,2); |
---|
55 | co2; |
---|
56 | //-> 1,2,0 |
---|
57 | |
---|
58 | proc displayHilbPoly(ideal G) |
---|
59 | "USAGE: displayHilbPoly(G), G of type ideal |
---|
60 | ASSUME: G must be a homogeneous Groebner basis for an ideal of the |
---|
61 | active ring in the SINGULAR session; say, G generates the |
---|
62 | homogeneous ideal I of R. |
---|
63 | RETURN: None. |
---|
64 | NOTE: Displays the Hilbert polynomial of R/I. |
---|
65 | " |
---|
66 | { |
---|
67 | int d = dim(G)-1; // degree of Hibert polynomial |
---|
68 | intvec co = hilb(G,2); // representation II of Hilbert series |
---|
69 | int s = size(co)-1; // s = deg(Q_M) +1 |
---|
70 | ring Qt = 0, t, dp; // change active ring to Q[t] |
---|
71 | poly QM = 0; |
---|
72 | for (int i=1; i<=s; i=i+1) |
---|
73 | { |
---|
74 | QM = QM+co[i]*t^(i-1); |
---|
75 | } |
---|
76 | poly QMi = QM; // the polynomial Q_M(t) |
---|
77 | int ifac = 1; |
---|
78 | list a; |
---|
79 | for (i=1; i<=d+1; i=i+1) |
---|
80 | { |
---|
81 | a = insert(a, subst(QMi,t,1)/ifac, i-1); |
---|
82 | QMi = diff((QMi),t); |
---|
83 | ifac = ifac*i; |
---|
84 | } |
---|
85 | poly PM = (-1)^(d)*a[d+1]; |
---|
86 | poly bin = 1; |
---|
87 | for (i=1; i<=d; i=i+1) |
---|
88 | { |
---|
89 | bin = bin*(t+i)/i; // compute binomial coeff. by recursion |
---|
90 | PM = PM+(-1)^(d-i)*a[d+1-i]*bin; |
---|
91 | } |
---|
92 | print(PM); |
---|
93 | } |
---|
94 | |
---|
95 | |
---|
96 | displayHilbPoly(GI); |
---|
97 | //-> 3t+1 |
---|
98 | |
---|
99 | |
---|
100 | kill R,co1,co2; |
---|
101 | //====================== Example 1.39 (New Session) ====================== |
---|
102 | ring R = 0, (x,y), dp; |
---|
103 | ideal I = x2y-y3, x3; |
---|
104 | poly f = x3y+x3; |
---|
105 | reduce(f,I,1); |
---|
106 | //-> // ** I is no standard basis |
---|
107 | //-> xy3+x3 |
---|
108 | |
---|
109 | reduce(f,I); |
---|
110 | //-> // ** I is no standard basis |
---|
111 | //-> xy3 |
---|
112 | |
---|
113 | ideal GI = groebner(I); |
---|
114 | GI; |
---|
115 | //-> GI[1]=x2y-y3 |
---|
116 | //-> GI[2]=x3 |
---|
117 | //-> GI[3]=xy3 |
---|
118 | //-> GI[4]=y5 |
---|
119 | reduce(f,GI); |
---|
120 | //-> 0 |
---|
121 | |
---|
122 | tst_status(1);$ |
---|
123 | |
---|