[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.7

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

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