[BACK]Return to demo.k CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097 / lib / restriction

Annotation of OpenXM/src/k097/lib/restriction/demo.k, Revision 1.4

1.4     ! takayama    1: /* $OpenXM: OpenXM/src/k097/lib/restriction/demo.k,v 1.3 2000/12/27 08:09:27 takayama Exp $  */
1.1       takayama    2:
                      3: load["restriction.k"];;
                      4: load("../ox/ox.k");;
                      5:
                      6: def demoSendAsirCommand(a) {
                      7:   a.executeString("load(\"bfct\");");
                      8:   a.executeString(" def myann(F) { B=ann(eval_str(F)); print(B); return(map(dp_ptod,B,[hoge,x,y,z,s,hh,ee,dx,dy,dz,ds,dhh])); }; ");
1.2       takayama    9:   a.executeString(" def myann0(F) { B=ann0(eval_str(F)); print(B); return(map(dp_ptod,B[1],[hoge,x,y,z,s,hh,ee,dx,dy,dz,ds,dhh])); }; ");
1.1       takayama   10:   a.executeString(" def mybfct(F) { return(rtostr(bfct(eval_str(F)))); }; ");
1.4     ! takayama   11:   a.executeString(" def mygeneric_bfct(F,VV,DD,WW) { print([F,VV,DD,WW]); return(generic_bfct(F,VV,DD,WW));}; ");
1.1       takayama   12: }
                     13:
                     14: as = startAsir();
                     15: asssssir = as;
                     16: demoSendAsirCommand(as);
                     17: RingD("x,y,z,s");
                     18:
                     19: def asirBfunction(a,f) {
                     20:   local p,b;
                     21:   p = ToString(f);
                     22:   Println(p);
                     23:   b = a.rpc("mybfct",[p]);
                     24:   sm1(" b . /b set ");
                     25:   return(b);
                     26: }
                     27:
                     28: def asirAnnfsXYZ(a,f) {
                     29:   local p,b;
                     30:   RingD("x,y,z,s");  /* Fix!! See the definition of myann() */
                     31:   p = ToString(f);
                     32:   b = a.rpc("myann",[p]);
                     33:   return(b);
                     34: }
                     35:
1.3       takayama   36:
1.4     ! takayama   37: def asir_generic_bfct(a,ii,vv,dd,ww) {
1.3       takayama   38:    local ans;
1.4     ! takayama   39:    ans = a.rpc_str("mygeneric_bfct",[ii,vv,dd,ww]);
1.3       takayama   40:    return(ans);
                     41: }
1.4     ! takayama   42: /* a=startAsir();
        !            43:    asir_generic_bfct(a,[Dx^2+Dy^2-1,Dx*Dy-4],[x,y],[Dx,Dy],[1,1]): */
        !            44:
        !            45: /* usage: misc/tmp/complex-ja.texi */
        !            46: def changeRing(F) {
        !            47:   local n,i,f;
        !            48:   if (IsArray(F)) {
        !            49:     n = Length(F);
        !            50:     for (i=0; i<n; i++) {
        !            51:       if (IsArray(F[i])) {
        !            52:          if (changeRing(F)) return(true);
        !            53:       }else if (IsPolynomial(F[i])) {
        !            54:          if (F[i] != Poly("0")) {
        !            55:             f = F[i];
        !            56:             sm1(" f (ring) dc ring_def ");
        !            57:             return(true);
        !            58:          }
        !            59:       }
        !            60:     }
        !            61:   }else if (IsPolynomial(F)) {
        !            62:      if (F != Poly("0")) {
        !            63:         sm1(" F (ring) dc ring_def ");
        !            64:         return(true);
        !            65:      }
        !            66:   }
        !            67:   return(false);
        !            68: }
1.3       takayama   69:
                     70: def asir_BfRoots2(G) {
                     71:    local bb,ans,ss;
                     72:    sm1(" G flatten {dehomogenize} map /G set ");
1.4     ! takayama   73:    changeRing(G);
        !            74:    ss = asir_generic_bfct(asssssir,G,[x,y],[Dx,Dy],[1,1]);
1.3       takayama   75:    bb = [ss];
                     76:    sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
                     77:    return([ans, bb]);
                     78: }
                     79: def asir_BfRoots3(G) {
                     80:    local bb,ans,ss;
                     81:    sm1(" G flatten {dehomogenize} map /G set ");
1.4     ! takayama   82:    changeRing(G);
        !            83:    ss = asir_generic_bfct(asssssir,G,[x,y,z],[Dx,Dy,Dz],[1,1,1]);
1.3       takayama   84:    bb = [ss];
                     85:    sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
                     86:    return([ans, bb]);
                     87: }
                     88:
