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

1.18    ! takayama    1: /* $OpenXM: OpenXM/src/k097/lib/minimal/minimal-test.k,v 1.17 2000/08/10 02:59:08 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:
1.3       takayama   44: def test11() {
                     45:   local  a;
                     46:   a = test_ann3("x^3-y^2*z^2");
                     47:   return(a);
                     48: }
                     49: /* f should be a string. */
1.5       takayama   50: /* a=test_ann3("x^3+y^3+z^3");
                     51: It returns the following resolution in 1.5 hours.  June 14, 2000.
                     52:  [
                     53:   [
                     54:     [    x*Dx+y*Dy+z*Dz-3*h^2 ]
                     55:     [    -z*Dy^2+y*Dz^2 ]
                     56:     [    -z*Dx^2+x*Dz^2 ]
                     57:     [    -y*Dx^2+x*Dy^2 ]
                     58:   ]
                     59:   [
                     60:     [    0 , -x , y , -z ]
                     61:     [    z*Dx^2-x*Dz^2 , x*Dy , x*Dx+z*Dz-3*h^2 , z*Dy ]
                     62:     [    y*Dx^2-x*Dy^2 , -x*Dz , y*Dz , x*Dx+y*Dy-3*h^2 ]
                     63:     [    0 , Dx^2 , -Dy^2 , Dz^2 ]
                     64:     [    z*Dy^2-y*Dz^2 , x*Dx+y*Dy+z*Dz-2*h^2 , 0 , 0 ]
                     65:   ]
                     66:   [
                     67:     [    -x*Dx+3*h^2 , y , -z , 0 , -x ]
                     68:     [    Dy^3+Dz^3 , Dy^2 , -Dz^2 , x*Dx+y*Dy+z*Dz , -Dx^2 ]
                     69:   ]
                     70:  ]
                     71: */
