Annotation of OpenXM/src/k097/lib/restriction/deRham.k, Revision 1.1
1.1 ! takayama 1: /* $OpenXM$ */
! 2:
! 3: /*
! 4: Require: restriction.k, ox.k
! 5:
! 6: generic_bfct(ii,vv,dd,ww);
! 7: ex.
! 8: RingD("x,y");
! 9: generic_bfct([Dx^2+Dy^2-1,Dx*Dy-4],[x,y],[Dx,Dy],[1,1]):/
! 10: DeRham2(f);
! 11: DeRham3(f);
! 12: */
! 13:
! 14: def demoSendAsirCommand(a) {
! 15: a.executeString("load(\"bfct\");");
! 16: 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])); }; ");
! 17: 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])); }; ");
! 18: a.executeString(" def mybfct(F) { return(rtostr(bfct(eval_str(F)))); }; ");
! 19: a.executeString(" def mygeneric_bfct(F,VV,DD,WW) { print([F,VV,DD,WW]); return(generic_bfct(F,VV,DD,WW));}; ");
! 20: }
! 21:
! 22: if (Boundp("NoX")) {
! 23: as = Asir.generate(false);
! 24: }else{
! 25: as = Asir.generate();
! 26: }
! 27:
! 28: def demoReduction(v) {
! 29: if (v == true) {
! 30: sm1(" [(Verbose) 1] system_variable [(DebugReductionRed) 1] system_variable Onverbose ");
! 31: }else{
! 32: sm1(" [(Verbose) 0] system_variable [(DebugReductionRed) 0] system_variable Offverbose ");
! 33: }
! 34: }
! 35:
! 36: asssssir = as;
! 37: demoSendAsirCommand(as);
! 38: RingD("x,y,z,s");
! 39:
! 40: def asirBfunction(a,f) {
! 41: local p,b;
! 42: p = ToString(f);
! 43: Println(p);
! 44: b = a.rpc("mybfct",[p]);
! 45: sm1(" b . /b set ");
! 46: return(b);
! 47: }
! 48:
! 49: def asirAnnfsXYZ(a,f) {
! 50: local p,b;
! 51: RingD("x,y,z,s"); /* Fix!! See the definition of myann() */
! 52: p = ToString(f);
! 53: b = a.rpc("myann",[p]);
! 54: return(b);
! 55: }
! 56:
! 57:
! 58: def asir_generic_bfct(a,ii,vv,dd,ww) {
! 59: local ans;
! 60: ans = a.rpc_str("mygeneric_bfct",[ii,vv,dd,ww]);
! 61: return(ans);
! 62: }
! 63: /* a=startAsir();
! 64: asir_generic_bfct(a,[Dx^2+Dy^2-1,Dx*Dy-4],[x,y],[Dx,Dy],[1,1]): */
! 65:
! 66: def generic_bfct(ii,vv,dd,ww) {
! 67: local ans;
! 68: ans =asir_generic_bfct(asssssir,ii,vv,dd,ww);
! 69: return(ans);
! 70: }
! 71:
! 72: /* usage: misc/tmp/complex-ja.texi */
! 73: def ChangeRing(f) {
! 74: local r;
! 75: r = GetRing(f);
! 76: if (Tag(r) == 14) {
! 77: SetRing(r);
! 78: return(true);
! 79: }else{
! 80: return(false);
! 81: }
! 82: }
! 83:
! 84: def asir_BfRoots2(G) {
! 85: local bb,ans,ss;
! 86: sm1(" G flatten {dehomogenize} map /G set ");
! 87: ChangeRing(G);
! 88: ss = asir_generic_bfct(asssssir,G,[x,y],[Dx,Dy],[1,1]);
! 89: bb = [ss];
! 90: sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
! 91: return([ans, bb]);
! 92: }
! 93: def asir_BfRoots3(G) {
! 94: local bb,ans,ss;
! 95: sm1(" G flatten {dehomogenize} map /G set ");
! 96: ChangeRing(G);
! 97: ss = asir_generic_bfct(asssssir,G,[x,y,z],[Dx,Dy,Dz],[1,1,1]);
! 98: bb = [ss];
! 99: sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
! 100: return([ans, bb]);
! 101: }
! 102:
! 103: def asir_BfRoots4(G) {
! 104: local bb,ans,ss;
! 105: sm1(" G flatten {dehomogenize} map /G set ");
! 106: ChangeRing(G);
! 107: ss = asir_generic_bfct(asssssir,G,[x,y,z,vv],[Dx,Dy,Dz,Dvv],[0,0,0,1]);
! 108: bb = [ss];
! 109: sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
! 110: return([ans, bb]);
! 111: }
! 112:
! 113: def findMinSol(f) {
! 114: sm1(" f (string) dc findIntegralRoots 0 get (universalNumber) dc /FunctionValue set ");
! 115: }
! 116:
! 117: def asirAnnXYZ(a,f) {
! 118: local p,b,b0,k1;
! 119: RingD("x,y,z,s"); /* Fix!! See the definition of myann() */
! 120: p = ToString(f);
! 121: b = a.rpc("myann",[p]);
! 122: Print("Annhilating ideal with s is "); Println(b);
! 123: b0 = asirBfunction(a,f);
! 124: Print("bfunction is "); Println(b0);
! 125: k1 = findMinSol(b0);
! 126: Print("Minimal integral root is "); Println(k1);
! 127: sm1(" b { [[(s). k1 (string) dc .]] replace } map /b set ");
! 128: return(b);
! 129: }
! 130:
! 131:
! 132: def nonquasi2(p,q) {
! 133: local s,ans,f;
! 134:
! 135: sm1("0 set_timer "); sm1(" oxNoX ");
! 136: asssssir.OnTimer();
! 137:
! 138: f = x^p+y^q+x*y^(q-1);
! 139: Print("f=");Println(f);
! 140: s = ToString(f);
! 141: sm1(" Onverbose ");
! 142: ans = asirAnnfsXYZ(asssssir,f);
! 143: sm1(" ans 0 get (ring) dc ring_def ");
! 144: sm1("[ ans { [[(s). (-1).]] replace } map ] /II set ");
! 145: Println("Step 1: Annhilating ideal (II)"); Println(II);
! 146: sm1(" II 0 get { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
! 147: Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
! 148: pp = Map(II,"Spoly");
! 149: Res = Sminimal(pp);
! 150: Res0 = Res[0];
! 151: Println("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
! 152: /* R = BfRoots1(Res0[0],"x,y"); */
! 153: R = asir_BfRoots2(Res0[0]);
! 154: Println("Step3: computing the cohomology of the truncated complex.");
! 155: Print("Roots and b-function are "); Println(R);
! 156: R0 = R[0];
! 157: Ans=Srestall(Res0, ["x", "y"], ["x", "y"], R0[Length(R0)-1]);
! 158:
! 159: Println("Timing data: sm1 "); sm1(" 1 set_timer ");
! 160: Print(" ox_asir [CPU,GC]: ");Println(asssssir.OffTimer());
! 161:
! 162: Print("Answer is "); Println(Ans[0]);
! 163: return(Ans);
! 164: }
! 165:
! 166: def asirAnn0XYZ(a,f) {
! 167: local p,b,b0;
! 168: RingD("x,y,z,s"); /* Fix!! See the definition of myann() */
! 169: p = ToString(f);
! 170: b = a.rpc("myann0",[p]);
! 171: Print("Annhilating ideal of f^r is "); Println(b);
! 172: return(b);
! 173: }
! 174:
! 175:
! 176: def DeRham2(f) {
! 177: local s;
! 178:
! 179: sm1("0 set_timer "); sm1(" oxNoX ");
! 180: asssssir.OnTimer();
! 181:
! 182: s = ToString(f);
! 183: II = asirAnn0XYZ(asssssir,f);
! 184: Print("Step 1: Annhilating ideal (II)"); Println(II);
! 185: sm1(" II { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
! 186: Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
! 187: pp = Map(II,"Spoly");
! 188: Res = Sminimal(pp);
! 189: Res0 = Res[0];
! 190: Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
! 191: /* R = BfRoots1(Res0[0],"x,y"); */
! 192: R = asir_BfRoots2(Res0[0]);
! 193: Println("Step3: computing the cohomology of the truncated complex.");
! 194: Print("Roots and b-function are "); Println(R);
! 195: R0 = R[0];
! 196: Ans=Srestall(Res0, ["x", "y"], ["x", "y"],R0[Length(R0)-1] );
! 197:
! 198: Println("Timing data: sm1 "); sm1(" 1 set_timer ");
! 199: Print(" ox_asir [CPU,GC]: ");Println(asssssir.OffTimer());
! 200:
! 201: Print("Answer is ");Println(Ans[0]);
! 202: return(Ans);
! 203: }
! 204: def DeRham3(f) {
! 205: local s;
! 206:
! 207: sm1("0 set_timer "); sm1(" oxNoX ");
! 208: asssssir.OnTimer();
! 209:
! 210: s = ToString(f);
! 211: II = asirAnn0XYZ(asssssir,f);
! 212: Print("Step 1: Annhilating ideal (II)"); Println(II);
! 213: sm1(" II { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /II set ");
! 214: Sweyl("x,y,z",[["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]]);
! 215: pp = Map(II,"Spoly");
! 216: Res = Sminimal(pp);
! 217: Res0 = Res[0];
! 218: Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
! 219: /* R = BfRoots1(Res0[0],"x,y,z"); */
! 220: R = asir_BfRoots3(Res0[0]);
! 221: Println("Step3: computing the cohomology of the truncated complex.");
! 222: Print("Roots and b-function are "); Println(R);
! 223: R0 = R[0];
! 224: Ans=Srestall(Res0, ["x", "y", "z"], ["x", "y", "z"],R0[Length(R0)-1] );
! 225:
! 226: Println("Timing data: sm1 "); sm1(" 1 set_timer ");
! 227: Print(" ox_asir [CPU,GC]: ");Println(asssssir.OffTimer());
! 228:
! 229: Print("Answer is ");Println(Ans[0]);
! 230: return(Ans);
! 231: }
! 232:
! 233:
! 234: /* test data
! 235:
! 236: NoX=true;
! 237: nonquasi2(4,5);
! 238: nonquasi2(4,6);
! 239: nonquasi2(4,7);
! 240: nonquasi2(4,8);
! 241: nonquasi2(4,9);
! 242: nonquasi2(4,10);
! 243:
! 244: nonquasi2(5,6);
! 245: nonquasi2(6,7);
! 246: nonquasi2(7,8);
! 247: nonquasi2(8,9);
! 248: nonquasi2(9,10);
! 249: */
! 250:
! 251: P2 = [
! 252: "x^3-y^2",
! 253: "y^2-x^3-x-1",
! 254: "y^2-x^5-x-1",
! 255: "y^2-x^7-x-1",
! 256: "y^2-x^9-x-1",
! 257: "y^2-x^11-x-1"
! 258: ];
! 259:
! 260: P3 = [
! 261: "x^3-y^2*z^2",
! 262: "x^2*z+y^3+y^2*z+z^3",
! 263: "y*z^2+x^3+x^2*y^2+y^6",
! 264: "x*z^2+x^2*y+x*y^3+y^5"
! 265: ];
! 266:
! 267:
! 268: def diff_tmp(ff,xx) {
! 269: local g;
! 270: g = xx*ff;
! 271: return( Replace(g,[[xx,Poly("0")],[h,Poly("1")]]));
! 272: }
! 273:
! 274: def Localize3WithAsir(I,f) {
! 275: local s;
! 276:
! 277: sm1("0 set_timer "); sm1(" oxNoX ");
! 278: asssssir.OnTimer();
! 279:
! 280: RingD("x,y,z,vv");
! 281: /* BUG: use of RingD("x,y,z,v") causes an expected error.
! 282: [x2,x3,x4,x4] in mygeneric_bfct. (should be [x2,x3,x4,x5]).
! 283: */
! 284: f = ReParse(f);
! 285: I = ReParse(I);
! 286: /* Test data. */
! 287: /*
! 288: f = x^3-y^2*z^2;
! 289: I = [f^2*Dx-3*x^2, f^2*Dy-2*y*z^2, f^2*Dz-2*y^2*z];
! 290:
! 291: f = x^3-y^2;
! 292: I = [f^2*Dx-diff_tmp(f,Dx), f^2*Dy-diff_tmp(f,Dy), Dz];
! 293: */
! 294:
! 295: r1 = Dx-vv^2*diff_tmp(f,Dx)*Dvv;
! 296: r2 = Dy-vv^2*diff_tmp(f,Dy)*Dvv;
! 297: r3 = Dz-vv^2*diff_tmp(f,Dz)*Dvv;
! 298: II = ReParse(I);
! 299: sm1(" II { [[(Dx). r1] [(Dy). r2] [(Dz). r3]] replace } map dehomogenize /II set ");
! 300:
! 301: Print("Step 1: phi(J)"); Println(II);
! 302: II = Join(II,[vv*f-1]);
! 303: Print("Step 2: <phi(J),vf-1>"); Println(II);
! 304:
! 305: Println("Step3: computing the integral.");
! 306: sm1(" II { [(x) (y) (z) (vv) (Dx) (Dy) (Dz) (Dvv)] laplace0 } map /JJ set ");
! 307: Sweyl("x,y,z,vv",[["vv",-1,"Dvv",1]]);
! 308: pp = Map(JJ,"Spoly");
! 309: R = asir_BfRoots4(pp);
! 310: Print("Roots and b-function are "); Println(R);
! 311:
! 312: R0 = R[0];
! 313: k1 = R0[Length(R0)-1];
! 314: sm1(" [(parse) (intw.sm1) pushfile] extension /intw.verbose 1 def ");
! 315: sm1(" [II [(vv) (x) (y) (z)] [(vv) -1 (Dvv) 1] k1 (integer) dc] integral-k1 /Ans set ");
! 316:
! 317: Println("Timing data: sm1 "); sm1(" 1 set_timer ");
! 318: Print(" ox_asir [CPU,GC]: ");Println(asssssir.OffTimer());
! 319:
! 320: Print("Answer is ");Println(Ans);
! 321: return(Ans);
! 322: }
! 323:
! 324:
! 325: def Ltest2() {
! 326: RingD("x,y,z");
! 327: f = x^3-y^2;
! 328: I = [f^2*Dx-diff_tmp(f,Dx), f^2*Dy-diff_tmp(f,Dy), Dz];
! 329: return( Localize3WithAsir(I,f) );
! 330: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>