1 | LIB "tst.lib"; |
---|
2 | tst_init(); |
---|
3 | |
---|
4 | |
---|
5 | //====================== Exercise 1.1 ============================= |
---|
6 | ring R; |
---|
7 | R; |
---|
8 | poly f = x^4+x^3*z+x^2*y^2+y*z^4+z^5; |
---|
9 | f; |
---|
10 | ring S = 32003, (x,y,z), lp; |
---|
11 | poly g = fetch(R,f); |
---|
12 | g; |
---|
13 | |
---|
14 | |
---|
15 | kill R,S; |
---|
16 | //====================== Exercise 1.2 ============================= |
---|
17 | ring R = 32003, x(1..5), lp; |
---|
18 | int d = 5; |
---|
19 | ideal MId = maxideal(d); |
---|
20 | int s = size(MId); |
---|
21 | int i,j; |
---|
22 | ideal I; |
---|
23 | for (i=1; i<=10; i++) |
---|
24 | { |
---|
25 | poly f(i); |
---|
26 | for (j=1; j<=s; j++) |
---|
27 | { |
---|
28 | f(i) = f(i)+random(0,32002)*MId[j]; |
---|
29 | } |
---|
30 | I = I, f(i); |
---|
31 | } |
---|
32 | |
---|
33 | // -------------Alternatively-------------- |
---|
34 | kill I; |
---|
35 | if (not(defined(randomid))) { LIB "random.lib"; } |
---|
36 | ideal I = randomid(maxideal(d),10,32002); |
---|
37 | // ---------------------------------------- |
---|
38 | |
---|
39 | int aa = timer; |
---|
40 | ideal II = groebner(I); |
---|
41 | size(II); |
---|
42 | II; |
---|
43 | deg(II[1]); |
---|
44 | deg(II[size(II)]); |
---|
45 | write (":w lexGB.out",II); |
---|
46 | ring R1 = 32003, x(1..5), dp; |
---|
47 | ideal I = imap(R,I); |
---|
48 | aa = timer; |
---|
49 | ideal II = std(I); |
---|
50 | size(II); |
---|
51 | II; |
---|
52 | deg(II[1]); |
---|
53 | deg(II[size(II)]); |
---|
54 | write (":w dpGB.out",II); |
---|
55 | |
---|
56 | |
---|
57 | kill R,R1,aa,i,j,s,d; |
---|
58 | //====================== Exercise 1.3 ============================= |
---|
59 | ring R = 0, x(0..4), dp; |
---|
60 | matrix M[2][4] = x(0),x(1),x(2),x(3), |
---|
61 | x(1),x(2),x(3),x(4); |
---|
62 | ideal I = minor(M,2); |
---|
63 | resolution rI = mres(I,0); |
---|
64 | print(betti(rI),"betti"); |
---|
65 | for (int i=1; i<=3; i++) |
---|
66 | { |
---|
67 | i,"th syzygy matrix: "; |
---|
68 | "--------------------- "; |
---|
69 | print(rI[i]); |
---|
70 | ""; |
---|
71 | "has data type : ", typeof(rI[i]); |
---|
72 | ""; |
---|
73 | } |
---|
74 | ideal GI = groebner(I); |
---|
75 | hilb(GI); |
---|
76 | matrix JM = jacob(I); |
---|
77 | int codimI = nvars(R) - dim(GI); |
---|
78 | ideal singI = minor(JM,codimI) + I; |
---|
79 | nvars(R) - dim(groebner(singI)); |
---|
80 | //-> 5 |
---|
81 | |
---|
82 | // -------------Alternatively-------------- |
---|
83 | if (not(defined(slocus))){ LIB "sing.lib"; } |
---|
84 | nvars(R) - dim(groebner(slocus(I))); |
---|
85 | //-> 5 |
---|
86 | // ---------------------------------------- |
---|
87 | |
---|
88 | |
---|
89 | kill R,i,codimI; |
---|
90 | //====================== Exercise 1.4 ============================= |
---|
91 | proc maximaldegree (ideal I) |
---|
92 | "USAGE: maximaldegree(I); I=ideal |
---|
93 | RETURN: integer; the maximum degree of the given |
---|
94 | generators for I |
---|
95 | NOTE: return value is -1 if I=0 |
---|
96 | " |
---|
97 | { |
---|
98 | if (size(I)>0) |
---|
99 | { |
---|
100 | int i,dd; |
---|
101 | int d = deg(I[1]); |
---|
102 | for (i=2; i<=size(I); i++) |
---|
103 | { |
---|
104 | dd = deg(I[i]); |
---|
105 | if (dd>d) { d = dd; } |
---|
106 | } |
---|
107 | return(d); |
---|
108 | } |
---|
109 | else |
---|
110 | { |
---|
111 | return(-1); |
---|
112 | } |
---|
113 | } |
---|
114 | |
---|
115 | ring R = 32003, x(1..5), lp; |
---|
116 | string xxx = "ideal II="+read("lexGB.out")+";"; |
---|
117 | execute(xxx); |
---|
118 | maximaldegree(II); |
---|
119 | xxx = "ideal JJ="+read("dpGB.out")+";"; |
---|
120 | execute(xxx); |
---|
121 | maximaldegree(JJ); |
---|
122 | |
---|
123 | |
---|
124 | kill R,xxx; |
---|
125 | //====================== Exercise 1.5 ============================= |
---|
126 | ring P2 = 0, (u,v,w), dp; |
---|
127 | ideal emb = u2, v2, w2, uv, uw, vw; |
---|
128 | ideal I0 = ideal(0); |
---|
129 | ring P5 = 0, x(0..5), dp; |
---|
130 | ideal VP5 = preimage(P2, emb, I0); |
---|
131 | print(betti(list(VP5)),"betti"); |
---|
132 | |
---|
133 | ideal p = x(0), x(1), x(2), x(3)-x(5), x(4)-x(5); |
---|
134 | size(reduce(VP5,groebner(p),1)); |
---|
135 | ring P4 = 0, x(0..4), dp; |
---|
136 | ideal VP4 = preimage(P5,p,VP5); |
---|
137 | print(betti(list(VP4)),"betti"); |
---|
138 | // ---------- Check Smoothness ------------ |
---|
139 | if(not(defined(slocus))){ LIB "sing.lib"; } |
---|
140 | nvars(P4) - dim(groebner(slocus(VP4))); |
---|
141 | //-> 5 |
---|
142 | // ---------------------------------------- |
---|
143 | |
---|
144 | if(not(defined(sat))){ LIB "elim.lib"; // loads random.lib, too } |
---|
145 | ideal CI1 = randomid(VP4,2,100); |
---|
146 | ideal QES = sat(CI1,VP4)[1]; |
---|
147 | resolution FQES = mres(QES,0); |
---|
148 | print(betti(FQES),"betti"); |
---|
149 | // ---------- Check Smoothness ------------ |
---|
150 | nvars(P4) - dim(groebner(slocus(QES))); |
---|
151 | //-> 5 |
---|
152 | // ---------------------------------------- |
---|
153 | |
---|
154 | setring P5; |
---|
155 | ideal q = x(0)-x(1), x(1)-x(2), x(2)-x(3), x(3)-x(4), x(4)-x(5); |
---|
156 | size(reduce(VP5,groebner(q),1)); |
---|
157 | setring P4; |
---|
158 | ideal CS = preimage(P5,q,VP5); |
---|
159 | print(betti(list(CS)),"betti"); |
---|
160 | // ---------- Check Smoothness ------------ |
---|
161 | nvars(P5) - dim(groebner(slocus(CS))); |
---|
162 | //-> 6 |
---|
163 | // ---------------------------------------- |
---|
164 | ideal CI2 = matrix(CS)*randommat(3,2,maxideal(1),100); |
---|
165 | ideal B = sat(CI2,CS)[1]; |
---|
166 | print(betti(list(B)),"betti"); |
---|
167 | |
---|
168 | setring P5; |
---|
169 | ideal L = x(0)+x(1)+x(2), x(3), x(4), x(5); |
---|
170 | nvars(P5) - dim(groebner(VP5+L)); |
---|
171 | //-> 6 |
---|
172 | ring P3 = 0, y(0..3), dp; |
---|
173 | ideal SRS = preimage(P5,L,VP5); SRS; |
---|
174 | //-> y(1)^2*y(2)^2-y(0)*y(1)*y(2)*y(3)+y(1)^2*y(3)^2+y(2)^2*y(3)^2 |
---|
175 | |
---|
176 | tst_status(1);$ |
---|
177 | |
---|