1.3       takayama   72: def test_ann3(f) {
                     73:   local a,v,ww2,ans2;
1.7       takayama   74:   a = Sannfs3(f);
1.3       takayama   75:   ans2 = a[0];
                     76:   v = [x,y,z];
                     77:   ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
                     78:   Sweyl("x,y,z",ww2);
                     79:   ans2 = ReParse(ans2);
                     80:   r= IsExact_h(ans2,[x,y,z]);
                     81:   Println(r);
1.9       takayama   82:   return([r,ans2,a]);
1.3       takayama   83: }
                     84: def test11a() {
                     85:   local a,v,ww2,ans2;
                     86: /* constructed by test11.
                     87:   ans2 =
                     88:        [[[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]] ,
                     89:         [[3*Dx^2*h , 0 , Dy , -Dz] ,
                     90:          [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] ,
                     91:          [0 , 2*x*Dy^2*Dz-3*z*Dx^2*h , 0 , 2*x*Dx+3*z*Dz] ,
                     92:          [2*x*Dx+3*z*Dz-h^2 , y*Dy-z*Dz , 0 , 0] ,
                     93:          [0 , 0 , 0 , 0] ,
                     94:          [2*x*Dy*Dz , 0 , z , -y] ,
                     95:          [0 , 0 , 0 , 0] ,
                     96:          [0 , 0 , 0 , 0] ,
                     97:          [0 , 0 , 0 , 0]] ,
                     98:   [[0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                     99:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    100:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    101:    [-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] ,
                    102:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    103:    [3*y*z , z , y , -2*x*Dy*Dz , -3*z*Dy , 2*x*Dx , 2*x*z , -2*x*y , 0] ,
                    104:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    105:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    106:    [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0]] ,
                    107:    [[0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    108:     [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0] ,
                    109:     [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0]]]
                    110: */
                    111:   ans2 =
                    112:        [[[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]] ,
                    113:         [[3*Dx^2*h , 0 , Dy , -Dz] ,
                    114:          [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] ,
                    115:          [0 , 2*x*Dy^2*Dz-3*z*Dx^2*h , 0 , 2*x*Dx+3*z*Dz] ,
                    116:          [2*x*Dx+3*z*Dz-h^2 , y*Dy-z*Dz , 0 , 0] ,
                    117:          [2*x*Dy*Dz , 0 , z , -y]],
                    118:   [[-2*x*Dx-3*y*Dy-3*z*Dz-6*h^2 , -Dy , -Dz , 3*Dx^2*h , 3*Dy*Dz ] ,
                    119:    [3*y*z , z , y , -2*x*Dy*Dz , 2*x*Dx]]];
                    120:
                    121:   sm1_pmat( ans2[1]*ans2[0] );
                    122:   sm1_pmat( ans2[2]*ans2[1] );
                    123:   ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
                    124:   Sweyl("x,y,z",ww2);
                    125:   ans2 = ReParse(ans2);
                    126:   r= IsExact_h(ans2,[x,y,z]);
                    127:   Println(r);
                    128:   return([r,ans2]);
                    129: }
                    130:
                    131: def test12() {
                    132:   local a,v,ww2,ans2;
                    133:   a = Sannfs3("x^3-y^2*z^2");
                    134:   ans2 = a[0];
                    135:   v = [x,y,z];
                    136:   ww2 = [["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]];
1.4       takayama  137:   Sweyl("x,y,z",ww2);
                    138:   ans2 = ReParse(ans2); /* DO NOT FORGET! */
1.3       takayama  139:   r= IsExact_h(ans2,[x,y,z]);
                    140:   Println(r);
                    141:   return([r,ans2]);
                    142: }
1.4       takayama  143:
                    144: def test13() {
                    145:   Println("test13 try to construct a minimal free resolution");
                    146:   Println("of a GKZ system [[1,2]]. 6/12, 2000.");
1.5       takayama  147:   ans2 = GKZ([[1,2]],[0]);
                    148:    /* Be careful!! It resets the grade to module1, not module1v */
1.4       takayama  149:   ww2 = [["x1",-1,"x2",-1,"Dx1",1,"Dx2",1]];
                    150:   Sweyl("x1,x2",ww2);
                    151:   ans2 = ReParse(ans2[0]);
1.5       takayama  152:   Println(ans2);
1.4       takayama  153:   return(Sminimal(ans2));
                    154: }
                    155:
                    156: def test14() {
                    157:   Println("test14 try to construct a minimal free resolution");
                    158:   Println("of a GKZ system [[1,2,3]]. 6/12, 2000.");
1.6       takayama  159:   ans2 = GKZ([[1,2,3]],[0]);
                    160:      /* It stops by the strategy error.
                    161:         July 26, 2000. It works fine after fixing a bug in resol.c */
1.4       takayama  162:   ww2 = [["x1",-1,"x2",-1,"x3",-1,"Dx1",1,"Dx2",1,"Dx3",1]];
                    163:   Sweyl("x1,x2,x3",ww2);
                    164:   ans2 = ReParse(ans2[0]);
                    165:   return(Sminimal(ans2));
                    166: }
                    167: def test14a() {
                    168:   Println("test14a try to construct a minimal free resolution");
                    169:   Println("of a GKZ system [[1,2,3]]. 6/12, 2000.");
                    170:   Println("Without automatic homogenization.");
                    171:   ww2 = [["x1",-1,"x2",-1,"x3",-1,"Dx1",1,"Dx2",1,"Dx3",1]];
                    172:   Sweyl("x1,x2,x3",ww2);
                    173:   ans2 = [x1*Dx1+2*x2*Dx2+3*x3*Dx3 , Dx1^2-Dx2*h , -Dx1*Dx2+Dx3*h ,
                    174:           Dx2^2-Dx1*Dx3 ];
                    175:   ans2 = ReParse(ans2);
1.8       takayama  176:   return(Sminimal(ans2,["homogenized"]));
1.4       takayama  177: }
                    178:
                    179: def test15() {
                    180:   Println("test15 try to construct a minimal free resolution");
                    181:   Println("of a GKZ system [[1,2,3]] by the order filt. 6/12, 2000.");
                    182:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1]];
1.7       takayama  183:   ans2 = GKZ([[1,2,3]],[0]);
1.4       takayama  184:   Sweyl("x1,x2,x3",ww2);
                    185:   ans2 = ReParse(ans2[0]);
1.7       takayama  186:   a = Sminimal(ans2);
                    187:   Println("Minimal Resolution is "); sm1_pmat(a[0]);
                    188:   Sweyl("x1,x2,x3");
                    189:   ans3 = ReParse(a[0]);
                    190:   r= IsExact_h(ans3,[x1,x2,x3]);
                    191:   Println(r);
                    192:   return(a);
1.4       takayama  193: }
                    194:
                    195: def test15b() {
                    196:   Println("test15b try to construct a minimal free resolution");
                    197:   Println("of toric [[1,2,3]] by the order filt. 6/12, 2000.");
                    198:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1]];
                    199:   Sweyl("x1,x2,x3",ww2);
                    200:   ans2 = [Dx1^2-Dx2*h , -Dx1*Dx2+Dx3*h , Dx2^2-Dx1*Dx3 ];
                    201:   ans2 = ReParse(ans2);
