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

1.7     ! takayama    1: /* $OpenXM: OpenXM/src/k097/lib/restriction/demo.k,v 1.6 2001/01/05 11:14:29 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:
1.7     ! takayama   14: if (Boundp("NoX")) {
        !            15:   as = Asir.generate(false);
        !            16: }else{
        !            17:   as = Asir.generate();
        !            18: }
        !            19:
1.1       takayama   20: asssssir = as;
                     21: demoSendAsirCommand(as);
                     22: RingD("x,y,z,s");
                     23:
                     24: def asirBfunction(a,f) {
                     25:   local p,b;
                     26:   p = ToString(f);
                     27:   Println(p);
                     28:   b = a.rpc("mybfct",[p]);
                     29:   sm1(" b . /b set ");
                     30:   return(b);
                     31: }
                     32:
                     33: def asirAnnfsXYZ(a,f) {
                     34:   local p,b;
                     35:   RingD("x,y,z,s");  /* Fix!! See the definition of myann() */
                     36:   p = ToString(f);
                     37:   b = a.rpc("myann",[p]);
                     38:   return(b);
                     39: }
                     40:
1.3       takayama   41:
1.4       takayama   42: def asir_generic_bfct(a,ii,vv,dd,ww) {
1.3       takayama   43:    local ans;
1.4       takayama   44:    ans = a.rpc_str("mygeneric_bfct",[ii,vv,dd,ww]);
1.3       takayama   45:    return(ans);
                     46: }
1.4       takayama   47: /* a=startAsir();
                     48:    asir_generic_bfct(a,[Dx^2+Dy^2-1,Dx*Dy-4],[x,y],[Dx,Dy],[1,1]): */
                     49:
                     50: /* usage: misc/tmp/complex-ja.texi */
1.6       takayama   51: def ChangeRing(f) {
1.5       takayama   52:   local r;
                     53:   r = GetRing(f);
                     54:   if (Tag(r) == 14) {
                     55:     SetRing(r);
                     56:     return(true);
                     57:   }else{
                     58:     return(false);
1.4       takayama   59:   }
                     60: }
1.3       takayama   61:
                     62: def asir_BfRoots2(G) {
                     63:    local bb,ans,ss;
                     64:    sm1(" G flatten {dehomogenize} map /G set ");
1.6       takayama   65:    ChangeRing(G);
1.4       takayama   66:    ss = asir_generic_bfct(asssssir,G,[x,y],[Dx,Dy],[1,1]);
1.3       takayama   67:    bb = [ss];
                     68:    sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
                     69:    return([ans, bb]);
                     70: }
                     71: def asir_BfRoots3(G) {
                     72:    local bb,ans,ss;
                     73:    sm1(" G flatten {dehomogenize} map /G set ");
1.6       takayama   74:    ChangeRing(G);
1.4       takayama   75:    ss = asir_generic_bfct(asssssir,G,[x,y,z],[Dx,Dy,Dz],[1,1,1]);
1.3       takayama   76:    bb = [ss];
                     77:    sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
                     78:    return([ans, bb]);
                     79: }
                     80:
1.1       takayama   81: def findMinSol(f) {
                     82:   sm1(" f (string) dc findIntegralRoots 0 get (universalNumber) dc /FunctionValue set ");
                     83: }
                     84:
                     85: def asirAnnXYZ(a,f) {
                     86:   local p,b,b0,k1;
                     87:   RingD("x,y,z,s");  /* Fix!! See the definition of myann() */
                     88:   p = ToString(f);
                     89:   b = a.rpc("myann",[p]);
                     90:   Print("Annhilating ideal with s is "); Println(b);
                     91:   b0 = asirBfunction(a,f);
                     92:   Print("bfunction is "); Println(b0);
                     93:   k1 = findMinSol(b0);
                     94:   Print("Minimal integral root is "); Println(k1);
                     95:   sm1(" b { [[(s). k1 (string) dc .]] replace } map /b set ");
                     96:   return(b);
                     97: }
                     98:
