Changeset faed79 in git
- Timestamp:
- Feb 20, 2009, 10:26:50 AM (14 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 67555dbff0c54631269c2ede478103e9cd2cc3cf
- Parents:
- 9b4893753f061124557a6f764b1588a09516031e
- Location:
- Singular/LIB
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/algebra.lib
r9b4893 rfaed79 1 //syntax of nselect adopted (intvec instead of two integers), 2 //help for finitenessTest and mapIsFinite edited 3 //new proc nonZeroEntry(id), used to fix a bug in proc finitenessTest 1 4 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: algebra.lib,v 1.1 8 2008-10-24 12:16:59Singular Exp $";5 version="$Id: algebra.lib,v 1.19 2009-02-20 09:26:50 Singular Exp $"; 3 6 category="Commutative Algebra"; 4 7 info=" … … 19 22 noetherNormal(id); noether normalization of ideal id 20 23 mapIsFinite(R,phi,I); query for finiteness of map phi:R --> basering/I 24 25 AUXILIARY PROCEDURES: 21 26 finitenessTest(i,z); find variables which occur as pure power in lead(i) 27 nonZeroEntry(id); list describing non-zero entries of an identifier 22 28 "; 23 29 … … 778 784 @format 779 785 a list l of two ideals, say I,J: 780 - I defines a map (coordinate change in the basering), such that: 781 if we define map phi=basering,I; 786 - I is generated by a subset of the variables with size(I) = dim(id) 787 - J defines a map (coordinate change in the basering), such that: 788 if we define map phi=basering,J; 782 789 then k[var(1),...,var(n)]/phi(id) is finite over k[I]. 783 - J is generated by a subset of the variables with size(J) = dim(id)784 790 If p is given, 0<=p<=100, a sparse coordinate change with p percent 785 791 of the matrix entries being 0 (default: p=0 i.e. dense) … … 891 897 /////////////////////////////////////////////////////////////////////////////// 892 898 893 proc finitenessTest(ideal i, list #)899 proc finitenessTest(ideal i, list #) 894 900 "USAGE: finitenessTest(J[,v]); J ideal, v intvec (say v1,...,vr with vi>0) 895 901 RETURN: … … 906 912 THEORY: If J is a standard basis of an ideal generated by x_1 - f_1(y),..., 907 913 x_n - f_n with y_j ordered lexicographically and y_j >> x_i, then, 908 if y_i appears as pure power in the leading term of J[k] .J[k] defines914 if y_i appears as pure power in the leading term of J[k], J[k] defines 909 915 an integral relation for y_i over the y_(i+1),... and the f's. 910 916 Moreover, in this situation, if l[2] = y_1,...,y_r, then K[y_1,...y_r] 911 917 is finite over K[f_1..f_n]. If J contains furthermore polynomials 912 918 h_j(y), then K[y_1,...y_z]/<h_j> is finite over K[f_1..f_n]. 919 For a proof cf. Prop. 3.1.5, p. 214. in [G.-M. Greuel, G. Pfister: 920 A SINGULAR Introduction to Commutative Algebra, 2nd Edition, 921 Springer Verlag (2007)] 913 922 EXAMPLE: example finitenessTest; shows an example 914 923 " … … 916 925 intvec v,w; 917 926 int j,z,ii; 927 v[n]=0; //v should have size n 918 928 intvec V = 1..n; 929 list nze; //the non-zero entries of a leadexp 919 930 if (size(#) != 0 ) 920 931 { … … 929 940 ideal relation,zero,nonzero; 930 941 // ---------------------- check leading exponents ------------------------- 942 931 943 for(j=1;j<=ncols(i);j++) 932 944 { 933 w=leadexp(i[j]); 934 if(size(ideal(w))==1) //the leading term of i[j] is a 945 w = leadexp(i[j]); 946 nze = nonZeroEntry(w); 947 if( nze[1] == 1 ) //the leading term of i[j] is a 935 948 { //pure power of some variable 936 949 if( W*w != 0 ) //case: variable has index appearing in V … … 944 957 //the nonzero entries of v correspond to variables which occur as 945 958 //pure power in the leading term of some polynomial in i 959 946 960 for(j=1; j<=size(v); j++) 947 961 { … … 973 987 974 988 proc mapIsFinite(map phi, R, list #) 975 "USAGE: mapIsFinite(phi,R[,J]); R a ring, phi: R ---> basering a map 989 "USAGE: mapIsFinite(phi,R[,J]); R the preimage ring of the map 990 phi: R ---> basering 976 991 J an ideal in the basering, J = 0 if not given 977 992 RETURN: 1 if R ---> basering/J is finite and 0 else 993 NOTE: R may be a quotient ring (this will be ignored since a map R/I-->S/J 994 is finite iff the induced map R-->S/J is finite). 995 SEE ALSO: finitenessTest 978 996 EXAMPLE: example mapIsFinite; shows an example 979 997 " … … 1023 1041 ////////////////////////////////////////////////////////////////////////////// 1024 1042 1043 proc nonZeroEntry(id) 1044 "USAGE: nonZeroEntry(id); id=object for which the test 'id[i]!=0', i=1,..,N, 1045 N=size(id) (resp. ncols(id) for id of type ideal or module) 1046 is defined (e.g. ideal, vector, list of polynomials, intvec,...) 1047 RETURN: @format 1048 a list, say l, with l[1] an integer, l[2], l[3] integer vectors: 1049 - l[1] number of non-zero entries of id 1050 - l[2] intvec of size l[1] with l[2][i]=i if id[i] != 0 1051 in case l[1]!=0 (and l[2]=0 if l[1]=0) 1052 - l[3] intvec with l[3][i]=1 if id[i]!=0 and l[3][i]=0 else 1053 @end format 1054 NOTE: 1055 EXAMPLE: example nonZeroEntry; shows an example 1056 " 1057 { 1058 int ii,jj,N,n; 1059 intvec v,V; 1060 1061 if ( typeof(id) == "ideal" || typeof(id) == "module" ) 1062 { 1063 N = ncols(id); 1064 } 1065 else 1066 { 1067 N = size(id); 1068 } 1069 for ( ii=1; ii<=N; ii++ ) 1070 { 1071 V[ii] = 0; 1072 if ( id[ii] != 0 ) 1073 { 1074 n++; 1075 v=v,ii; //the first entry of v is always 0 1076 V[ii] = 1; 1077 } 1078 } 1079 if ( size(v) > 1 ) //if id[ii] != 0 for at least one ii delete the first 0 1080 { 1081 v = v[2..size(v)]; 1082 } 1083 1084 list l = n,v,V; 1085 return(l); 1086 } 1087 example 1088 { "EXAMPLE:"; echo = 2; 1089 ring r = 0,(a,b,c),dp; 1090 poly f = a3c+b3+c2+a; 1091 intvec v = leadexp(f); 1092 nonZeroEntry(v); 1093 1094 intvec w; 1095 list L = 37,0,f,v,w; 1096 nonZeroEntry(L); 1097 } 1098 ////////////////////////////////////////////////////////////////////////////// 1099 -
Singular/LIB/presolve.lib
r9b4893 rfaed79 1 //last change: 13.02.2001 (Eric Westenberger) 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: presolve.lib,v 1.27 2006-12-18 18:37:04 Singular Exp $"; 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: presolve.lib,v 1.28 2009-02-20 09:26:50 Singular Exp $"; 4 3 category="Symbolic-numerical solving"; 5 4 info=" … … 8 7 9 8 PROCEDURES: 10 degreepart(id,d1,d2); elements of id of total degree >= d1 and <= d2 9 degreepart(id,d1,d2); elements of id of total degree >= d1 and <= d2, and rest 11 10 elimlinearpart(id); linear part eliminated from id 12 11 elimpart(id[,n]); partial elimination of vars [among first n vars] … … 18 17 tolessvars(id[,]); maps id to new basering having only vars occuring in id 19 18 solvelinearpart(id); reduced std-basis of linear part of id 20 sortandmap(id[..]); map to new basering with vars sorted w.r.t. complexity19 sortandmap(id[..]); map to new basering with vars sorted w.r.t. complexity 21 20 sortvars(id[n1,p1..]); sort vars w.r.t. complexity in id [different blocks] 22 21 valvars(id[..]); valuation of vars w.r.t. to their complexity in id … … 89 88 proc degreepart (id,int d1,int d2,list #) 90 89 "USAGE: degreepart(id,d1,d2[,v]); id=ideal/module, d1,d1=integers, v=intvec 91 RETURN: generators of id of [v-weighted] total degree >= d1 and <= d2 92 (default: v = 1,...,1) 90 RETURN: list of size 2, 91 _[1]: generators of id of [v-weighted] total degree >= d1 and <= d2 92 (default: v = 1,...,1) 93 _[2]: remaining generators of id 93 94 EXAMPLE: example degreepart; shows an example 94 95 " 95 96 { 96 def dpart = id; 97 int s,ii = size(id),0; 97 if( typeof(id)=="int" or typeof(id)=="number" or typeof(id)=="ideal" ) 98 { 99 ideal dpart = ideal(id); 100 } 101 if( typeof(id)=="intmat" or typeof(id)=="matrix" or typeof(id)=="module") 102 { 103 module dpart = module(id); 104 } 105 106 def epart = dpart; 107 int s,ii = ncols(id),0; 98 108 if ( size(#)==0 ) 99 109 { 110 for ( ii=1; ii<=s; ii++ ) 111 { 112 dpart[ii] = (jet(id[ii],d1-1)==0)*(id[ii]==jet(id[ii],d2))*id[ii]; 113 epart[ii] = (size(dpart[ii])==0) * id[ii]; 114 } 115 } 116 else 117 { 100 118 for ( ii=1; ii<=s; ii=ii+1 ) 101 119 { 102 dpart[ii] = (jet(id[ii],d1-1)==0)*(id[ii]==jet(id[ii],d2))*id[ii]; 103 } 104 } 105 else 106 { 107 for ( ii=1; ii<=s; ii=ii+1 ) 108 { 109 dpart[ii]=(jet(id[ii],d1-1,#[1])==0)*(id[ii]==jet(id[ii],d2,#[1]))*id[ii]; 110 } 111 } 112 return(simplify(dpart,2)); 120 dpart[ii]=(jet(id[ii],d1-1,#[1])==0)*(id[ii]==jet(id[ii],d2,#[1]))*id[ii]; 121 epart[ii] = (size(dpart[ii])==0)*id[ii]; 122 } 123 } 124 list L = simplify(dpart,2),simplify(epart,2); 125 return(L); 113 126 } 114 127 example … … 117 130 ideal i=1+x+x2+x3+x4,3,xz+y3+z8; 118 131 degreepart(i,0,4); 132 119 133 module m=[x,y,z],x*[x3,y2,z],[1,x2,z3,0,1]; 120 134 intvec v=2,3,6; 121 135 show(degreepart(m,8,8,v)); 136 } 137 /////////////////////////////////////////////////////////////////////////////// 138 139 proc linearpart (id) 140 "USAGE: linearpart(id); id=ideal/module 141 RETURN: list of size 2, 142 _[1]: generators of id of total degree <= 1 143 _[2]: remaining generators of id 144 EXAMPLE: example linearpart; shows an example 145 " 146 { 147 return(degreepart(id,0,1)); 148 } 149 example 150 { "EXAMPLE:"; echo = 2; 151 ring r=0,(x,y,z),dp; 152 ideal i=1+x+x2+x3,3,x+3y+5z; 153 linearpart(i); 154 155 module m=[x,y,z],x*[x3,y2,z],[1,x2,z3,0,1]; 156 show(linearpart(m)); 122 157 } 123 158 /////////////////////////////////////////////////////////////////////////////// … … 128 163 RETURN: list L with 5 entries: 129 164 @format 130 L[1]: (interreduced) ideal obtained from i by substituing131 from the first n variables those, which appear in a linear part132 of i, by putting this part into triangularform165 L[1]: ideal obtained from i by substituting from the first n variables those 166 which appear in a linear part of i, by putting this part into triangular 167 form 133 168 L[2]: ideal of variables which have been substituted 134 169 L[3]: ideal, j-th element defines substitution of j-th var in [2] … … 137 172 L[1] is the image of i 138 173 @end format 139 NOTE: the procedure does always interreducethe ideal i internally w.r.t.174 NOTE: the procedure always interreduces the ideal i internally w.r.t. 140 175 ordering dp. 141 176 EXAMPLE: example elimlinearpart; shows an example 142 177 " 143 178 { 144 int ii,n, fi,k;179 int ii,n,k; 145 180 string o, newo; 146 181 intvec getoption = option(get); 147 182 option(redSB); 148 def P = basering; 149 n = nvars(P); 150 //--------------- replace ordering by dp-ordering if necessary ---------------- 151 o = "dp("+string(n)+")"; 152 fi = find(ordstr(P),o); 153 if( fi == 0 or find(ordstr(P),"a") != 0 ) 154 { 155 execute("ring newP = ("+charstr(P)+"),("+varstr(P)+"),dp;"); 156 ideal i = imap(P,i); 157 } 183 def BAS = basering; 184 n = nvars(BAS); 185 list gnirlist = ringlist(basering); 186 list g3 = gnirlist[3]; 187 list g32 = g3[size(g3)]; 188 158 189 //---------------------------------- start ------------------------------------ 159 190 if ( size(#)!=0 ) { n=#[1]; } 160 191 ideal maxi,rest = maxideal(1),0; 161 if ( n < nvars(P) ) { rest = maxi[n+1..nvars(P)]; } 192 if ( n < nvars(BAS) ) 193 { 194 rest = maxi[n+1..nvars(BAS)]; 195 } 162 196 attrib(rest,"isSB",1); 163 //-------------------- interreduce and find linear part ---------------------- 164 // interred does the only real work. Because of ordering dp the linear part is 165 // within the first elements after interreduction 166 // **: perhaps Bareiss to constant matrix of linear part instead of interred, 167 // and/or for big systems, interred only those generators of id 197 198 //-------------------- find linear part and reduce rest ---------------------- 199 // Perhaps for big systems, check only those generators of id 168 200 // which do not contain elements not to be eliminated 169 201 170 ideal id = interred(i); 171 172 if(id[1] == 1 ) //special case of unit ideal 173 { 174 setring P; 202 //ideal id = interred(i); 203 //## gmg, gendert 9/2008: interred sehr lange z.B. bei Leonard1 in normal, 204 //daher interred ersetzt durch: std nur auf linearpart angewendet 205 //Ordnung muss global sein, sonst egal (da Lin affin linear) 206 207 //--------------- replace ordering by dp if it is not global ----------------- 208 if ( ord_test(BAS) <= 0 ) 209 { 210 intvec V; 211 V[n]=0; V=V+1; //weights for dp ordering 212 gnirlist[3] = list("dp",V), g32; 213 def newBAS = ring(gnirlist); //change of ring to dp ordering 214 setring newBAS; 215 ideal i = imap(BAS,i); 216 } 217 218 list Lin = linearpart(i); 219 ideal lin = std(Lin[1]); //SB of ideal generated by polys of i 220 //having at most degree 1 221 ideal id = Lin[2]; //remaining polys from i, of deg > 1 222 id = simplify(NF(id,lin),2); //instead of subst 223 ideal id1 = linearpart(id)[1]; 224 while( size(id1) != 0 ) //repeat to find linear parts 225 { 226 lin = lin,id1; 227 lin = std(lin); 228 id = simplify(NF(id,lin),2); //instead of subst 229 id1 = linearpart(id)[1]; 230 } 231 //------------- check for special case of unit ideal and return --------------- 232 int check; 233 if( lin[1] == 1 ) 234 { 235 check = 1; 236 } 237 else 238 { 239 for (ii=1; ii<=size(id); ii++ ) 240 { 241 if ( id[ii] == 1 ) 242 { 243 check = 1; break; 244 } 245 } 246 } 247 248 if (check == 1) //case of a unit ideal 249 { 250 setring BAS; 175 251 list L = ideal(1), ideal(0), ideal(0), maxideal(1), maxideal(1); 176 252 option(set,getoption); 177 253 return(L); 178 254 } 179 180 for ( ii=1; ii<=size(id); ii++ )181 {182 if( deg(id[ii]) > 1) { break; }183 k=ii;184 }185 if( k == 0 ) { ideal lin; }186 else { ideal lin = id[1..k];}187 if( k < size(id) ) { id = id[k+1..size(id)]; }188 else { id = 0; }189 255 //----- remove generators from lin containing vars not to be eliminated ------ 190 if ( n < nvars( P) )256 if ( n < nvars(BAS) ) 191 257 { 192 258 for ( ii=1; ii<=size(lin); ii++ ) … … 199 265 } 200 266 } 201 lin = simplify(lin,3); 202 attrib(lin,"isSB",1); 203 ideal eva = lead(lin); 267 lin = simplify(lin,1); 268 ideal eva = lead(lin); //vars to be eliminated 204 269 attrib(eva,"isSB",1); 205 ideal neva = reduce(maxideal(1),eva);270 ideal neva = NF(maxideal(1),eva); //vars not to be eliminated 206 271 //------------------ go back to original ring end return --------------------- 207 if( fi == 0 or find(ordstr(P),"a") != 0 ) 208 { 209 setring P; 210 ideal id = imap(newP,id); 211 ideal eva = imap(newP,eva); 212 ideal lin = imap(newP,lin); 213 ideal neva = imap(newP,neva); 272 273 if ( ord_test(BAS) <= 0 ) //i.e there was a ring change 274 { 275 setring BAS; 276 ideal id = imap(newBAS,id); 277 ideal eva = imap(newBAS,eva); 278 ideal lin = imap(newBAS,lin); 279 ideal neva = imap(newBAS,neva); 214 280 } 215 281 216 282 eva = eva[ncols(eva)..1]; // sorting according to variables in basering 217 283 lin = lin[ncols(lin)..1]; 218 ideal phi = neva;284 ideal phi = neva; 219 285 k = 1; 220 286 for( ii=1; ii<=n; ii++ ) … … 226 292 } 227 293 } 294 228 295 list L = id, eva, lin, neva, phi; 229 296 option(set,getoption); … … 232 299 example 233 300 { "EXAMPLE:"; echo = 2; 234 ring s=0,(x,y,z),dp; 235 ideal i = x3+y2+z,x2y2+z3,y+z+1; 236 elimlinearpart(i); 237 } 238 /////////////////////////////////////////////////////////////////////////////// 239 301 ring s=0,(u,x,y,z),dp; 302 ideal i = u3+y3+z-x,x2y2+z3,y+z+1,y+u; 303 elimlinearpart(i); 304 } 305 /////////////////////////////////////////////////////////////////////////////// 240 306 proc elimpart (ideal i,list #) 241 307 "USAGE: elimpart(i [,n,e] ); i=ideal, n,e=integers … … 260 326 k[x(1..m)]/i -> k[..variables from [4]..]/[1] 261 327 @end format 262 NOTE: If the basering has ordering (c,dp), this is faster for big ideals,263 since it avoids internal ring change and mapping.328 NOTE: Applying elimpart to interred(i) may result in more sbstitutions. 329 However, interred may be more expansive than elimpart for big ideals 264 330 EXAMPLE: example elimpart; shows an example 265 331 " 266 332 { 267 def P= basering;268 int n,e = nvars( P),1;333 def BAS = basering; 334 int n,e = nvars(BAS),1; 269 335 if ( size(#)==1 ) { n=#[1]; } 270 336 if ( size(#)==2 ) { n=#[1]; e=#[2];} 271 337 //----------- interreduce linear part with proc elimlinearpart ---------------- 272 // lin = ideal after interreduction oflinear part338 // lin = ideal i after interreduction with linear part 273 339 // eva = eliminated (substituted) variables 274 340 // sub = polynomials defining substitution 275 341 // neva= not eliminated variables 276 342 // phi = map describing substitution 343 277 344 list L = elimlinearpart(i,n); 278 345 ideal lin, eva, sub, neva, phi = L[1], L[2], L[3], L[4], L[5]; 346 if ( e == 0 ) 347 { 348 return(L); 349 } 279 350 //-------- direct substitution of variables if possible and if e!=0 ----------- 280 // first find terms lin1 of pure degree 1 in each poly of lin 281 // k1 = pure degree 1 part, k1+k2 = those polys of lin which contained a pure 351 // first find terms lin1 in lin of pure degree 1 in each poly of lin 352 // k1 = pure degree 1 part, i.e. nonzero elts of lin1, renumbered 353 // k2 = lin2 (=matrix(lin) - matrix(lin2)), renumbered 354 // kin = matrix(k1)+matrix(k2) = those polys of lin which contained a pure 282 355 // degree 1 part. 283 // Then go to ring newP with ordering c,dp(n) and create a matrix with size(k1) 284 // colums and 2 rows, such that if [f1,f2] is a column of M then f1+f2 is one 285 // of the polys of lin containing a pure degree 1 part and f1 is this part 286 // interreduce this matrix (i.e. Gauss elimination on linear part, with rest 287 // transformed accordingly). 356 /* 357 Alte Version mit interred: 358 // Then go to ring newBAS with ordering c,dp(n) and create a matrix with 359 // size(k1) colums and 2 rows, such that if [f1,f2] is a column of M then f1+f2 360 // is one of the polys of lin containing a pure degree 1 part and f1 is this 361 // part interreduce this matrix (i.e. Gauss elimination on linear part, with 362 // rest transformed accordingly). 363 //Ist jetzt durch direkte Substitution gemacht (schneller!) 364 //Variante falls wieder interred angewendet werden soll: 365 //ideal k12 = k1,k2; 366 //matrix M = matrix(k12,2,kk); //degree 1 part is now in row 1 367 //M = interred(M); 368 //### interred zu teuer, muss nicht sein. Wenn interred angewendet 369 //werden soll, vorher in Ring mit Ordnung (c,dp) wechseln! 370 //Abfrage: if( ordstr(BAS) != "c,dp("+string(n)+")" ) 371 //auf KEINEN Fall std (wird zu gross) 372 //l = ncols(M); 373 //k1 = M[1,1..l]; 374 //k2 = M[2,1..l]; 375 Interred ist jetzt ganz weggelassen. Aber es gibt Beispiele wo interred polys 376 mit Grad 1 Teilen produziert, die vorher nicht da waren (aus polys, die einen konstanten Term haben). 377 z.B. i=xy2-xu4-x+y2,x2y2+z3+zy,y+z2+1,y+u2;, interred(i)=z2+y+1,y2-x,u2+y,x3-z 378 -z ergibt ich auch i[2]-z*i[3] mit option(redThrough) 379 statt interred kann man hier auch NF(i,i[3])+i[3] verwenden 380 hier lifert elimpart(i) 2 Substitutionen (x,y) elimpart(interred(i)) 381 aber 3 (x,y,z) 382 Da interred oder NF aber die Laenge der polys vergroessern kann, nicht gemacht 383 */ 288 384 int ii, kk; 289 if ( e!=0 ) 290 { 291 ideal k1,k2; 292 int l = size(lin); 293 ideal lin1 = jet(lin,1) - jet(lin,0); // part of pure degree 1 294 lin = lin - lin1; // rest, part of degree 1 substracted 295 296 for( ii=1; ii<=l; ii++ ) 297 { 298 if( lin1[ii] != 0 ) 299 { 300 kk = kk+1; 301 k1[kk] = lin1[ii]; // part of pure degree 1, renumbered 302 k2[kk] = lin[ii]; // rest of those polys which had a degree 1 part 303 lin[ii] = 0; 304 } 305 } 306 307 if( kk != 0 ) 308 { 309 if( ordstr(P) != "c,dp(n)" ) 310 { 311 execute("ring newP = ("+charstr(P)+"),("+varstr(P)+"),(c,dp);"); 312 ideal k1 = imap(P,k1); 313 ideal k2 = imap(P,k2); 314 ideal lin = imap(P,lin); 315 ideal eva = imap(P,eva); 316 ideal sub = imap(P,sub); 317 ideal neva = imap(P,neva); 318 } 319 ideal k12 = k1,k2; 320 matrix M = matrix(k12,2,kk); 321 // M = interred(M); 322 l = ncols(M); 323 k1 = M[1,1..l]; 324 k2 = M[2,1..l]; 325 ideal kin = matrix(k1)+matrix(k2); 326 lin = simplify(lin,2); 327 328 l = size(kin); 329 poly p; map phi; ideal max; 330 for ( ii=1; ii<=n; ii++ ) 385 ideal k1, k2, lin2; 386 int l = size(lin); // lin=i after applying elimlinearpart 387 ideal lin1 = jet(lin,1)-jet(lin,0); // part of pure degree 1 388 //Note: If i,i1,i2 are ideals, then i = i1 - i2 is equivalent to 389 //i = ideal(matrix(i1) - matrix(i2)) 390 391 if (size(lin1) == 0 ) 392 { 393 return(L); 394 } 395 396 //-------- check candidates for direct substitution of variables ---------- 397 //since lin1 != 0 there are candidates for substituting variables 398 399 lin2 = lin - lin1; //difference as matrix 400 // rest of lin, part of pure degree 1 substracted from each generator of lin 401 402 for( ii=1; ii<=l; ii++ ) 403 { 404 if( lin1[ii] != 0 ) 405 { 406 kk = kk+1; 407 k1[kk] = lin1[ii]; // part of pure degree 1, renumbered 408 k2[kk] = lin2[ii]; // rest of those polys which had a degree 1 part 409 lin2[ii] = 0; 410 } 411 } 412 //Now each !=0 generator of lin2 contains only constant terms or terms of 413 //degree >= 2, hence lin 2 can never be used for further substitutions 414 //We have: lin = ideal(matrix(k1)+matrix(k2)), lin2 415 416 ideal kin = matrix(k1)+matrix(k2); 417 //kin = polys of lin which contained a pure degree 1 part. 418 kin = simplify(kin,2); 419 l = size(kin); //l != 0 since lin1 != 0 420 poly p,kip,vip, cand; 421 int count=1; 422 while ( count != 0 ) 423 { 424 count = 0; 425 for ( ii=1; ii<=n; ii++ ) //start direct substitution of var(ii) 331 426 { 332 427 for (kk=1; kk<=l; kk++ ) 333 428 { 334 429 p = kin[kk]/var(ii); 335 if ( deg(p) == 0 ) 430 if ( deg(p) == 0 ) //this means that kin[kk]= p*var(ii) + h, 431 //with p=const and h not depending on var(ii) 336 432 { 337 eva = eva+var(ii); 433 //we look for the shortest candidate to substitute var(ii) 434 if ( cand == 0 ) 435 { 436 cand = kin[kk]; //candidate for substituting var(ii) 437 } 438 else 439 { 440 if ( size(kin[kk]) < size(cand) ) 441 { 442 cand = kin[kk]; 443 } 444 } 445 } 446 } 447 if ( cand != 0 ) 448 { 449 p = cand/var(ii); 450 kip = cand/p; //normalized poly of kin w.r.t var(ii) 451 eva = eva+var(ii); //var(ii) added to list of elimin. vars 338 452 neva[ii] = 0; 339 sub = sub+kin[kk]/p; 340 max = maxideal(1); 341 max[ii] = var(ii) - (kin[kk]/p); 342 phi = basering,max; 343 lin = phi(lin); 344 kin = simplify(phi(kin),2); 453 sub = sub+kip; //poly defining substituion 454 //## gmg: gendert 08/2008, map durch subst ersetzt 455 //(viel schneller) 456 vip = var(ii) - kip; //poly to be substituted 457 lin = subst(lin, var(ii), vip); //subst in rest 458 lin = simplify(lin,2); 459 kin = subst(kin, var(ii), vip); //subst in pure dgree 1 part 460 kin = simplify(kin,2); 345 461 l = size(kin); 346 // ii=ii+1; 347 break; 348 } 462 count = 1; 349 463 } 464 cand=0; 350 465 } 351 lin = kin+lin; 352 } 353 } 466 } 467 468 lin = kin+lin; 469 354 470 for( ii=1; ii<=size(lin); ii++ ) 355 471 { 356 472 lin[ii] = cleardenom(lin[ii]); 357 473 } 358 if( defined(newP) ) 359 { 360 setring P; 361 lin = imap(newP,lin); 362 eva = imap(newP,eva); 363 sub = imap(newP,sub); 364 neva = imap(newP,neva); 365 } 366 for( ii=1; ii<=n; ii++ ) 474 475 for( ii=1; ii<=n; ii++ ) 367 476 { 368 477 for( kk=1; kk<=size(eva); kk++ ) … … 372 481 } 373 482 } 374 map psi=P,phi; 375 ideal phi1=maxideal(1); 376 for(ii=1;ii<=size(eva);ii++){phi1=psi(phi1);} 483 map psi = BAS,phi; 484 ideal phi1 = maxideal(1); 485 for(ii=1; ii<=size(eva); ii++) 486 { 487 phi1=psi(phi1); 488 } 377 489 L = lin, eva, sub, neva, phi1; 378 return(L); 379 } 380 example 381 { "EXAMPLE:"; echo = 2; 382 ring s=0,(x,y,z),dp; 383 ideal i =x2+y2,x2+y+1; 384 elimpart(i,3,0); 385 elimpart(i,3,1); 490 return(L); 491 } 492 example 493 { "EXAMPLE:"; echo = 2; 494 ring s=0,(u,x,y,z),dp; 495 ideal i = xy2-xu4-x+y2,x2y2+z3+zy,y+z2+1,y+u2; 496 elimpart(i); 497 498 i = interred(i); i; 499 elimpart(i); 500 501 elimpart(i,2); 386 502 } 387 503 … … 785 901 /////////////////////////////////////////////////////////////////////////////// 786 902 787 proc linearpart (id)788 "USAGE: linearpart(id); id=ideal/module789 RETURN: generators of id of total degree <= 1790 EXAMPLE: example linearpart; shows an example791 "792 {793 return(degreepart(id,0,1));794 }795 example796 { "EXAMPLE:"; echo = 2;797 ring r=0,(x,y,z),dp;798 ideal i=1+x+x2+x3,3,x+3y+5z;799 linearpart(i);800 module m=[x,y,z],x*[x3,y2,z],[1,x2,z3,0,1];801 show(linearpart(m));802 }803 ///////////////////////////////////////////////////////////////////////////////804 805 903 proc tolessvars (id ,list #) 806 904 "USAGE: tolessvars(id [,s1,s2] ); id poly/ideal/vector/module/matrix, … … 889 987 if(#[1]!=0) { option(noredSB); } 890 988 } 891 def lin = interred(degreepart(id,0,1) );989 def lin = interred(degreepart(id,0,1)[1]); 892 990 if ( size(#)!=0 ) 893 991 {
Note: See TracChangeset
for help on using the changeset viewer.