1.8       takayama  202:   return(Sminimal(ans2,["homogenized"]));
1.4       takayama  203: }
                    204:
1.7       takayama  205: def test15c() {
                    206:   Println("test15c try to construct a minimal free resolution ");
                    207:   Println("of a GKZ system [[1,2,3]] by -1,1");
                    208:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1,"x1",-1,"x2",-1,"x3",-1]];
                    209:   ans2 = GKZ([[1,2,3]],[0]);
                    210:   Sweyl("x1,x2,x3",ww2);
                    211:   ans2 = ReParse(ans2[0]);
                    212:   a = Sminimal(ans2);
                    213:   Println("Minimal Resolution is "); sm1_pmat(a[0]);
                    214:   Sweyl("x1,x2,x3");
                    215:   ans3 = ReParse(a[0]);
                    216:   r= IsExact_h(ans3,[x1,x2,x3]);
                    217:   Println(r);
                    218:   return(a);
                    219: }
1.4       takayama  220: def test16() {
                    221:   Println("test16 try to construct a minimal free resolution");
                    222:   Println("of a GKZ system [[1,2,3,5]] by the order filt. 6/12, 2000.");
                    223:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1]];
                    224:   Sweyl("x1,x2,x3,x4",ww2);
                    225:   ans2 = GKZ([[1,2,3,5]],[0]);
                    226:   ans2 = ReParse(ans2[0]);
                    227:   return(Sminimal(ans2));
                    228: }
                    229:
                    230: def test16b() {
                    231:   Println("test16b try to construct a minimal free resolution");
                    232:   Println("of a toric [[1,2,3,5]] by the order filt. 6/12, 2000.");
                    233:   ww2 = [["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1]];
                    234:   Sweyl("x1,x2,x3,x4",ww2);
                    235:   ans2 = GKZ([[1,2,3,5]],[0]);
                    236:   ans3 = Rest(ans2[0]);
                    237:   ans3 = ReParse(ans3);
                    238:   Println("Toric variety:");
                    239:   Println(ans3);
                    240:   return(Sminimal(ans3));
                    241: }
                    242:
1.9       takayama  243:
                    244: def test17() {
                    245:    a=Sannfs3("x^3-y^2*z^2");
                    246:    b=a[0]; w = ["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1];
                    247:    Sweyl("x,y,z",[w]); b = Reparse(b);
                    248:    c=Sinit_w(b,w);
                    249:    Println("Resolution (b)----");
                    250:    sm1_pmat(b);
                    251:    Println("Initial (c)----");
                    252:    sm1_pmat(c);
                    253:    Println(IsExact_h(c,"x,y,z"));
                    254: }
1.10      takayama  255:
                    256: def test_if_v_strict(resmat,w,v) {
1.12      takayama  257:    local b,c,g;
1.10      takayama  258:    Sweyl(v,[w]); b = Reparse(resmat);
1.13      takayama  259:    Println("Degree shifts ");
                    260:    Println(SgetShifts(b,w));
1.9       takayama  261:    c=Sinit_w(b,w);
                    262:    Println("Resolution (b)----");
                    263:    sm1_pmat(b);
                    264:    Println("Initial (c)----");
1.12      takayama  265:    sm1_pmat(c);
1.10      takayama  266:    Println("Exactness of the resolution ---");
1.12      takayama  267:    Println(IsExact_h(b,v));
1.10      takayama  268:    Println("Exactness of the initial complex.---");
1.12      takayama  269:    Println(IsExact_h(c,v));
1.9       takayama  270:    g = Sinvolutive(b[0],w);
1.10      takayama  271:    /* Println("Involutive basis ---");
1.11      takayama  272:       sm1_pmat(g);
1.12      takayama  273:       Println(Sinvolutive(c[0],w));
1.11      takayama  274:       sm1(" /gb.verbose 1 def "); */
1.9       takayama  275:    Println("Is same ideal?");
1.12      takayama  276:    Println(IsSameIdeal_h(g,c[0],v));
1.10      takayama  277: }
                    278: def test17b() {
                    279:    a=Sannfs3("x^3-y^2*z^2");
1.11      takayama  280:    b=a[0]; w = ["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1];
1.10      takayama  281:    test_if_v_strict(b,w,"x,y,z");
                    282:    return(a);
1.9       takayama  283: }
                    284:
                    285: def test18() {
                    286:    a=Sannfs2("x^3-y^2");
                    287:    b=a[0]; w = ["x",-1,"y",-1,"Dx",1,"Dy",1];
1.10      takayama  288:    test_if_v_strict(b,w,"x,y");
                    289:    return(a);
1.9       takayama  290: }
1.4       takayama  291:
1.10      takayama  292: def test19() {
                    293:   Println("test19 try to construct a minimal free resolution and check if it is v-strict.");
                    294:   Println("of a GKZ system [[1,2,3]] by -1,1");
                    295:   ww2 = ["Dx1",1,"Dx2",1,"Dx3",1,"x1",-1,"x2",-1,"x3",-1];
                    296:   ans2 = GKZ([[1,2,3]],[0]);
                    297:   Sweyl("x1,x2,x3",[ww2]);
                    298:   ans2 = ReParse(ans2[0]);
                    299:   a = Sminimal(ans2);
                    300:   Println("Minimal Resolution is "); sm1_pmat(a[0]);
                    301:   b = a[0];
                    302:   test_if_v_strict(b,ww2,"x1,x2,x3");
                    303:   return(a);
                    304: }
                    305:
1.13      takayama  306: /* Need more than 100M memory. 291, 845, 1266, 1116, 592 : Schreyer frame.
                    307:    I've not yet tried to finish the computation. */
1.10      takayama  308: def test20() {
                    309:   w = ["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1,"x1",-1,"x2",-1,"x3",-1,"x4",-1];
                    310:   ans2 = GKZ([[1,1,1,1],[0,1,3,4]],[0,0]);
                    311:   Sweyl("x1,x2,x3,x4",[w]);
                    312:   ans2 = ReParse(ans2[0]);
                    313:   a = Sminimal(ans2);
                    314:   Println("Minimal Resolution is "); sm1_pmat(a[0]);
                    315:   b = a[0];
                    316:   /* test_if_v_strict(b,w,"x1,x2,x3,x4"); */
                    317:   return(a);
                    318: }
                    319: def test20b() {
                    320:   w = ["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1,"x1",-1,"x2",-1,"x3",-1,"x4",-1];
                    321:   ans2 = GKZ([[1,1,1,1],[0,1,3,4]],[1,2]);
                    322:   Sweyl("x1,x2,x3,x4",[w]);
                    323:   ans2 = ReParse(ans2[0]);
                    324:   a = Sminimal(ans2);
                    325:   Println("Minimal Resolution is "); sm1_pmat(a[0]);
                    326:   b = a[0];
                    327:   /* test_if_v_strict(b,w,"x1,x2,x3,x4"); */
                    328:   return(a);
                    329: }
1.13      takayama  330:
                    331: def test21() {
                    332:    a=Sannfs3("x^3-y^2*z^2+y^2+z^2");
                    333:    /* a=Sannfs3("x^3-y-z");  for debug */
                    334:    b=a[0]; w = ["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1];
                    335:    test_if_v_strict(b,w,"x,y,z");
                    336:    Println("Degree shifts of Schreyer resolution ----");
1.18    ! takayama  337:    Println(SgetShifts(Reparse(a[3]),w));
1.13      takayama  338:    return(a);
                    339: }
1.15      takayama  340: def test21b() {
1.18    ! takayama  341:   local i,j,n,sss, maxR, ttt,ans,p, euler;
1.15      takayama  342:   Println("The dimensions of linear spaces -----");
                    343:   /* sss is the SgetShifts of the Schreyer resol. */
1.18    ! takayama  344:   sss=[    [    0 ]  , [    2 , 2 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 2 , 1 , 3 , 2 ]  , [    1 , 1 , 1 , 2 , 3 , 2 , 2 , 2 , 2 , 2 , 2 , 3 , 2 , 2 , 2 , 3 , 2 , 3 , 3 , 3 , 4 , 3 , 3 , 4 , 3 , 3 , 4 , 3 , 3 , 4 , 4 , 4 , 4 , 4 , 5 , 4 , 4 , 3 , 5 , 5 , 5 , 5 , 4 ]  , [    1 , 3 , 1 , 3 , 3 , 1 , 2 , 2 , 3 , 2 , 3 , 2 , 3 , 5 , 4 , 4 , 3 , 6 , 5 , 4 , 3 , 2 , 3 , 3 , 5 , 4 , 3 , 2 , 4 , 4 , 4 , 4 , 5 , 3 , 2 , 3 , 3 , 4 , 4 , 4 , 5 , 4 , 4 , 5 , 3 , 5 , 4 , 5 , 5 , 6 ]  , [    3 , 1 , 4 , 5 , 4 , 5 , 2 , 3 , 2 , 4 , 3 , 4 , 3 , 3 , 2 , 4 , 3 , 5 , 4 , 5 , 6 ]  , [    2 , 3 ]  ] ;
        !           345:   maxR = 2; /* Maximal root of the b-function. */
1.15      takayama  346:   n = Length(sss);
1.18    ! takayama  347:   euler = 0;
1.15      takayama  348:   for (i=0; i<n; i++) {
                    349:     ttt = sss[i];
                    350:     ans = 0;
                    351:     for (j=0; j<Length(ttt); j++) {
                    352:       p = ttt[j] + maxR + 3; /* degree */
                    353:       if (p >= 0) {
                    354:         ans = ans + CancelNumber(p*(p-1)*(p-2)/(3*2*1));
                    355:         /* Add the number of monomials */
                    356:       }
                    357:     }
                    358:     Print(ans); Print(", ");
1.18    ! takayama  359:     euler = euler+(-1)^i*ans;
1.15      takayama  360:   }
                    361:   Println(" ");
1.18    ! takayama  362:   Print("Euler number is : "); Println(euler);
        !           363: }
        !           364: def test21c() {
        !           365:   local i,j,n,sss, maxR, ttt,ans,p, euler;
        !           366:   Println("The dimensions of linear spaces -----");
        !           367:   /* sss is the SgetShifts of the minimal resol. */
        !           368:   sss= [    [    0 ]  , [    2 , 2 , 2 , 2 , 2 , 2 , 2 ]  , [    1 , 2 , 2 , 2 , 2 , 3 , 4 , 4 , 4 , 4 ]  , [    1 , 3 , 4 , 6 ]  ];
        !           369:   maxR = 2; /* Maximal root of the b-function. */
        !           370:   n = Length(sss);
        !           371:   euler = 0;
        !           372:   for (i=0; i<n; i++) {
        !           373:     ttt = sss[i];
        !           374:     ans = 0;
        !           375:     for (j=0; j<Length(ttt); j++) {
        !           376:       p = ttt[j] + maxR + 3; /* degree */
        !           377:       if (p >= 0) {
        !           378:         ans = ans + CancelNumber(p*(p-1)*(p-2)/(3*2*1));
        !           379:         /* Add the number of monomials */
        !           380:       }
        !           381:     }
        !           382:     Print(ans); Print(", ");
        !           383:     euler = euler+(-1)^i*ans;
        !           384:   }
        !           385:   Println(" ");
        !           386:   Print("Euler number is : "); Println(euler);
1.15      takayama  387: }
1.13      takayama  388: def test22() {
                    389:    a=Sannfs3("x^3+y^3+z^3");
1.14      takayama  390:    b=a[0]; w = ["x",-1,"y",-2,"z",-3,"Dx",1,"Dy",2,"Dz",3];
1.13      takayama  391:    test_if_v_strict(b,w,"x,y,z");
                    392:    return(a);
                    393: }
1.16      takayama  394:
                    395: def FillFromLeft(mat,p,z) {
                    396:   local m,n,i,j,aa;
                    397:   m = Length(mat); n = Length(mat[0]);
                    398:   aa = NewMatrix(m,n+p);
                    399:   for (i=0; i<m; i++) {
                    400:     for (j=0; j<p; j++) {
                    401:       aa[i,j] = z; /* zero */
                    402:     }
                    403:     for (j=0; j<n; j++) {
                    404:       aa[i,j+p] = mat[i,j];
                    405:     }
                    406:   }
                    407:   return(aa);
                    408: }
                    409:
                    410: def FillFromRight(mat,p,z) {
                    411:   local m,n,i,j,aa;
                    412:   m = Length(mat); n = Length(mat[0]);
                    413:   aa = NewMatrix(m,n+p);
                    414:   for (i=0; i<m; i++) {
                    415:     for (j=n; j<n+p; j++) {
                    416:       aa[i,j] = z; /* zero */
                    417:     }
                    418:     for (j=0; j<n; j++) {
                    419:       aa[i,j] = mat[i,j];
                    420:     }
                    421:   }
                    422:   return(aa);
                    423: }
                    424:
                    425: def test23() {
                    426:   w = ["Dx1",1,"Dx2",1,"Dx3",1,"x1",-1,"x2",-1,"x3",-1];
                    427:   Sweyl("x1,x2,x3",[w]);
                    428:   d2 = [[Dx1^2-Dx2*h] , [-Dx1*Dx2+Dx3*h] , [Dx2^2-Dx1*Dx3] ];
                    429:   d1 = [[-Dx2, -Dx1, -h],[Dx3,Dx2,Dx1]];
                    430:   LL = x1*Dx1 + 2*x2*Dx2+3*x3*Dx3;
                    431:   /* It is exact for LL = Dx1 + 2*Dx2+3*Dx3;  */
                    432:   u1 = [[LL+4*h^2,Poly("0")],[Poly("0"),LL+5*h^2]];
                    433:   u2 = [[LL+2*h^2,Poly("0"),Poly("0")],
                    434:         [Poly("0"),LL+3*h^2,Poly("0")],
                    435:         [Poly("0"),Poly("0"),LL+4*h^2]];
                    436:   u3 = [[LL]];
                    437:   Println("Checking if it is a double complex. ");
                    438:   Println("u^2 d^2 - d^2 u^3");
                    439:   sm1_pmat(u2*d2 - d2*u3);
                    440:   Println("u^1 d^1 - d^1 u^2");
                    441:   sm1_pmat(u1*d1 - d1*u2);
                    442:   aa = [
                    443:          Join(u3,d2),
                    444:          Join(FillFromLeft(u2,1,Poly("0"))-FillFromRight(d2,3,Poly("0")),
                    445:               FillFromLeft(d1,1,Poly("0"))),
                    446:          FillFromLeft(u1,3,Poly("0"))-FillFromRight(d1,2,Poly("0"))
                    447:        ];
                    448:   Println([ aa[1]*aa[0], aa[2]*aa[1] ]);
                    449:   r= IsExact_h(aa,[x1,x2,x3]);
                    450:   Println(r);
                    451:   /* sm1_pmat(aa); */
                    452:   return(aa);
                    453: }
                    454:
                    455:
1.17      takayama  456: def test24() {
                    457:   local Res, Eqs, ww,a;
                    458:   ww = ["x",-1,"y",-1,"Dx",1,"Dy",1];
                    459:   Println("Example of V-minimal <> minimal ");
                    460:   Sweyl("x,y", [ww]);
                    461:   Eqs = [Dx-(x*Dx+y*Dy),
                    462:          Dy-(x*Dx+y*Dy)];
                    463:   sm1(" Eqs dehomogenize /Eqs set");
                    464:   Res = Sminimal(Eqs);
                    465:   Sweyl("x,y", [ww]);
                    466:   a = Reparse(Res[0]);
                    467:   sm1_pmat(a);
                    468:   Println("Initial of the complex is ");
                    469:   sm1_pmat( Sinit_w(a,ww) );
                    470:   return(Res);
                    471: }
                    472:
                    473: def test24b() {
                    474:   local Res, Eqs, ww ;
                    475:   ww = ["x",-1,"y",-1,"Dx",1,"Dy",1];
                    476:   Println("Construction of minimal ");
                    477:   Sweyl("x,y", [ww]);
                    478:   Eqs = [Dx-(x*Dx+y*Dy),
                    479:          Dy-(x*Dx+y*Dy)];
                    480:   sm1(" Eqs dehomogenize /Eqs set");
                    481:   Res = Sminimal(Eqs,["Sordinary"]);
                    482:   sm1_pmat(Res[0]);
                    483:   return(Res);
                    484: }
1.16      takayama  485:
1.18    ! takayama  486: def test25() {
        !           487:   w = ["Dx1",1,"Dx2",1,"Dx3",1,"Dx4",1,"Dx5",1,"Dx6",1,
        !           488:        "x1",-1,"x2",-1,"x3",-1,"x4",-1,"x5",-1,"x6",-1];
        !           489:   ans2 = GKZ([[1,1,1,1,1,1],
        !           490:               [0,0,0,1,1,1],
        !           491:               [0,1,0,0,1,0],
        !           492:               [0,0,1,0,0,1]],[0,0,0,0]);;
        !           493:   Sweyl("x1,x2,x3,x4,x5,x6",[w]);
        !           494:   ans2 = ReParse(ans2[0]);
        !           495:   a = Sminimal(ans2);
        !           496: }
1.16      takayama  497:
1.13      takayama  498:
1.3       takayama  499:

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