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

1.3     ! takayama    1: /* $OpenXM: OpenXM/src/k097/lib/restriction/demo.k,v 1.2 2000/12/15 02:44:32 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)))); }; ");
                     11: }
                     12:
                     13: as = startAsir();
                     14: asssssir = as;
                     15: demoSendAsirCommand(as);
                     16: RingD("x,y,z,s");
                     17:
                     18: def asirBfunction(a,f) {
                     19:   local p,b;
                     20:   p = ToString(f);
                     21:   Println(p);
                     22:   b = a.rpc("mybfct",[p]);
                     23:   sm1(" b . /b set ");
                     24:   return(b);
                     25: }
                     26:
                     27: def asirAnnfsXYZ(a,f) {
                     28:   local p,b;
                     29:   RingD("x,y,z,s");  /* Fix!! See the definition of myann() */
                     30:   p = ToString(f);
                     31:   b = a.rpc("myann",[p]);
                     32:   return(b);
                     33: }
                     34:
1.3     ! takayama   35: def asir_rpc_old(argv_rpc_asir) {
        !            36:    sm1(" oxasir.ccc [ ] eq {
        !            37:        (Starting ox_asir server.) message
        !            38:         ox_asirConnectMethod
        !            39:         } {  } ifelse ");
        !            40:    sm1(" oxasir.ccc argv_rpc_asir asir /FunctionValue set ");
        !            41: }
        !            42: def asir_define_own_functions() {
        !            43:    asir_rpc_old(["igcd",2,3]);
        !            44:    sm1(" oxasir.ccc (def mygeneric_bfct(Id,V,DV,W)  {
        !            45:                             return( rtostr(generic_bfct(Id,V,DV,W)));
        !            46:                       })  oxsubmit ");
        !            47: }
        !            48:
        !            49: def asir_generic_bfct(ii,vv,dd,ww) {
        !            50:    local ans;
        !            51:    ans = asir_rpc_old(["mygeneric_bfct",ii,vv,dd,ww]);
        !            52:    return(ans);
        !            53: }
        !            54: /* asir_generic_bfct([Dx^2+Dy^2-1,Dx*Dy-4],[x,y],[Dx,Dy],[1,1]): */
        !            55:
        !            56: def asir_BfRoots2(G) {
        !            57:    local bb,ans,ss;
        !            58:    sm1(" G flatten {dehomogenize} map /G set ");
        !            59:    asir_define_own_functions();
        !            60:    ss = asir_generic_bfct(G,[x,y],[Dx,Dy],[1,1]);
        !            61:    bb = [ss];
        !            62:    sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
        !            63:    return([ans, bb]);
        !            64: }
        !            65: def asir_BfRoots3(G) {
        !            66:    local bb,ans,ss;
        !            67:    sm1(" G flatten {dehomogenize} map /G set ");
        !            68:    asir_define_own_functions();
        !            69:    ss = asir_generic_bfct(G,[x,y,z],[Dx,Dy,Dz],[1,1,1]);
        !            70:    bb = [ss];
        !            71:    sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
        !            72:    return([ans, bb]);
        !            73: }
        !            74:
1.1       takayama   75: def findMinSol(f) {
                     76:   sm1(" f (string) dc findIntegralRoots 0 get (universalNumber) dc /FunctionValue set ");
                     77: }
                     78:
                     79: def asirAnnXYZ(a,f) {
                     80:   local p,b,b0,k1;
                     81:   RingD("x,y,z,s");  /* Fix!! See the definition of myann() */
                     82:   p = ToString(f);
                     83:   b = a.rpc("myann",[p]);
                     84:   Print("Annhilating ideal with s is "); Println(b);
                     85:   b0 = asirBfunction(a,f);
                     86:   Print("bfunction is "); Println(b0);
                     87:   k1 = findMinSol(b0);
                     88:   Print("Minimal integral root is "); Println(k1);
                     89:   sm1(" b { [[(s). k1 (string) dc .]] replace } map /b set ");
                     90:   return(b);
                     91: }
                     92:
