[BACK]Return to minimal-test.k CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097 / lib / minimal

Annotation of OpenXM/src/k097/lib/minimal/minimal-test.k, Revision 1.4

1.4     ! takayama    1: /* $OpenXM: OpenXM/src/k097/lib/minimal/minimal-test.k,v 1.3 2000/06/09 08:04:54 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. */
                    217: def test_ann3(f) {
                    218:   local a,v,ww2,ans2;
                    219:   a = Sannfs3_laScala2(f);
                    220:   ans2 = a[0];
                    221:   v = [x,y,z];
                    222:   ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
                    223:   Sweyl("x,y,z",ww2);
                    224:   ans2 = ReParse(ans2);
                    225:   r= IsExact_h(ans2,[x,y,z]);
                    226:   Println(r);
                    227:   return([r,ans2]);
                    228: }
                    229: def test11a() {
                    230:   local a,v,ww2,ans2;
                    231: /* constructed by test11.
                    232:   ans2 =
                    233:        [[[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]] ,
                    234:         [[3*Dx^2*h , 0 , Dy , -Dz] ,
                    235:          [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] ,
                    236:          [0 , 2*x*Dy^2*Dz-3*z*Dx^2*h , 0 , 2*x*Dx+3*z*Dz] ,
                    237:          [2*x*Dx+3*z*Dz-h^2 , y*Dy-z*Dz , 0 , 0] ,
                    238:          [0 , 0 , 0 , 0] ,
                    239:          [2*x*Dy*Dz , 0 , z , -y] ,
                    240:          [0 , 0 , 0 , 0] ,
                    241:          [0 , 0 , 0 , 0] ,
                    242:          [0 , 0 , 0 , 0]] ,
                    243:   [[0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    244:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    245:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    246:    [-2*x*Dx-3*y*Dy-3*z*Dz-6*h^2 , -Dy , -Dz , 3*Dx^2*h , 3*Dy^2 , 3*Dy*Dz , -2*x*Dy , 2*x*Dz , 0] ,
                    247:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    248:    [3*y*z , z , y , -2*x*Dy*Dz , -3*z*Dy , 2*x*Dx , 2*x*z , -2*x*y , 0] ,
                    249:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    250:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    251:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0]] ,
                    252:    [[0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    253:     [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    254:     [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0]]]
                    255: */
                    256:   ans2 =
                    257:        [[[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]] ,
                    258:         [[3*Dx^2*h , 0 , Dy , -Dz] ,
                    259:          [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] ,
                    260:          [0 , 2*x*Dy^2*Dz-3*z*Dx^2*h , 0 , 2*x*Dx+3*z*Dz] ,
                    261:          [2*x*Dx+3*z*Dz-h^2 , y*Dy-z*Dz , 0 , 0] ,
                    262:          [2*x*Dy*Dz , 0 , z , -y]],
                    263:   [[-2*x*Dx-3*y*Dy-3*z*Dz-6*h^2 , -Dy , -Dz , 3*Dx^2*h , 3*Dy*Dz ] ,
                    264:    [3*y*z , z , y , -2*x*Dy*Dz , 2*x*Dx]]];
                    265:
                    266:   sm1_pmat( ans2[1]*ans2[0] );
                    267:   sm1_pmat( ans2[2]*ans2[1] );
                    268:   ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
                    269:   Sweyl("x,y,z",ww2);
                    270:   ans2 = ReParse(ans2);
                    271:   r= IsExact_h(ans2,[x,y,z]);
                    272:   Println(r);
                    273:   return([r,ans2]);
                    274: }
                    275:
                    276: def test12() {
                    277:   local a,v,ww2,ans2;
                    278:   a = Sannfs3("x^3-y^2*z^2");
                    279:   ans2 = a[0];
                    280:   v = [x,y,z];
                    281:   ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
1.4     ! takayama  282:   Sweyl("x,y,z",ww2);
        !           283:   ans2 = ReParse(ans2); /* DO NOT FORGET! */
1.3       takayama  284:   r= IsExact_h(ans2,[x,y,z]);
                    285:   Println(r);
                    286:   Println("It may stop by non-exact statement. The code of Sminimal_v (non-LaScala-Stillman contains bugs.");
                    287:   return([r,ans2]);
                    288: }
