Annotation of OpenXM/src/k097/lib/minimal/minimal-test.k, Revision 1.6
1.6 ! takayama 1: /* $OpenXM: OpenXM/src/k097/lib/minimal/minimal-test.k,v 1.5 2000/06/15 07:38:35 takayama Exp $ */
1.1 takayama 2: load["minimal.k"];
3: def test5() {
4: local a,b,c,cc,v;
5: a = Sannfs3_laScala2("x^3-y^2*z^2");
6: b = a[0];
7: v = [x,y,z];
8: c = Skernel(b[0],v);
9: c = c[0];
10: sm1_pmat([c,b[1],v]);
11: Println("-----------------------------------");
12: cc = sm1_res_div(c,b[1],v);
13: sm1_pmat(sm1_gb(cc,v));
14: c = Skernel(b[1],v);
15: c = c[0];
16: cc = sm1_res_div(c,b[2],v);
17: sm1_pmat(sm1_gb(cc,v));
18: return(a);
19: }
20: def test6() {
21: local a,b,c,cc,v;
22: a = Sannfs3("x^3-y^2*z^2");
23: b = a[0];
24: v = [x,y,z];
25: c = Skernel(b[0],v);
26: c = c[0];
27: sm1_pmat([c,b[1],v]);
28: Println("-------ker = im for minimal ?---------------------");
29: cc = sm1_res_div(c,b[1],v);
30: sm1_pmat(sm1_gb(cc,v));
31: c = Skernel(b[1],v);
32: c = c[0];
33: cc = sm1_res_div(c,b[2],v);
34: sm1_pmat(sm1_gb(cc,v));
35: Println("------ ker=im for Schreyer ?------------------");
36: b = a[3];
37: c = Skernel(b[0],v);
38: c = c[0];
39: sm1_pmat([c,b[1],v]);
40: cc = sm1_res_div(c,b[1],v);
41: sm1_pmat(sm1_gb(cc,v));
42: c = Skernel(b[1],v);
43: c = c[0];
44: cc = sm1_res_div(c,b[2],v);
45: sm1_pmat(sm1_gb(cc,v));
46: return(a);
47: }
48:
49: /* May 23, Tue */
50: def test7() {
51: local a,b,c,cc,v;
52: a = Sannfs3_laScala2("x^3-y^2*z^2");
53: b = a[0];
54: v = [x,y,z];
55: c = Skernel(b[0],v);
56: c = c[0];
57: sm1_pmat([c,b[1],v]);
58: Println("-------ker = im for minimal ?---------------------");
59: cc = sm1_res_div(c,b[1],v);
60: sm1_pmat(sm1_gb(cc,v));
61: c = Skernel(b[1],v);
62: c = c[0];
63: cc = sm1_res_div(c,b[2],v);
64: sm1_pmat(sm1_gb(cc,v));
65: Println("------ ker=im for Schreyer ?------------------");
66: b = a[3];
67: c = Skernel(b[0],v);
68: c = c[0];
69: sm1_pmat([c,b[1],v]);
70: cc = sm1_res_div(c,b[1],v);
71: sm1_pmat(sm1_gb(cc,v));
72: c = Skernel(b[1],v);
73: c = c[0];
74: cc = sm1_res_div(c,b[2],v);
75: sm1_pmat(sm1_gb(cc,v));
76: return(a);
77: }
78:
79: def sm1_resol1(p) {
80: sm1(" p resol1 /FunctionValue set ");
81: }
82:
83:
84: def test8() {
85: local p,pp,ans,b,c,cc,ww,ww2;
86: f = "x^3-y^2*z^2";
87: p = Sannfs(f,"x,y,z");
88: ww = [["x",1,"y",1,"z",1,"Dx",1,"Dy",1,"Dz",1,"h",1],
89: ["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
90: ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
91: sm1(" p 0 get { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /p set ");
92: Sweyl("x,y,z",ww);
93: pp = Map(p,"Spoly");
94: /* return(pp); */
95: /* pp =
96: [y*Dy-z*Dz , -2*x*Dx-3*y*Dy+1 , 2*x*Dy*Dz^2-3*y*Dx^2 ,
97: 2*x*Dy^2*Dz-3*z*Dx^2 , 2*x*z*Dz^3-3*y^2*Dx^2+4*x*Dz^2 ]
98: */
99: ans = sm1_resol1([pp,"x,y,z",ww]);
100: /* Schreyer is in ans. */
101:
102: v = [x,y,z];
103: b = ans;
104: Println("------ ker=im for Schreyer ?------------------");
105: c = Skernel(b[0],v);
106: c = c[0];
107: sm1_pmat([c,b[1],v]);
108: cc = sm1_res_div(c,b[1],v);
109: sm1_pmat(sm1_gb(cc,v));
110: c = Skernel(b[1],v);
111: c = c[0];
112: cc = sm1_res_div(c,b[2],v);
113: sm1_pmat(sm1_gb(cc,v));
114: return(ans);
115: }
116: /*
117: a = test8();
118: SisComplex(a):
119: */
120:
121: def test8a() {
122: local p,pp,ans,b,c,cc,ww, ans_all;
123: f = "x^3-y^2*z^2";
124: p = Sannfs(f,"x,y,z");
125: sm1(" p 0 get { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /p set ");
126: ww = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
127: /* Removed "x",1, ... ===> It causes an error. I do not know the reason.*/
128: Sweyl("x,y,z",ww);
129: pp = Map(p,"Spoly");
130: /* return(pp); */
131: /* pp =
132: [y*Dy-z*Dz , -2*x*Dx-3*y*Dy+1 , 2*x*Dy*Dz^2-3*y*Dx^2 ,
133: 2*x*Dy^2*Dz-3*z*Dx^2 , 2*x*z*Dz^3-3*y^2*Dx^2+4*x*Dz^2 ]
134: */
135: ans_all = Sschreyer(pp);
136: ans = ans_all[0];
137: /* ans = sm1_resol1([pp,"x,y,z",ww]); */
138: /* Schreyer is in ans. */
139:
140: v = [x,y,z];
141: b = ans;
1.3 takayama 142: Println("------ ker=im for Schreyer ?----- wrong method!!!-----------");
1.1 takayama 143: c = Skernel(b[0],v);
144: c = c[0];
145: sm1_pmat([c,b[1],v]);
146: cc = sm1_res_div(c,b[1],v);
147: sm1_pmat(sm1_gb(cc,v));
148: c = Skernel(b[1],v);
149: c = c[0];
150: cc = sm1_res_div(c,b[2],v);
151: sm1_pmat(sm1_gb(cc,v));
152: return(ans);
153: }
154:
155: /* Comparing two constructions */
156: def test9() {
157: local p,pp,ans,b,c,cc,ww,ww2,ans_all,ans2;
158: f = "x^3-y^2*z^2";
159: p = Sannfs(f,"x,y,z");
160: ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
161: sm1(" p 0 get { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /p set ");
162: Sweyl("x,y,z",ww2);
163: pp = Map(p,"Spoly");
164: ans = sm1_resol1([pp,"x,y,z",ww2]);
165:
166: f = "x^3-y^2*z^2";
167: p = Sannfs(f,"x,y,z");
168: sm1(" p 0 get { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /p set ");
169: ww = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
170: Sweyl("x,y,z",ww);
171: pp = Map(p,"Spoly");
172: ans_all = Sschreyer(pp);
173: ans2 = ans_all[0];
174:
175: return([ans,ans2]);
1.2 takayama 176:
177: }
178:
1.3 takayama 179: /* Check if the complex by Sschreyer() is exact or not in our example? */
1.2 takayama 180: def test10() {
181: local p,pp,ans,b,c,cc,ww,ww2,ans_all,ans2, r;
182: f = "x^3-y^2*z^2";
183: p = Sannfs(f,"x,y,z");
184: ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
185: sm1(" p 0 get { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /p set ");
186: Sweyl("x,y,z",ww2);
187: pp = Map(p,"Spoly");
188: ans = sm1_resol1([pp,"x,y,z",ww2]);
189:
190: f = "x^3-y^2*z^2";
191: p = Sannfs(f,"x,y,z");
192: sm1(" p 0 get { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /p set ");
193: ww = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
194: Sweyl("x,y,z",ww);
195: pp = Map(p,"Spoly");
196: ans_all = Sschreyer(pp); /* Schreyer by LaScala-Stillman */
197: ans2 = ans_all[0];
198:
1.3 takayama 199: sm1(" /gb.verbose 1 def ");
200:
201: ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
202: Sweyl("x,y,z",ww2);
203: ans2 = ReParse(ans2);
204: r= IsExact_h(ans2,[x,y,z]);
1.2 takayama 205: Print(r);
206:
207: return([r,[ans,ans2]]);
1.1 takayama 208:
209: }
1.3 takayama 210:
211: def test11() {
212: local a;
213: a = test_ann3("x^3-y^2*z^2");
214: return(a);
215: }
216: /* f should be a string. */
1.5 takayama 217: /* a=test_ann3("x^3+y^3+z^3");
218: It returns the following resolution in 1.5 hours. June 14, 2000.
219: [
220: [
221: [ x*Dx+y*Dy+z*Dz-3*h^2 ]
222: [ -z*Dy^2+y*Dz^2 ]
223: [ -z*Dx^2+x*Dz^2 ]
224: [ -y*Dx^2+x*Dy^2 ]
225: ]
226: [
227: [ 0 , -x , y , -z ]
228: [ z*Dx^2-x*Dz^2 , x*Dy , x*Dx+z*Dz-3*h^2 , z*Dy ]
229: [ y*Dx^2-x*Dy^2 , -x*Dz , y*Dz , x*Dx+y*Dy-3*h^2 ]
230: [ 0 , Dx^2 , -Dy^2 , Dz^2 ]
231: [ z*Dy^2-y*Dz^2 , x*Dx+y*Dy+z*Dz-2*h^2 , 0 , 0 ]
232: ]
233: [
234: [ -x*Dx+3*h^2 , y , -z , 0 , -x ]
235: [ Dy^3+Dz^3 , Dy^2 , -Dz^2 , x*Dx+y*Dy+z*Dz , -Dx^2 ]
236: ]
237: ]
238: */
1.3 takayama 239: def test_ann3(f) {
240: local a,v,ww2,ans2;
241: a = Sannfs3_laScala2(f);
242: ans2 = a[0];
243: v = [x,y,z];
244: ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
245: Sweyl("x,y,z",ww2);
246: ans2 = ReParse(ans2);
247: r= IsExact_h(ans2,[x,y,z]);
248: Println(r);
249: return([r,ans2]);
250: }
251: def test11a() {
252: local a,v,ww2,ans2;
253: /* constructed by test11.
254: ans2 =
255: [[[y*Dy-z*Dz] , [-2*x*Dx-3*z*Dz+h^2] , [2*x*Dy*Dz^2-3*y*Dx^2*h] , [2*x*Dy^2*Dz-3*z*Dx^2*h]] ,
256: [[3*Dx^2*h , 0 , Dy , -Dz] ,
257: [6*x*Dy*Dz^2-9*y*Dx^2*h , -2*x*Dy*Dz^2+3*y*Dx^2*h , -2*x*Dx-3*y*Dy , 0] ,
258: [0 , 2*x*D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 2*x*Dx+3*z*Dz] ,
283: [2*x*Dx+3*z*Dz-h^2 , y*Dy-z*Dz , 0 , 0] ,
284: [2*x*Dy*Dz , 0 , z , -y]],
285: [[-2*x*Dx-3*y*Dy-3*z*Dz-6*h^2 , -Dy , -Dz , 3*Dx^2*h , 3*Dy*Dz ] ,
286: [3*y*z , z , y , -2*x*Dy*Dz , 2*x*Dx]]];
287:
288: sm1_pmat( ans2[1]*ans2[0] );
289: sm1_pmat( ans2[2]*ans2[1] );
290: ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
291: Sweyl("x,y,z",ww2);
292: ans2 = ReParse(ans2);
293: r= IsExact_h(ans2,[x,y,z]);
294: Println(r);
295: return([r,ans2]);
296: }
297:
298: def test12() {
299: local a,v,ww2,ans2;
300: a = Sannfs3("x^3-y^2*z^2");
301: ans2 = a[0];
302: v = [x,y,z];
303: ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
1.4 takayama 304: Sweyl("x,y,z",ww2);
305: ans2 = ReParse(ans2); /* DO NOT FORGET! */
1.3 takayama 306: r= IsExact_h(ans2,[x,y,z]);
307: Println(r);
308: Println("It may stop by non-exact statement. The code of Sminimal_v (non-LaScala-Stillman contains bugs.");
309: return([r,ans2]);
310: }
1.4 takayama 311:
312: def test13() {
313: Println("test13 try to construct a minimal free resolution");
314: Println("of a GKZ system [[1,2]]. 6/12, 2000.");
1.5 takayama 315: ans2 = GKZ([[1,2]],[0]);
316: /* Be careful!! It resets the grade to module1, not module1v */
1.4 takayama 317: ww2 = [["x1",-1,"x2",-1,"Dx1",1,"Dx2",1]];
318: Sweyl("x1,x2",ww2);
319: ans2 = ReParse(ans2[0]);
1.5 takayama 320: Println(ans2);
1.4 takayama 321: return(Sminimal(ans2));
322: }
323:
324: def test14() {
325: Println("test14 try to construct a minimal free resolution");
326: Println("of a GKZ system [[1,2,3]]. 6/12, 2000.");
1.6 ! takayama 327: ans2 = GKZ([[1,2,3]],[0]);
! 328: /* It stops by the strategy error.
! 329: July 26, 2000. It works fine after fixing a bug in resol.c */
1.4 takayama 330: ww2 = [["x1",-1,"x2",-1,"x3",-1,"Dx1",1,"Dx2",1,"Dx3",1]];
331: Sweyl("x1,x2,x3",ww2);
332: ans2 = ReParse(ans2[0]);
333: return(Sminimal(ans2));
334: }
335: def test14a() {
336: Println("test14a try to construct a minimal free resolution");
337: Println("of a GKZ system [[1,2,3]]. 6/12, 2000.");
338: Println("Without automatic homogenization.");
339: ww2 = [["x1",-1,"x2",-1,"x3",-1,"Dx1",1,"Dx2",1,"Dx3",1]];
340: Sweyl("x1,x2,x3",ww2);
341: ans2 = [x1*Dx1+2*x2*Dx2+3*x3*Dx3 , Dx1^2-Dx2*h , -Dx1*Dx2+Dx3*h ,
342: Dx2^2-Dx1*Dx3 ];
343: ans2 = ReParse(ans2);
344: return(Sminimal(ans2,"homogenized"));
345: }
346:
347: def test15() {
348: Println("test15 try to construct a minimal free resolution");
349: Println("of a GKZ system [[1,2,3]] by the order filt. 6/12, 2000.");
350: ww2 = [["Dx1",1,"Dx2",1,"Dx3",1]];
351: Sweyl("x1,x2,x3",ww2);
352: ans2 = GKZ([[1,2,3]],[0]);
353: ans2 = ReParse(ans2[0]);
354: return(Sminimal(ans2));
355: }
356:
357: def test15b() {
358: Println("test15b try to construct a minimal free resolution");
359: Println("of toric [[1,2,3]] by the order filt. 6/12, 2000.");
360: ww2 = [["Dx1",1,"Dx2",1,"Dx3",1]];
361: Sweyl("x1,x2,x3",ww2);
362: ans2 = [Dx1^2-Dx2*h , -Dx1*Dx2+Dx3*h , Dx2^2-Dx1*Dx3 ];
363: ans2 = ReParse(ans2);
364: return(Sminimal(ans2,"homogenized"));
365: }
366:
367: def test16() {
368: Println("test16 try to construct a minimal free resolution");
369: Println("of a GKZ system [[1,2,3,5]] by the order filt. 6/12, 2000.");
370: ww2 = [["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1]];
371: Sweyl("x1,x2,x3,x4",ww2);
372: ans2 = GKZ([[1,2,3,5]],[0]);
373: ans2 = ReParse(ans2[0]);
374: return(Sminimal(ans2));
375: }
376:
377: def test16b() {
378: Println("test16b try to construct a minimal free resolution");
379: Println("of a toric [[1,2,3,5]] by the order filt. 6/12, 2000.");
380: ww2 = [["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1]];
381: Sweyl("x1,x2,x3,x4",ww2);
382: ans2 = GKZ([[1,2,3,5]],[0]);
383: ans3 = Rest(ans2[0]);
384: ans3 = ReParse(ans3);
385: Println("Toric variety:");
386: Println(ans3);
387: return(Sminimal(ans3));
388: }
389:
390:
391:
1.3 takayama 392:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>