1.2       takayama   93:
1.1       takayama   94: def nonquasi2(p,q) {
                     95:   local s,ans,f;
                     96:   f = x^p+y^q+x*y^(q-1);
                     97:   Print("f=");Println(f);
                     98:   s = ToString(f);
                     99:   sm1(" Onverbose ");
                    100:   ans = asirAnnfsXYZ(asssssir,f);
                    101:   sm1(" ans 0 get (ring) dc ring_def ");
                    102:   sm1("[ ans { [[(s). (-1).]] replace } map ] /II set ");
                    103:   Println("Step 1: Annhilating ideal (II)"); Println(II);
                    104:   sm1(" II 0 get { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
                    105:   Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
                    106:   pp = Map(II,"Spoly");
                    107:   Res = Sminimal(pp);
                    108:   Res0 = Res[0];
                    109:   Println("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3     ! takayama  110: /*  R = BfRoots1(Res0[0],"x,y"); */
        !           111:   R = asir_BfRoots2(Res0[0]);
1.1       takayama  112:   Println("Step3: computing the cohomology of the truncated complex.");
                    113:   Print("Roots and b-function are "); Println(R);
                    114:   R0 = R[0];
                    115:   Ans=Srestall(Res0, ["x", "y"],  ["x", "y"], R0[Length(R0)-1]);
                    116:   Print("Answer is "); Println(Ans[0]);
1.2       takayama  117:   return(Ans);
                    118: }
                    119:
                    120: def asirAnn0XYZ(a,f) {
                    121:   local p,b,b0;
                    122:   RingD("x,y,z,s");  /* Fix!! See the definition of myann() */
                    123:   p = ToString(f);
                    124:   b = a.rpc("myann0",[p]);
                    125:   Print("Annhilating ideal of f^r is "); Println(b);
                    126:   return(b);
                    127: }
                    128:
                    129: def DeRham2WithAsir(f) {
                    130:   local s;
                    131:   s = ToString(f);
                    132:   II = asirAnn0XYZ(asssssir,f);
                    133:   Print("Step 1: Annhilating ideal (II)"); Println(II);
                    134:   sm1(" II  { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
                    135:   Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
                    136:   pp = Map(II,"Spoly");
                    137:   Res = Sminimal(pp);
                    138:   Res0 = Res[0];
                    139:   Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3     ! takayama  140:   /* R = BfRoots1(Res0[0],"x,y"); */
        !           141:   R = asir_BfRoots2(Res0[0]);
1.2       takayama  142:   Println("Step3: computing the cohomology of the truncated complex.");
                    143:   Print("Roots and b-function are "); Println(R);
                    144:   R0 = R[0];
                    145:   Ans=Srestall(Res0, ["x", "y"],  ["x", "y"],R0[Length(R0)-1] );
                    146:   Print("Answer is ");Println(Ans[0]);
                    147:   return(Ans);
                    148: }
                    149: def DeRham3WithAsir(f) {
                    150:   local s;
                    151:   s = ToString(f);
                    152:   II = asirAnn0XYZ(asssssir,f);
                    153:   Print("Step 1: Annhilating ideal (II)"); Println(II);
                    154:   sm1(" II  { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /II set ");
                    155:   Sweyl("x,y,z",[["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]]);
                    156:   pp = Map(II,"Spoly");
                    157:   Res = Sminimal(pp);
                    158:   Res0 = Res[0];
                    159:   Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3     ! takayama  160: /*  R = BfRoots1(Res0[0],"x,y,z"); */
        !           161:   R = asir_BfRoots3(Res0[0]);
1.2       takayama  162:   Println("Step3: computing the cohomology of the truncated complex.");
                    163:   Print("Roots and b-function are "); Println(R);
                    164:   R0 = R[0];
                    165:   Ans=Srestall(Res0, ["x", "y", "z"],  ["x", "y", "z"],R0[Length(R0)-1] );
                    166:   Print("Answer is ");Println(Ans[0]);
1.1       takayama  167:   return(Ans);
                    168: }

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