1.1       takayama   89: def findMinSol(f) {
                     90:   sm1(" f (string) dc findIntegralRoots 0 get (universalNumber) dc /FunctionValue set ");
                     91: }
                     92:
                     93: def asirAnnXYZ(a,f) {
                     94:   local p,b,b0,k1;
                     95:   RingD("x,y,z,s");  /* Fix!! See the definition of myann() */
                     96:   p = ToString(f);
                     97:   b = a.rpc("myann",[p]);
                     98:   Print("Annhilating ideal with s is "); Println(b);
                     99:   b0 = asirBfunction(a,f);
                    100:   Print("bfunction is "); Println(b0);
                    101:   k1 = findMinSol(b0);
                    102:   Print("Minimal integral root is "); Println(k1);
                    103:   sm1(" b { [[(s). k1 (string) dc .]] replace } map /b set ");
                    104:   return(b);
                    105: }
                    106:
1.2       takayama  107:
1.1       takayama  108: def nonquasi2(p,q) {
                    109:   local s,ans,f;
                    110:   f = x^p+y^q+x*y^(q-1);
                    111:   Print("f=");Println(f);
                    112:   s = ToString(f);
                    113:   sm1(" Onverbose ");
                    114:   ans = asirAnnfsXYZ(asssssir,f);
                    115:   sm1(" ans 0 get (ring) dc ring_def ");
                    116:   sm1("[ ans { [[(s). (-1).]] replace } map ] /II set ");
                    117:   Println("Step 1: Annhilating ideal (II)"); Println(II);
                    118:   sm1(" II 0 get { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
                    119:   Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
                    120:   pp = Map(II,"Spoly");
                    121:   Res = Sminimal(pp);
                    122:   Res0 = Res[0];
                    123:   Println("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3       takayama  124: /*  R = BfRoots1(Res0[0],"x,y"); */
                    125:   R = asir_BfRoots2(Res0[0]);
1.1       takayama  126:   Println("Step3: computing the cohomology of the truncated complex.");
                    127:   Print("Roots and b-function are "); Println(R);
                    128:   R0 = R[0];
                    129:   Ans=Srestall(Res0, ["x", "y"],  ["x", "y"], R0[Length(R0)-1]);
                    130:   Print("Answer is "); Println(Ans[0]);
1.2       takayama  131:   return(Ans);
                    132: }
                    133:
                    134: def asirAnn0XYZ(a,f) {
                    135:   local p,b,b0;
                    136:   RingD("x,y,z,s");  /* Fix!! See the definition of myann() */
                    137:   p = ToString(f);
                    138:   b = a.rpc("myann0",[p]);
                    139:   Print("Annhilating ideal of f^r is "); Println(b);
                    140:   return(b);
                    141: }
                    142:
                    143: def DeRham2WithAsir(f) {
                    144:   local s;
                    145:   s = ToString(f);
                    146:   II = asirAnn0XYZ(asssssir,f);
                    147:   Print("Step 1: Annhilating ideal (II)"); Println(II);
                    148:   sm1(" II  { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
                    149:   Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
                    150:   pp = Map(II,"Spoly");
                    151:   Res = Sminimal(pp);
                    152:   Res0 = Res[0];
                    153:   Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3       takayama  154:   /* R = BfRoots1(Res0[0],"x,y"); */
                    155:   R = asir_BfRoots2(Res0[0]);
1.2       takayama  156:   Println("Step3: computing the cohomology of the truncated complex.");
                    157:   Print("Roots and b-function are "); Println(R);
                    158:   R0 = R[0];
                    159:   Ans=Srestall(Res0, ["x", "y"],  ["x", "y"],R0[Length(R0)-1] );
                    160:   Print("Answer is ");Println(Ans[0]);
                    161:   return(Ans);
                    162: }
                    163: def DeRham3WithAsir(f) {
                    164:   local s;
                    165:   s = ToString(f);
                    166:   II = asirAnn0XYZ(asssssir,f);
                    167:   Print("Step 1: Annhilating ideal (II)"); Println(II);
                    168:   sm1(" II  { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /II set ");
                    169:   Sweyl("x,y,z",[["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]]);
                    170:   pp = Map(II,"Spoly");
                    171:   Res = Sminimal(pp);
                    172:   Res0 = Res[0];
                    173:   Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.4     ! takayama  174:   /* R = BfRoots1(Res0[0],"x,y,z");  */
1.3       takayama  175:   R = asir_BfRoots3(Res0[0]);
1.2       takayama  176:   Println("Step3: computing the cohomology of the truncated complex.");
                    177:   Print("Roots and b-function are "); Println(R);
                    178:   R0 = R[0];
                    179:   Ans=Srestall(Res0, ["x", "y", "z"],  ["x", "y", "z"],R0[Length(R0)-1] );
                    180:   Print("Answer is ");Println(Ans[0]);
1.1       takayama  181:   return(Ans);
                    182: }

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