[BACK]Return to oxasir.asir CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Doc

Annotation of OpenXM/src/kan96xx/Doc/oxasir.asir, Revision 1.1.1.1

1.1       maekawa     1: OxAsirDebug = 0$
                      2: OxVlist = [x,y,z]$
                      3:
                      4: def ox_ptod(F) {
                      5:   extern OxVlist;
                      6:   extern OxAsirDebug;
                      7:   if (OxAsirDebug != 0) { print(["ox_ptod:", F, OxVlist]); }
                      8:   if (type(F) == 4) return(map(ox_ptod,F));
                      9:   else if (type(F) == 2) return(dp_ptod(F,OxVlist));
                     10:   else return(F);
                     11: }
                     12:
                     13: def ox_dtop(F) {
                     14:   extern OxVlist;
                     15:   extern OxAsirDebug;
                     16:   if (OxAsirDebug != 0) { print(["ox_dtop:", F, OxVlist]); }
                     17:   if (type(F) == 4) return(map(ox_dtop,F));
                     18:   else if (type(F) == 9) return(dp_dtop(F,OxVlist));
                     19:   else return(F);
                     20: }
                     21:
                     22: /***  From gbhg3/Int/solv1.asir ***/
                     23: /* solv1.asir  1999, 1/28.
                     24:    Finding rational number roots of systems of polynomials.
                     25:    Make a substitution.
                     26: */
                     27:
                     28: def sm1_solv1a(F) {
                     29:   V = var(F);
                     30:   if (deg(F,V) != 1) return([]);
                     31:   return([V,red(-coef(F,0)/coef(F,1))]);
                     32: }
                     33:
                     34:
                     35: def sm1_solv1(L,V) {
                     36:   N = length(L);
                     37:   Ans = newvect(length(V));
                     38:   for(J=0; J<length(V); J++) {
                     39:      Ans[J] = "?";
                     40:   }
                     41:   for (I=0; I<N; I++) {
                     42:     S = sm1_solv1a(L[I]);
                     43:     if (S == []) return([]);
                     44:     for (J=0; J<length(V); J++) {
                     45:       if (V[J] == S[0]) {
                     46:         Ans[J] = S[1];
                     47:       }
                     48:     }
                     49:   }
                     50:   return(Ans);
                     51: }
                     52:
                     53: def sm1_rationalRoots(F,V) {
                     54:   F = primadec(F,V);
                     55:   print(F);
                     56:   N = length(F);
                     57:   Ans = [ ];
                     58:   for (I=0; I<N; I++) {
                     59:     P = F[I][1];  /* associated prime */
                     60:     R = sm1_solv1(P,V);
                     61:     if (R != []) {
                     62:       Ans = append(Ans,[R]);
                     63:     }
                     64:   }
                     65:   return(Ans);
                     66: }
                     67:
                     68: /* sm1_rationalRoots([x^2+y-2,x^2-1/9],[x,y]); */
                     69:
                     70: def sm1_inner00(A,B) {
                     71:   P = 0;
                     72:   for (I=0; I<size(A)[0]; I++) {
                     73:     P = P + A[I]*B[I];
                     74:   }
                     75:   return(red(P));
                     76: }
                     77:
                     78: def sm1_rationalRoots2(F,V,W) {
                     79:   print([F,V,W]);
                     80:   print(type(W[0]));
                     81:   R = sm1_rationalRoots(F,V);
                     82:   Ans = [ ];
                     83:   Ans2 = [ ];
                     84:   W = newvect(length(W),W);
                     85:   for (I=0; I<length(R); I++) {
                     86:      T = sm1_inner00(W,R[I]);
                     87:      if (dn(T) == 1) {
                     88:         Ans = append(Ans,[T]);
                     89:         Ans2 = append(Ans2,[R[I]]);
                     90:      }
                     91:   }
                     92:   print([Ans,Ans2]);
                     93:   return(Ans);
                     94: }
                     95:
                     96: /* W is a weight vector */
                     97: /* sm1_rationalRoots2([(z-3)*(z^2+z+1),x^2+y-2,x^2-1/9],[x,y,z],[9,9,1]); */
                     98:
                     99: def sm1_ptozp_subst(F,X,V) {
                    100:   /*  sm1_ptozp_subst(x*y-1,x,[1,2]);  ptozp(subst(x*y,x,1/2)) ;  */
                    101:   A=ptozp(subst(F,X,V[0]/V[1]));
                    102:   return(A);
                    103: }
                    104:
                    105: /* A =  ((1/2)*x^2+(1/4)*x+1)/((1/5)*x^4+x^8);
                    106:    B= sm1_rat2plist( A);
                    107:    print(red(A-B[0]/B[1]));
                    108: */
                    109: def sm1_rat2plist(T) {
                    110:   T = red(T);
                    111:   T1 = nm(T); T1a = ptozp(T1);
                    112:   T1b = red(T1a/T1);
                    113:   T2 = dn(T);
                    114:   return([T1a*dn(T1b),T2*nm(T1b)]);
                    115: }
                    116:
                    117: def sm1_rat2plist2(TT) {
                    118:   T = red(TT[0]/TT[1]);
                    119:   T1 = nm(T); T1a = ptozp(T1);
                    120:   T1b = red(T1a/T1);
                    121:   T2 = dn(T);
                    122:   return([T1a*dn(T1b),T2*nm(T1b)]);
                    123: }
                    124:
                    125:
                    126:
                    127:
                    128:
                    129:
                    130: end$
                    131:

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