Annotation of OpenXM/src/k097/lib/restriction/demo.k, Revision 1.8
1.8 ! takayama 1: /* $OpenXM: OpenXM/src/k097/lib/restriction/demo.k,v 1.7 2001/01/26 12:24:57 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.8 ! takayama 81: def asir_BfRoots4(G) {
! 82: local bb,ans,ss;
! 83: sm1(" G flatten {dehomogenize} map /G set ");
! 84: ChangeRing(G);
! 85: ss = asir_generic_bfct(asssssir,G,[x,y,z,vv],[Dx,Dy,Dz,Dvv],[0,0,0,1]);
! 86: bb = [ss];
! 87: sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set ");
! 88: return([ans, bb]);
! 89: }
! 90:
1.1 takayama 91: def findMinSol(f) {
92: sm1(" f (string) dc findIntegralRoots 0 get (universalNumber) dc /FunctionValue set ");
93: }
94:
95: def asirAnnXYZ(a,f) {
96: local p,b,b0,k1;
97: RingD("x,y,z,s"); /* Fix!! See the definition of myann() */
98: p = ToString(f);
99: b = a.rpc("myann",[p]);
100: Print("Annhilating ideal with s is "); Println(b);
101: b0 = asirBfunction(a,f);
102: Print("bfunction is "); Println(b0);
103: k1 = findMinSol(b0);
104: Print("Minimal integral root is "); Println(k1);
105: sm1(" b { [[(s). k1 (string) dc .]] replace } map /b set ");
106: return(b);
107: }
108:
1.2 takayama 109:
1.1 takayama 110: def nonquasi2(p,q) {
111: local s,ans,f;
1.7 takayama 112:
113: sm1("0 set_timer "); sm1(" oxNoX ");
114: asssssir.OnTimer();
115:
1.1 takayama 116: f = x^p+y^q+x*y^(q-1);
117: Print("f=");Println(f);
118: s = ToString(f);
119: sm1(" Onverbose ");
120: ans = asirAnnfsXYZ(asssssir,f);
121: sm1(" ans 0 get (ring) dc ring_def ");
122: sm1("[ ans { [[(s). (-1).]] replace } map ] /II set ");
123: Println("Step 1: Annhilating ideal (II)"); Println(II);
124: sm1(" II 0 get { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
125: Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
126: pp = Map(II,"Spoly");
127: Res = Sminimal(pp);
128: Res0 = Res[0];
129: Println("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3 takayama 130: /* R = BfRoots1(Res0[0],"x,y"); */
131: R = asir_BfRoots2(Res0[0]);
1.1 takayama 132: Println("Step3: computing the cohomology of the truncated complex.");
133: Print("Roots and b-function are "); Println(R);
134: R0 = R[0];
135: Ans=Srestall(Res0, ["x", "y"], ["x", "y"], R0[Length(R0)-1]);
1.7 takayama 136:
137: Println("Timing data: sm1 "); sm1(" 1 set_timer ");
138: Print(" ox_asir [CPU,GC]: ");Println(asssssir.OffTimer());
139:
1.1 takayama 140: Print("Answer is "); Println(Ans[0]);
1.2 takayama 141: return(Ans);
142: }
143:
144: def asirAnn0XYZ(a,f) {
145: local p,b,b0;
146: RingD("x,y,z,s"); /* Fix!! See the definition of myann() */
147: p = ToString(f);
148: b = a.rpc("myann0",[p]);
149: Print("Annhilating ideal of f^r is "); Println(b);
150: return(b);
151: }
152:
153: def DeRham2WithAsir(f) {
154: local s;
1.7 takayama 155:
156: sm1("0 set_timer "); sm1(" oxNoX ");
157: asssssir.OnTimer();
158:
1.2 takayama 159: s = ToString(f);
160: II = asirAnn0XYZ(asssssir,f);
161: Print("Step 1: Annhilating ideal (II)"); Println(II);
162: sm1(" II { [(x) (y) (Dx) (Dy) ] laplace0 } map /II set ");
163: Sweyl("x,y",[["x",-1,"y",-1,"Dx",1,"Dy",1]]);
164: pp = Map(II,"Spoly");
165: Res = Sminimal(pp);
166: Res0 = Res[0];
167: Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.3 takayama 168: /* R = BfRoots1(Res0[0],"x,y"); */
169: R = asir_BfRoots2(Res0[0]);
1.2 takayama 170: Println("Step3: computing the cohomology of the truncated complex.");
171: Print("Roots and b-function are "); Println(R);
172: R0 = R[0];
173: Ans=Srestall(Res0, ["x", "y"], ["x", "y"],R0[Length(R0)-1] );
1.7 takayama 174:
175: Println("Timing data: sm1 "); sm1(" 1 set_timer ");
176: Print(" ox_asir [CPU,GC]: ");Println(asssssir.OffTimer());
177:
1.2 takayama 178: Print("Answer is ");Println(Ans[0]);
179: return(Ans);
180: }
181: def DeRham3WithAsir(f) {
182: local s;
1.7 takayama 183:
184: sm1("0 set_timer "); sm1(" oxNoX ");
185: asssssir.OnTimer();
186:
1.2 takayama 187: s = ToString(f);
188: II = asirAnn0XYZ(asssssir,f);
189: Print("Step 1: Annhilating ideal (II)"); Println(II);
190: sm1(" II { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /II set ");
191: Sweyl("x,y,z",[["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]]);
192: pp = Map(II,"Spoly");
193: Res = Sminimal(pp);
194: Res0 = Res[0];
195: Print("Step2: (-1,1)-minimal resolution (Res0) "); sm1_pmat(Res0);
1.4 takayama 196: /* R = BfRoots1(Res0[0],"x,y,z"); */
1.3 takayama 197: R = asir_BfRoots3(Res0[0]);
1.2 takayama 198: Println("Step3: computing the cohomology of the truncated complex.");
199: Print("Roots and b-function are "); Println(R);
200: R0 = R[0];
201: Ans=Srestall(Res0, ["x", "y", "z"], ["x", "y", "z"],R0[Length(R0)-1] );
1.7 takayama 202:
203: Println("Timing data: sm1 "); sm1(" 1 set_timer ");
204: Print(" ox_asir [CPU,GC]: ");Println(asssssir.OffTimer());
205:
1.2 takayama 206: Print("Answer is ");Println(Ans[0]);
1.1 takayama 207: return(Ans);
208: }
1.7 takayama 209:
210: /* test data
211:
212: NoX=true;
213: nonquasi2(4,5);
214: nonquasi2(4,6);
215: nonquasi2(4,7);
216: nonquasi2(4,8);
217: nonquasi2(4,9);
218: nonquasi2(4,10);
219:
220: nonquasi2(5,6);
221: nonquasi2(6,7);
222: nonquasi2(7,8);
223: nonquasi2(8,9);
224: nonquasi2(9,10);
225: */
226:
227: P2 = [
228: "x^3-y^2",
229: "y^2-x^3-x-1",
230: "y^2-x^5-x-1",
231: "y^2-x^7-x-1",
232: "y^2-x^9-x-1",
233: "y^2-x^11-x-1"
234: ];
235:
236: P3 = [
237: "x^3-y^2*z^2",
238: "x^2*z+y^3+y^2*z+z^3",
239: "y*z^2+x^3+x^2*y^2+y^6",
240: "x*z^2+x^2*y+x*y^3+y^5"
241: ];
242:
243:
1.8 ! takayama 244: def diff_tmp(ff,xx) {
! 245: local g;
! 246: g = xx*ff;
! 247: return( Replace(g,[[xx,Poly("0")],[h,Poly("1")]]));
! 248: }
! 249:
! 250: def Localize3WithAsir(I,f) {
! 251: local s;
1.7 takayama 252:
1.8 ! takayama 253: sm1("0 set_timer "); sm1(" oxNoX ");
! 254: asssssir.OnTimer();
! 255:
! 256: RingD("x,y,z,vv");
! 257: /* BUG: use of RingD("x,y,z,v") causes an expected error.
! 258: [x2,x3,x4,x4] in mygeneric_bfct. (should be [x2,x3,x4,x5]).
! 259: */
! 260: f = ReParse(f);
! 261: I = ReParse(I);
! 262: /* Test data. */
! 263: /*
! 264: f = x^3-y^2*z^2;
! 265: I = [f^2*Dx-3*x^2, f^2*Dy-2*y*z^2, f^2*Dz-2*y^2*z];
! 266:
! 267: f = x^3-y^2;
! 268: I = [f^2*Dx-diff_tmp(f,Dx), f^2*Dy-diff_tmp(f,Dy), Dz];
! 269: */
! 270:
! 271: r1 = Dx-vv^2*diff_tmp(f,Dx)*Dvv;
! 272: r2 = Dy-vv^2*diff_tmp(f,Dy)*Dvv;
! 273: r3 = Dz-vv^2*diff_tmp(f,Dz)*Dvv;
! 274: II = ReParse(I);
! 275: sm1(" II { [[(Dx). r1] [(Dy). r2] [(Dz). r3]] replace } map dehomogenize /II set ");
! 276:
! 277: Print("Step 1: phi(J)"); Println(II);
! 278: II = Join(II,[vv*f-1]);
! 279: Print("Step 2: <phi(J),vf-1>"); Println(II);
! 280:
! 281: Println("Step3: computing the integral.");
! 282: sm1(" II { [(x) (y) (z) (vv) (Dx) (Dy) (Dz) (Dvv)] laplace0 } map /JJ set ");
! 283: Sweyl("x,y,z,vv",[["vv",-1,"Dvv",1]]);
! 284: pp = Map(JJ,"Spoly");
! 285: R = asir_BfRoots4(pp);
! 286: Print("Roots and b-function are "); Println(R);
! 287:
! 288: R0 = R[0];
! 289: k1 = R0[Length(R0)-1];
! 290: sm1(" [(parse) (intw.sm1) pushfile] extension /intw.verbose 1 def ");
! 291: sm1(" [II [(vv) (x) (y) (z)] [(vv) -1 (Dvv) 1] k1 (integer) dc] integral-k1 /Ans set ");
! 292:
! 293: Println("Timing data: sm1 "); sm1(" 1 set_timer ");
! 294: Print(" ox_asir [CPU,GC]: ");Println(asssssir.OffTimer());
! 295:
! 296: Print("Answer is ");Println(Ans);
! 297: return(Ans);
! 298: }
! 299:
! 300:
! 301: def Ltest2() {
! 302: RingD("x,y,z");
! 303: f = x^3-y^2;
! 304: I = [f^2*Dx-diff_tmp(f,Dx), f^2*Dy-diff_tmp(f,Dy), Dz];
! 305: return( Localize3WithAsir(I,f) );
! 306: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>