1.2       takayama   99:
1.1       takayama  100: def nonquasi2(p,q) {
                    101:   local s,ans,f;
1.7     ! takayama  102:
        !           103:   sm1("0 set_timer "); sm1(" oxNoX ");
        !           104:   asssssir.OnTimer();
        !           105:
1.1       takayama  106:   f = x^p+y^q+x*y^(q-1);
                    107:   Print("f=");Println(f);
                    108:   s = ToString(f);
                    109:   sm1(" Onverbose ");
                    110:   ans = asirAnnfsXYZ(asssssir,f);
                    111:   sm1(" ans 0 get (ring) dc ring_def ");
                    112:   sm1("[ ans { [[(s). (-1).]] replace } map ] /II set ");
                    113:   Println("Step 1: Annhilating ideal (II)"); Println(II);
                    114:   sm1(" II 0 get { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
                    115:   Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
                    116:   pp = Map(II,"Spoly");
                    117:   Res = Sminimal(pp);
                    118:   Res0 = Res[0];
                    119:   Println("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3       takayama  120: /*  R = BfRoots1(Res0[0],"x,y"); */
                    121:   R = asir_BfRoots2(Res0[0]);
1.1       takayama  122:   Println("Step3: computing the cohomology of the truncated complex.");
                    123:   Print("Roots and b-function are "); Println(R);
                    124:   R0 = R[0];
                    125:   Ans=Srestall(Res0, ["x", "y"],  ["x", "y"], R0[Length(R0)-1]);
1.7     ! takayama  126:
        !           127:   Println("Timing data: sm1 "); sm1(" 1 set_timer ");
        !           128:   Print("     ox_asir [CPU,GC]:  ");Println(asssssir.OffTimer());
        !           129:
1.1       takayama  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;
1.7     ! takayama  145:
        !           146:   sm1("0 set_timer "); sm1(" oxNoX ");
        !           147:   asssssir.OnTimer();
        !           148:
1.2       takayama  149:   s = ToString(f);
                    150:   II = asirAnn0XYZ(asssssir,f);
                    151:   Print("Step 1: Annhilating ideal (II)"); Println(II);
                    152:   sm1(" II  { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
                    153:   Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
                    154:   pp = Map(II,"Spoly");
                    155:   Res = Sminimal(pp);
                    156:   Res0 = Res[0];
                    157:   Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3       takayama  158:   /* R = BfRoots1(Res0[0],"x,y"); */
                    159:   R = asir_BfRoots2(Res0[0]);
1.2       takayama  160:   Println("Step3: computing the cohomology of the truncated complex.");
                    161:   Print("Roots and b-function are "); Println(R);
                    162:   R0 = R[0];
                    163:   Ans=Srestall(Res0, ["x", "y"],  ["x", "y"],R0[Length(R0)-1] );
1.7     ! takayama  164:
        !           165:   Println("Timing data: sm1 "); sm1(" 1 set_timer ");
        !           166:   Print("     ox_asir [CPU,GC]:  ");Println(asssssir.OffTimer());
        !           167:
1.2       takayama  168:   Print("Answer is ");Println(Ans[0]);
                    169:   return(Ans);
                    170: }
                    171: def DeRham3WithAsir(f) {
                    172:   local s;
1.7     ! takayama  173:
        !           174:   sm1("0 set_timer "); sm1(" oxNoX ");
        !           175:   asssssir.OnTimer();
        !           176:
1.2       takayama  177:   s = ToString(f);
                    178:   II = asirAnn0XYZ(asssssir,f);
                    179:   Print("Step 1: Annhilating ideal (II)"); Println(II);
                    180:   sm1(" II  { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /II set ");
                    181:   Sweyl("x,y,z",[["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]]);
                    182:   pp = Map(II,"Spoly");
                    183:   Res = Sminimal(pp);
                    184:   Res0 = Res[0];
                    185:   Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.4       takayama  186:   /* R = BfRoots1(Res0[0],"x,y,z");  */
1.3       takayama  187:   R = asir_BfRoots3(Res0[0]);
1.2       takayama  188:   Println("Step3: computing the cohomology of the truncated complex.");
                    189:   Print("Roots and b-function are "); Println(R);
                    190:   R0 = R[0];
                    191:   Ans=Srestall(Res0, ["x", "y", "z"],  ["x", "y", "z"],R0[Length(R0)-1] );
1.7     ! takayama  192:
        !           193:   Println("Timing data: sm1 "); sm1(" 1 set_timer ");
        !           194:   Print("     ox_asir [CPU,GC]:  ");Println(asssssir.OffTimer());
        !           195:
1.2       takayama  196:   Print("Answer is ");Println(Ans[0]);
1.1       takayama  197:   return(Ans);
                    198: }
1.7     ! takayama  199:
        !           200: /*  test data
        !           201:
        !           202:    NoX=true;
        !           203:    nonquasi2(4,5);
        !           204:    nonquasi2(4,6);
        !           205:    nonquasi2(4,7);
        !           206:    nonquasi2(4,8);
        !           207:    nonquasi2(4,9);
        !           208:    nonquasi2(4,10);
        !           209:
        !           210:    nonquasi2(5,6);
        !           211:    nonquasi2(6,7);
        !           212:    nonquasi2(7,8);
        !           213:    nonquasi2(8,9);
        !           214:    nonquasi2(9,10);
        !           215: */
        !           216:
        !           217:    P2 = [
        !           218:      "x^3-y^2",
        !           219:      "y^2-x^3-x-1",
        !           220:      "y^2-x^5-x-1",
        !           221:      "y^2-x^7-x-1",
        !           222:      "y^2-x^9-x-1",
        !           223:      "y^2-x^11-x-1"
        !           224:    ];
        !           225:
        !           226:    P3 = [
        !           227:      "x^3-y^2*z^2",
        !           228:      "x^2*z+y^3+y^2*z+z^3",
        !           229:      "y*z^2+x^3+x^2*y^2+y^6",
        !           230:      "x*z^2+x^2*y+x*y^3+y^5"
        !           231:    ];
        !           232:
        !           233:
        !           234:

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