1.4     ! takayama  289:
        !           290: def test13() {
        !           291:   Println("test13 try to construct a minimal free resolution");
        !           292:   Println("of a GKZ system [[1,2]]. 6/12, 2000.");
        !           293:   ww2 = [["x1",-1,"x2",-1,"Dx1",1,"Dx2",1]];
        !           294:   Sweyl("x1,x2",ww2);
        !           295:   ans2 = GKZ([[1,2]],[0]);
        !           296:   ans2 = ReParse(ans2[0]);
        !           297:   return(Sminimal(ans2));
        !           298: }
        !           299:
        !           300: def test14() {
        !           301:   Println("test14 try to construct a minimal free resolution");
        !           302:   Println("of a GKZ system [[1,2,3]]. 6/12, 2000.");
        !           303:   ww2 = [["x1",-1,"x2",-1,"x3",-1,"Dx1",1,"Dx2",1,"Dx3",1]];
        !           304:   Sweyl("x1,x2,x3",ww2);
        !           305:   ans2 = GKZ([[1,2,3]],[0]);  /* It stops by the strategy error. */
        !           306:   ans2 = ReParse(ans2[0]);
        !           307:   return(Sminimal(ans2));
        !           308: }
        !           309: def test14a() {
        !           310:   Println("test14a try to construct a minimal free resolution");
        !           311:   Println("of a GKZ system [[1,2,3]]. 6/12, 2000.");
        !           312:   Println("Without automatic homogenization.");
        !           313:   ww2 = [["x1",-1,"x2",-1,"x3",-1,"Dx1",1,"Dx2",1,"Dx3",1]];
        !           314:   Sweyl("x1,x2,x3",ww2);
        !           315:   ans2 = [x1*Dx1+2*x2*Dx2+3*x3*Dx3 , Dx1^2-Dx2*h , -Dx1*Dx2+Dx3*h ,
        !           316:           Dx2^2-Dx1*Dx3 ];
        !           317:   ans2 = ReParse(ans2);
        !           318:   return(Sminimal(ans2,"homogenized"));
        !           319: }
        !           320:
        !           321: def test15() {
        !           322:   Println("test15 try to construct a minimal free resolution");
        !           323:   Println("of a GKZ system [[1,2,3]] by the order filt. 6/12, 2000.");
        !           324:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1]];
        !           325:   Sweyl("x1,x2,x3",ww2);
        !           326:   ans2 = GKZ([[1,2,3]],[0]);
        !           327:   ans2 = ReParse(ans2[0]);
        !           328:   return(Sminimal(ans2));
        !           329: }
        !           330:
        !           331: def test15b() {
        !           332:   Println("test15b try to construct a minimal free resolution");
        !           333:   Println("of toric [[1,2,3]] by the order filt. 6/12, 2000.");
        !           334:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1]];
        !           335:   Sweyl("x1,x2,x3",ww2);
        !           336:   ans2 = [Dx1^2-Dx2*h , -Dx1*Dx2+Dx3*h , Dx2^2-Dx1*Dx3 ];
        !           337:   ans2 = ReParse(ans2);
        !           338:   return(Sminimal(ans2,"homogenized"));
        !           339: }
        !           340:
        !           341: def test16() {
        !           342:   Println("test16 try to construct a minimal free resolution");
        !           343:   Println("of a GKZ system [[1,2,3,5]] by the order filt. 6/12, 2000.");
        !           344:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1]];
        !           345:   Sweyl("x1,x2,x3,x4",ww2);
        !           346:   ans2 = GKZ([[1,2,3,5]],[0]);
        !           347:   ans2 = ReParse(ans2[0]);
        !           348:   return(Sminimal(ans2));
        !           349: }
        !           350:
        !           351: def test16b() {
        !           352:   Println("test16b try to construct a minimal free resolution");
        !           353:   Println("of a toric [[1,2,3,5]] by the order filt. 6/12, 2000.");
        !           354:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1]];
        !           355:   Sweyl("x1,x2,x3,x4",ww2);
        !           356:   ans2 = GKZ([[1,2,3,5]],[0]);
        !           357:   ans3 = Rest(ans2[0]);
        !           358:   ans3 = ReParse(ans3);
        !           359:   Println("Toric variety:");
        !           360:   Println(ans3);
        !           361:   return(Sminimal(ans3));
        !           362: }
        !           363:
        !           364:
        !           365:
1.3       takayama  366:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>