Changeset 7023ce in git
- Timestamp:
- Feb 4, 2015, 10:08:19 AM (9 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- dbf60932968d7dd0d5f400c4209b39e40b442f58
- Parents:
- ca38640ca6928ad815ae7b2bd1f3516f383315af48d66afcfd578627347de972483894aa987b9f60
- Files:
-
- 11 added
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
.gdbinit
rca3864 r7023ce 1 1 break dErrorBreak 2 break omReportError3 break dPolyReportError4 2 5 3 -
Singular/LIB/JMSConst.lib
rca3864 r7023ce 947 947 poly h=Minimus(variables(A.h)); 948 948 //print(h); 949 int l=findvars(h ,1)[2][1];949 int l=findvars(h)[2][1]; 950 950 if(l!=nvars(basering)) 951 951 { -
Singular/LIB/algemodstd.lib
rca3864 r7023ce 293 293 //////////////////////////////////////////////////////////////////////////////// 294 294 295 static proc check_leadmonom_and_size(list L) 296 { 297 /* 298 * compare the size of ideals in the list and 299 * check the corresponding leading monomials 300 * size(L)>=2 301 */ 302 ideal J=L[1]; 303 int i=size(L); 304 int sc=ncols(J); 305 int j,k; 306 poly g=leadmonom(J[1]); 307 for(j=1;j<=i;j++) 308 { 309 if(ncols(L[j])!=sc) 310 { 311 return(0); 312 } 313 } 314 for(k=2;k<=i;k++) 315 { 316 for(j=1;j<=sc;j++) 317 { 318 if(leadmonom(J[j])!=leadmonom(L[k][j])) 319 { 320 return(0); 321 } 322 } 323 } 324 return(1); 325 } 326 327 //////////////////////////////////////////////////////////////////////////////// 328 295 329 static proc LiftPolyCRT(ideal I) 296 330 { … … 324 358 } 325 359 } 326 // apply CRT for polynomials 327 II =chinrempoly(Lk,LL),f; 360 if(check_leadmonom_and_size(Lk)) 361 { 362 // apply CRT for polynomials 363 II =chinrempoly(Lk,LL),f; 364 } 365 else 366 { 367 II=0; 368 } 328 369 return(II); 329 370 } -
Singular/LIB/bimodules.lib
rca3864 r7023ce 722 722 ideal J; 723 723 // determine whether I is a left Groebner basis 724 if (attrib(I,"isSB") == 1)724 if (attrib(I,"isSB")) 725 725 { 726 726 J = I; -
Singular/LIB/dmodvar.lib
rca3864 r7023ce 698 698 int n = nvars(basering); 699 699 int c; 700 if (attrib(I,"isSB") == 1)700 if (attrib(I,"isSB")) 701 701 { 702 702 c = n - dim(I); -
Singular/LIB/ffsolve.lib
rca3864 r7023ce 383 383 } 384 384 } 385 varinfo = findvars(univar_part,1);385 varinfo = varaibles(univar_part); 386 386 unsolved_vars = varinfo[3]; 387 387 unsolved_var_nums = varinfo[4]; -
Singular/LIB/gradedModules.lib
rca3864 r7023ce 32 32 "; 33 33 34 35 36 34 37 ////////////////////////////////////////////////////////////////////////////////////////////////////////// 35 38 // . view graded module/map … … 140 143 static proc issorted( intvec g, int s ) 141 144 { 145 g = s * g; // "g: ", g; 142 146 int i = size(g); 143 147 144 148 for(; i > 1; i--) 145 149 { 146 if( s*(g[i] - g[i-1]) < 0 )150 if( (g[i] - g[i-1]) < 0 ) 147 151 { 148 152 return (0); … … 158 162 " 159 163 { 164 gr = s * gr; 160 165 int m = size(gr); 161 162 166 intvec pivot; 163 167 … … 176 180 for(Bn=1; Bn <= (m-Bi); Bn++) 177 181 { 178 D = s*(gr[pivot[Bn]] - gr[pivot[Bn+1]]); // sort gr182 D = (gr[pivot[Bn]] - gr[pivot[Bn+1]]); // sort gr 179 183 P = (D > 0) or ( (D == 0) && ((pivot[Bn]-pivot[Bn+1]) > 0) ); // stability!? 180 184 if(P) … … 189 193 } 190 194 191 ASSUME(1, issorted(gr, s));192 195 193 196 if( flag && 0 ) // output details in case of non-identical permutation? 194 197 { 195 198 // grades & ordering permutation : gr[pivot] should be sorted: 196 ""; 199 "s: ", s; 200 "gr: ", gr; 197 201 "pivot: ", pivot; 198 ""; 199 } 202 } 203 204 ASSUME(1, issorted(intvec(gr[pivot]), 1)); 200 205 201 206 return (pivot); 202 207 } 203 208 209 // Q@Wolfram: what should be done with zero gens!? 204 210 proc grdeg( def M, list # ) 205 211 "graded degrees of gens(i.e. columns)" 206 207 212 { 208 213 // use initial grading if given … … 219 224 kill w; 220 225 } 221 222 // try to homogenize otherwise 223 if( typeof(attrib( M, "isHomog")) != "intvec" ) 224 { // no such attribute? // ERROR("No grading!"); 225 ASSUME(0, /* input must be graded: cannot compute homogenizing grading */ homog(M) ); 226 } 227 228 229 ASSUME(0, /* input must be graded! */ typeof(attrib(M, "isHomog")) == "intvec" ); 230 // input should be graded: 226 227 ASSUME(1, grtest(M) ); 228 231 229 def w = attrib(M, "isHomog"); // grading weights? 232 ASSUME(0, /* input must be correctly graded! */ nrows(M) == size(w) ); 233 234 if( size(M) == 0 ) { return (w); } // TODO??? 230 231 if( size(M) == 0 ){ return (w); } // TODO: Q@Wolfram!??? 235 232 236 233 int m = ncols(M); // m > 0 in Singular! … … 249 246 } 250 247 251 252 static proc order( def M, int s, list #) 253 "helper for reorder: compute graded degrees and the permutation to sort them" 254 { 255 if( size(#) > 0 ) { intvec gr = grdeg( M, #[1] ); } 256 else { intvec gr = grdeg( M ); } 257 248 static proc reorder(def M, int s) 249 " 250 Reorder gens of M: compute graded degrees and the permutation to sort them 251 " 252 { 253 // input should be graded: 254 ASSUME(1, grtest(M) ); 255 256 intvec w = attrib(M, "isHomog"); // grading weights 257 258 intvec gr = grdeg( M ); 258 259 259 260 // intvec d = deg(M[1..nocls(M)]); // no need to deal with un-weighted degrees??! … … 261 262 intvec pivot = mysort(gr, s); 262 263 264 // grades & ordering permutation for N. gr[pivot] should be sorted! 263 265 ASSUME(1, issorted(gr[pivot], s)); 264 266 265 return (gr, pivot); 266 } 267 268 269 static proc reorder(def M, int s, list #) 270 " 271 helper for Reorder gens of M 272 " 273 { 274 // use initial grading if given 275 if( size(#) == 1 ) 276 { 277 def w = #[1]; 278 if( typeof(w) == "intvec" ) 279 { 280 if( nrows(M) == size(w) ) 281 { 282 attrib(M, "isHomog", w); 283 } 284 } 285 kill w; 286 } 287 288 // try to homogenize otherwise 289 if( typeof(attrib( M, "isHomog")) != "intvec" ) 290 { // no such attribute? // ERROR("No grading!"); 291 ASSUME(0, /* input must be graded: cannot compute homogenizing grading */ homog(M) ); 292 } 293 294 ASSUME(0, /* input must be graded! */ typeof(attrib(M, "isHomog")) == "intvec" ); 295 // input should be graded: 296 def w = attrib(M, "isHomog"); // grading weights? 297 ASSUME(0, /* input must be correctly graded! */ nrows(M) == size(w) ); 298 299 300 intvec d, p; 301 302 if( size(#) > 0 ) { (d, p) = order( M, s, #[1] ); } 303 else { (d, p) = order( M, s ); } 304 305 // grades & ordering permutation for N. d[p] should be sorted! 306 307 def N = grobj(module(M[p]), w); // reorder the starting ideal/module 308 309 d = d[p]; 267 module N = grobj(module(M[pivot]), w); // reorder the starting ideal/module 310 268 311 269 // "reorder: "; grview(N); 312 270 313 return (N, d); 314 } 315 316 /* 317 // only for whole resolutions, please use grorder instead! 318 static proc ordres( list L, list # ) 319 " 320 reorder a resolution given by the list (and optionnaly a grading for its 1st entry) 321 " 322 { 323 int k = 1; // "k: ", k; 324 325 // check 1st syzygy property? 326 // if( 0 != size( module( matrix(transpose(L[k+1]))*matrix(transpose(L[k-1+1])) ) ) ){L[k];"";L[k+1];module( matrix(transpose(L[k+1]))*matrix(transpose(L[k-1+1])) );ERROR( "Exactness test failed!!!!" );} 327 328 329 // TODO: rewrite with reorder 330 intvec d, p, pp; 331 module N = L[1]; 332 (d, p) = order( N, 1, # ); // grades & ordering permutation for N. d[p] should be sorted! 333 N = module(N[p]); // reorder the starting ideal/module 334 attrib( N, "isHomog", w ); // set the grading 335 L[1] = N; // put it back into the list of modules 336 337 // grview(N); 338 kill w, N; 339 340 /////////////////////////////////// 341 k++; 342 while( k <= size(L) ) 343 { 344 // "k: ", k; 345 module N = L[k]; 346 347 if( size(N) == 0 ) { break; } // resolution should finish with 0 module? 348 349 if( typeof(attrib( N, "isHomog")) != "intvec" ) 350 { 351 attrib( N, "isHomog", d); // ERROR("Non-graded input!"); 352 } 353 354 // grview(N); 355 356 intvec w = attrib( N, "isHomog"); 357 (d, pp) = order( N, w, 1 ); // grades & ordering permutation : d[p] should be sorted! 358 359 // reorder k-th syzygy (columns): 360 module T = module(N[pp]); 361 kill N; 362 module N = transpose(T); 363 kill T; 364 365 // reorder k-th syzygy (rows): 366 module T = module(N[p]); 367 kill N; 368 module N = transpose(T); 369 kill T; 370 371 w = intvec(w[p]); attrib( N, "isHomog", w); // corresponding ordered grading 372 373 L[k] = N; // grview(N); 374 375 // check syz. property? 376 // if( 0 != size( module( matrix(transpose(N))*matrix(transpose(L[k-1])) ) ) ) { N; L[k-1]; module( matrix(transpose(N))*matrix(transpose(L[k-1])) ); ERROR( "Exactness test failed!!!!" ); } 377 kill N, w; 378 p = pp; 379 k++; 380 } 381 382 return (list( L[1 .. (k-1)] )); 383 } 384 */ 385 386 387 388 389 proc grtranspose(def M, list #) 271 return (N, intvec(gr[pivot])); 272 } 273 274 proc grtranspose(def M) 390 275 " 391 276 transpose graded module/map or a chain complex?... … … 417 302 // grview(M[i]); 418 303 L[j] = grtranspose(M[i]); 419 if( i > 1 ) 304 // grview(L[j]); 305 306 if( (i > 1) && (j > 0) ) 420 307 { 421 ASSUME(2, size( module( matrix(L[j+1])*matrix(L[j]) ) ) == 0 ); 308 // grview(L[j+1]); 309 ASSUME(2, size( module( matrix(L[j])*matrix(L[j+1]) ) ) == 0 ); 422 310 }; 423 311 // grview(L[j]); … … 429 317 ////// 430 318 // "a"; grview(M); 319 ASSUME(1, grtest(M) ); 431 320 432 321 // TODO: something is wrong here: … … 434 323 intvec d; module N; 435 324 436 if( size(#) > 0 ) { (N,d) = reorder(M, -1, #[1]); } 437 else { (N,d) = reorder(M, -1); } 325 (N,d) = reorder(M, -1); 438 326 439 327 kill M; module M = grobj(transpose(N), -d); … … 456 344 457 345 458 proc grorder(def M , list #)346 proc grorder(def M) 459 347 " 460 348 reorder graded module/map or a chain complex?... … … 493 381 return (L); // ? 494 382 } 383 384 ASSUME(1, grtest(M) ); 495 385 496 386 // "a"; grview(M); … … 498 388 intvec d; module N; 499 389 500 if( size(#) > 0 ) { (N,d) = reorder(M, 1, #[1]); }501 else { (N,d) = reorder(M, 1); }502 kill M; module M = grobj(transpose(N), -d);390 (N,d) = reorder(M, 1); kill M; 391 392 module M = grobj(transpose(N), -d); kill N,d; 503 393 504 394 // "b"; grview(M); 505 395 506 kill N,d;module N; intvec d;396 module N; intvec d; 507 397 // reverse order: 508 398 (N,d) = reorder(M, -1); kill M; … … 528 418 " = Ring: ", string(basering); 529 419 530 I = groebner(I); attrib(I, "isHomog", intvec(0)); 420 I = groebner(I); attrib(I, "isHomog", intvec(0)); 421 ASSUME(0, grtest(I)); 531 422 // " = Input degrees: "; grview(I); 532 423 … … 553 444 } 554 445 example 555 { "EXAMPLE:"; echo = 2; int assumeLevel = 5; 446 { "EXAMPLE:"; echo = 2; 447 if( defined(assumeLevel) ){ int assumeLevel0 = assumeLevel; } else { int assumeLevel; export(assumeLevel); } // store the state of aL 448 assumeLevel = 5; 556 449 557 450 string Name = "castelnuovo"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = 5153xy2-98/23y3-101/51xyz+33/41y2z+99/79xz2+7136yz2-106/111z3+119/53xyu+34/57y2u-77/92xzu+84/73yzu-109/78z2u-27/56xu2+10023yu2+82/103zu2-34/25u3+3/2xyv-68/25y2v+12721xzv+4/63yzv-73/21z2v-7291xuv-91/53yuv-4/79zuv-34/91u2v-122/53xv2+123/70yv2-64/73zv2+44/65uv2+14/31v3,xy2-15202y3+10613xyz+13640y2z-107/103xz2+5292yz2+19/119z3-10042xyu+2770y2u+7957xzu+14008yzu+92/121z2u-92/51xu2+1178yu2+1/117zu2-12726u3+82/101xyv-92/17y2v-107/56xzv+14233yzv+79/28z2v+51/50xuv-31/5yuv+95/91zuv+19/108u2v+12151xv2-69/110yv2+37/89zv2-63/116uv2-88/23v3,-5153x2+37/23xy+8706y2-13160xz+68/115yz+5548z2-22/61xu-113/98yu+11818zu+2114u2-101/97xv+89/22yv-3355zv-113/5uv-5521v2;TestGRRes(Name, 2, I); kill R, Name, @p; ""; … … 574 467 575 468 string Name = "rat.d10.g9.quart2"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = x3yu2-48/11x2y2u2-8356xy3u2+35/121y4u2+31/66x3zu2-54/83x2yzu2-61/18xy2zu2+11526y3zu2+7372x2z2u2-91/60xyz2u2-95/97y2z2u2-45/71xz3u2+71/115yz3u2+25/54z4u2-61/102x3u3-12668x2yu3+6653xy2u3+41/54y3u3+87/50x2zu3-5004xyzu3+13924y2zu3+2310xz2u3-93/14yz2u3-2/93z3u3-97/125x2u4-58/11xyu4+46/73y2u4-4417xzu4+60/101yzu4+56/75z2u4-113/118xu5+115/4yu5-40zu5-8554u6-54/83x3yuv-9770x2y2uv-590xy3uv+15/49y4uv+94/69x3zuv+121/105x2yzuv+95/88xy2zuv+3186y3zuv+11/6x2z2uv-44/81xyz2uv+637y2z2uv+109/121xz3uv-33yz3uv-94/115z4uv-49/95x3u2v-11/109x2yu2v+45/113xy2u2v+97/84y3u2v+5257x2zu2v+99/49xyzu2v+12584y2zu2v-4294xz2u2v+1137yz2u2v-58/69z3u2v-4749x2u3v+120/97xyu3v-31/103y2u3v+62/97xzu3v-107/74yzu3v+53/59z2u3v+91/33xu4v+1291yu4v+23/34zu4v+58/77u5v+16/17x3yv2-750x2y2v2+86/89xy3v2+123/46y4v2+53/123x3zv2-61/99x2yzv2+12389xy2zv2+10419y3zv2+43/11x2z2v2-146xyz2v2-116/51y2z2v2+13/62xz3v2-5524yz3v2-111/118z4v2-56/55x3uv2-3038x2yuv2+14/27xy2uv2-43/64y3uv2+3385x2zuv2+25/11xyzuv2+92/41y2zuv2+28/113xz2uv2-2049yz2uv2+89/37z3uv2-13094x2u2v2-2774xyu2v2+15474y2u2v2-15791xzu2v2-71/116yzu2v2+77/41z2u2v2-83/68xu3v2-33/106yu3v2+71/37zu3v2-41/17u4v2+12052x3v3+1906x2yv3+13825xy2v3+80/7y3v3-125/96x2zv3-9661xyzv3+85/116y2zv3-72/91xz2v3+13/112yz2v3-126/97z3v3-1637x2uv3+34/103xyuv3+3844y2uv3+77/10xzuv3+6359yzuv3-11185z2uv3-124/121xu2v3+66/91yu2v3-14636zu2v3-1051u3v3+9/64x2v4-12924xyv4-119/41y2v4+74/23xzv4+1622yzv4+73/37z2v4-60/101xuv4+111/22yuv4-45/124zuv4+59/37u2v4-66/37xv5-71/99yv5+12409zv5-113/64uv5-5267v6,-x4y-22/79x3y2-125/42x2y3-116/7xy4+98/111y5-31/66x4z-118/75x3yz+110/93x2y2z-43/92xy3z-788y4z-7372x3z2-2701x2yz2-67/124xy2z2-117/62y3z2+45/71x2z3-8396xyz3-10343y2z3-25/54xz4+30/59yz4+61/102x4u+11736x3yu+12726x2y2u+41/118xy3u-15832y4u-87/50x3zu-130x2yzu+41/8xy2zu-10300y3zu-2310x2z2u-101/5xyz2u+6205y2z2u+2/93xz3u+8679yz3u+97/125x3u2-43/37x2yu2-39/80xy2u2+12139y3u2+4417x2zu2+4294xyzu2+11/58y2zu2-56/75xz2u2+8338yz2u2+113/118x2u3-10190xyu3-37/16y2u3+40xzu3+74/23yzu3+8554xu4+115/22yu4-39/79x4v+61/72x3yv+8048x2y2v-9201xy3v+16/121y4v+113/93x3zv+109/75x2yzv+12700xy2zv-10607y3zv+50/11x2z2v+1223xyz2v-103/79y2z2v-123/58xz3v+31/26yz3v-15/122z4v+122/25x3uv-99/17x2yuv+1723xy2uv-38/121y3uv+11016x2zuv-25/102xyzuv-14970y2zuv-61/6xz2uv-14981yz2uv+15900z3uv+3268x2u2v-75/19xyu2v-1436y2u2v-1764xzu2v-57/41yzu2v+12741z2u2v-14615xu3v+119/61yu3v-115/119zu3v+10501u4v-8502x3v2-51/76x2yv2-6281xy2v2+17/49y3v2-106/7x2zv2+63/101xyzv2-27/95y2zv2-1606xz2v2+9245yz2v2+1912z3v2+11155x2uv2+223xyuv2-13/18y2uv2+110/43xzuv2+76/81yzuv2-6291z2uv2+1400xu2v2-95/23yu2v2-9701zu2v2+106/105u3v2+72/47x2v3-13118xyv3+14409y2v3+37/86xzv3+44/69yzv3-325z2v3+113/71xuv3+16/81yuv3+6/19zuv3-119/39u2v3-89/9xv4+72/53yv4+112/55zv4-8587uv4-6604v5,-x3y2+48/11x2y3+8356xy4-35/121y5-12750x3yz+100/111x2y2z+45/74xy3z+99/74y4z-6/7x3z2-47/67x2yz2+11465xy2z2-11865y3z2+7776x2z3+124/45xyz3-98/115y2z3+117/85xz4-59/120yz4-8748z5+61/102x3yu+12668x2y2u-6653xy3u-41/54y4u+13408x3zu-2185x2yzu-1240xy2zu+1161y3zu+44/27x2z2u-11164xyz2u-13388y2z2u-107/13xz3u+90/71yz3u+4204z4u+97/125x2yu2+58/11xy2u2-46/73y3u2+55/48x2zu2+121/31xyzu2+126/61y2zu2-55/69xz2u2+5988yz2u2+3755z3u2+113/118xyu3-115/4y2u3+3390xzu3-5762yzu3+30/61z2u3+8554yu4-14317zu4+99/116x3yv-113/119x2y2v+50/23xy3v-37/79y4v-8668x3zv+14049x2yzv+111/35xy2zv+61/28y3zv-10171x2z2v+68/21xyz2v+2023y2z2v-9/109xz3v+8520yz3v-2683z4v-13547x3uv+28/65x2yuv-5988xy2uv+61/111y3uv+12314x2zuv+29/44xyzuv+6141y2zuv+11280xz2uv+79/22yz2uv-38/111z3uv+19/51x2u2v+5093xyu2v-10291y2u2v-5009xzu2v-111/49yzu2v+3813z2u2v-61/37xu3v+15914yu3v-3218zu3v-12915u4v-118/101x3v2-7/57x2yv2+13128xy2v2+11606y3v2+42/101x2zv2-54/17xyzv2-43/49y2zv2-119/110xz2v2+9742yz2v2-43/4z3v2-55/8x2uv2-29/88xyuv2+12042y2uv2+101/37xzuv2-57/62yzuv2+106/97z2uv2+38/83xu2v2+8152yu2v2-5492zu2v2-47/79u3v2+15112x2v3+69/44xyv3-6/71y2v3+113/54xzv3-13210yzv3-707z2v3-119/8xuv3+3845yuv3-19/20zuv3+4852u2v3+15761xv4-12372yv4+74/69zv4-2100uv4-12833v5,-x3yz+48/11x2y2z+8356xy3z-35/121y4z-31/66x3z2+54/83x2yz2+61/18xy2z2-11526y3z2-7372x2z3+91/60xyz3+95/97y2z3+45/71xz4-71/115yz4-25/54z5+15/52x3yu+6039x2y2u+74/99xy3u-17/40y4u+29/50x3zu-7775x2yzu+6368xy2zu+14170y3zu+52/41x2z2u+7003xyz2u-5787y2z2u-101/37xz3u-23/28yz3u-20/63z4u+41/77x3u2+8650x2yu2-15922xy2u2-16/83y3u2+7278x2zu2+31/30xyzu2-2/107y2zu2+35/122xz2u2+85/58yz2u2-757z3u2+2/101x2u3+86/17xyu3+95/59y2u3+123/22xzu3-6869yzu3-9311z2u3-105/97xu4+5699yu4+15925zu4+13528u5-154x3yv+4187x2y2v+56/107xy3v-15932y4v-5137x3zv-37/56x2yzv+9401xy2zv+92/123y3zv-79/97x2z2v+9201xyz2v+19/53y2z2v+107/20xz3v+17/77yz3v-15306z4v+3215x3uv-79/117x2yuv-9/76xy2uv-6352y3uv+93/13x2zuv-65/89xyzuv-115/4y2zuv-34/57xz2uv+39/107yz2uv+31/9z3uv+107/48x2u2v+2632xyu2v+29/96y2u2v-125/89xzu2v+29/113yzu2v+3940z2u2v-116/111xu3v+6145yu3v-105/62zu3v+101/17u4v-9281x3v2-49/107x2yv2-12154xy2v2+4/19y3v2-114/71x2zv2-15/118xyzv2+4372y2zv2+45/121xz2v2+46/111yz2v2+6614z3v2+17x2uv2+10806xyuv2-10617y2uv2-25/111xzuv2-116/27yzuv2-7/58z2uv2-686xu2v2+3/13yu2v2-17/49zu2v2-40/107u3v2+47/90x2v3-83/43xyv3-6326y2v3+49/64xzv3+113/76yzv3-122/73z2v3+10232xuv3-116/109yuv3-1990zuv3+70/51u2v3-118/19xv4-27/55yv4+21/19zv4-23/57uv4-11721v5,-3399x4y+1849x3y2-3/29x2y3+28/87xy4+10/29y5-9788x4z-49/73x3yz+13829x2y2z+118/73xy3z+13129y4z-618x3z2+92/13x2yz2+101/117xy2z2-162y3z2+24/5x2z3-29/74xyz3+2687y2z3-74/39xz4+2/57yz4+68/73x4u-13787x3yu-11659x2y2u+14729xy3u+92/53y4u+15/71x3zu-62/15x2yzu+21/85xy2zu+4938y3zu-120/37x2z2u-77/102xyz2u-4785y2z2u-83/70xz3u-12128yz3u-13592z4u-123/20x3u2+2607x2yu2+40/19xy2u2+6361y3u2-3091x2zu2+89/113xyzu2+149y2zu2-2890xz2u2-8374yz2u2+11886z3u2-49/43x2u3-9854xyu3-6943y2u3+10743xzu3-122/45yzu3-13902z2u3-103/19xu4-48/59yu4+27/86zu4+46/35u5-117/17x4v-15/7x3yv+8409x2y2v-83/28xy3v+86/35y4v+37/45x3zv+4/3x2yzv+35/38xy2zv+4015y3zv-49/111x2z2v-1260xyz2v-25/33y2z2v+116/19xz3v+93/8yz3v+5755z4v-25/89x3uv-11669x2yuv-64/107xy2uv+2993y3uv+7767x2zuv-17/95xyzuv-103/80y2zuv-14576xz2uv+80/47yz2uv+25/107z3uv+103/2x2u2v+125/117xyu2v-2/89y2u2v-5298xzu2v-50/27yzu2v-71/53z2u2v+2652xu3v+15761yu3v+2124zu3v+11/82u4v+100/63x3v2+4180x2yv2+11/39xy2v2-1221y3v2+108/125x2zv2+97/126xyzv2-7698y2zv2+13984xz2v2+1342yz2v2-84/121z3v2-26/73x2uv2-14/15xyuv2-22/37y2uv2-71/82xzuv2+12430yzuv2+103/52z2uv2-13095xu2v2+10114yu2v2-8/73zu2v2-33/97u3v2+83/105x2v3+22/45xyv3-7961y2v3-9654xzv3-54/55yzv3-3/71z2v3-10148xuv3-117/98yuv3+101/102zuv3-606u2v3+97/43xv4-68/21yv4+63/16zv4+42/17uv4+5834v5,-3399x3y2-32/113x2y3+14/99xy4+15001y5-121/115x3yz+4604x2y2z+7/2xy3z+9532y4z-3267x3z2+97/118x2yz2-14238xy2z2-80/21y3z2-12332x2z3-19/69xyz3+116/15y2z3-103/32xz4+15340yz4+10509z5+112/109x3yu-97x2y2u-40/11xy3u+90/29y4u-95/106x3zu-114/67x2yzu+113/48xy2zu+12080y3zu-44x2z2u+18/17xyz2u-4814y2z2u-103/100xz3u-96/61yz3u-205z4u-87/82x3u2-97/108x2yu2+3230xy2u2+104/83y3u2+41/86x2zu2+116/49xyzu2-59/110y2zu2+14/59xz2u2-6962yz2u2-2185z3u2+59/91x2u3+2497xyu3+3/37y2u3-13010xzu3+6/83yzu3-11448z2u3+13/72xu4-69/62yu4-2869zu4+23/73u5-20/43x3yv+5074x2y2v+28/125xy3v-2706y4v+13010x3zv-17/109x2yzv+21/4xy2zv+59/93y3zv-2406x2z2v+117/11xyz2v-14978y2z2v+70/89xz3v-33/7yz3v-13676z4v-13690x3uv+9825x2yuv-117/107xy2uv+12760y3uv-93/98x2zuv-113/64xyzuv+113/103y2zuv-9748xz2uv+11016yz2uv-10729z3uv+90/13x2u2v-13/47xyu2v-11/39y2u2v+20/69xzu2v+5531yzu2v+125/49z2u2v-11025xu3v-9621yu3v+113/109zu3v+4710u4v-107/7x3v2+110/119x2yv2-10025xy2v2-6644y3v2-5041x2zv2+5/96xyzv2+11472y2zv2-5128xz2v2+2927yz2v2+121/18z3v2-125/89x2uv2+12936xyuv2-71/47y2uv2+34/47xzuv2-75/103yzuv2-2654z2uv2-2350xu2v2-7707yu2v2+47/72zu2v2-952u3v2-21/67x2v3+58/37xyv3-8757y2v3+3615xzv3+44/123yzv3-13027z2v3-9/10xuv3+75/43yuv3+115/18zuv3+8071u2v3-26/3xv4-67/65yv4+14186zv4-41/122uv4+33/28v5,-3399x3yz-32/113x2y2z+14/99xy3z+15001y4z-9788x3z2+37/96x2yz2+7743xy2z2+31/55y3z2-618x2z3-8171xyz3+82/109y2z3+24/5xz4+88/85yz4-74/39z5-13165x3yu+3407x2y2u-12509xy3u-23/45y4u-11774x3zu-10/67x2yzu+69/79xy2zu-10/123y3zu-7636x2z2u+83/32xyz2u+51/112y2z2u+19/8xz3u+9309yz3u-44/49z4u+4089x3u2-374x2yu2-919xy2u2+98/107y3u2+2776x2zu2+85/26xyzu2+31/13y2zu2-103/82xz2u2+35/76yz2u2+59/45z3u2+2950x2u3+27/44xyu3+88/71y2u3+7/114xzu3-72/77yzu3+12917z2u3-34/67xu4-85/82yu4-55/84zu4+4690u5+11/42x3yv-19/125x2y2v-8288xy3v+9199y4v-12929x3zv+13357x2yzv-4903xy2zv-584y3zv-10/33x2z2v+59/113xyz2v+103/92y2z2v+101/69xz3v+8708yz3v-8/7z4v+13560x3uv-43/49x2yuv-121/98xy2uv+75/79y3uv-39x2zuv-88/69xyzuv-89/78y2zuv+110/67xz2uv+61/4yz2uv-98/45z3uv+82/7x2u2v-85/41xyu2v+6548y2u2v+9367xzu2v-59/81yzu2v-14408z2u2v+2363xu3v-80/11yu3v-50/17zu3v-14799u4v-53/21x3v2+9437x2yv2-117/80xy2v2+81/85y3v2-8/45x2zv2-6428xyzv2+15126y2zv2+68/89xz2v2+7/122yz2v2+9639z3v2+113/4x2uv2-8678xyuv2-104/45y2uv2-79/90xzuv2+39/101yzuv2-7234z2uv2-28/43xu2v2+1251yu2v2-97/56zu2v2+17/41u3v2+107/24x2v3+2747xyv3+9933y2v3-4199xzv3+53/83yzv3+6364z2v3-5456xuv3+618yuv3-123/55zuv3+2375u2v3+63/76xv4-115/106yv4-8811zv4-31/75uv4+10/109v5,13/89x4y+77/31x3y2+36/83x2y3-11411xy4+6936y5-12223x4z+7400x3yz+33/118x2y2z-12146xy3z+108/79y4z+82/99x3z2-9877x2yz2-79/70xy2z2-19/123y3z2-1491x2z3+7953xyz3-43/126y2z3+60/17xz4+98/57yz4-13317x4u-77/27x3yu-6811x2y2u-69/61xy3u+6144y4u+5404x3zu+121/120x2yzu-91/23xy2zu-71/106y3zu+1435x2z2u-120/13xyz2u-12019y2z2u-68/7xz3u-113/82yz3u+11526z4u-8706x3u2-89/53x2yu2-14804xy2u2+120/107y3u2+71/94x2zu2-1/70xyzu2+1532y2zu2+4470xz2u2+13/60yz2u2-115/102z3u2-82/21x2u3+27/121xyu3-4439y2u3-101/47xzu3-3186yzu3-106/101z2u3-10169xu4+19/58yu4-96/73zu4-7959u5-10526x4v-107/92x3yv+47/6x2y2v-23/43xy3v-69/62y4v+59/65x3zv-28/95x2yzv+5479xy2zv-39/77y3zv+11/69x2z2v-11713xyz2v+43/79y2z2v-15602xz3v+16/73yz3v-13952z4v+61/82x3uv-2219x2yuv-91/106xy2uv+5/37y3uv-148x2zuv+31/51xyzuv+18/101y2zuv+97/68xz2uv-73/32yz2uv+47/2z3uv+2/41x2u2v-13009xyu2v-7/60y2u2v+15779xzu2v+72/7yzu2v-11/73z2u2v-119/44xu3v-9067yu3v+3249zu3v+61/51u4v+12525x3v2-118/9x2yv2-3270xy2v2-4/25y3v2-5075x2zv2+77/40xyzv2-89/65y2zv2+17/58xz2v2-15609yz2v2+95/54z3v2-75/79x2uv2-4907xyuv2+12418y2uv2-57/17xzuv2-8746yzuv2+13/95z2uv2-124/67xu2v2+16/13yu2v2+28/23zu2v2-10847u3v2-645x2v3+106/75xyv3+6/115y2v3-8495xzv3+58/35yzv3-9398z2v3-101/72xuv3-71/20yuv3-124/65zuv3-8971u2v3+27/28xv4+12/29yv4-4276zv4+10858uv4+29/12v5,13/89x3y2+12068x2y3-15543xy4-77/79y5+6626x3yz+64/53x2y2z-6/23xy3z-47/125y4z+14403x3z2-43/78x2yz2-31/115xy2z2+94/59y3z2-118/117x2z3-11229xyz3+2268y2z3-116/85xz4+25/58yz4+3085z5+59/27x3yu+67/82x2y2u+11/6xy3u+103/47y4u-63/80x3zu-81/47x2yzu+7760xy2zu-115/56y3zu-10/17x2z2u+101/5xyz2u+15634y2z2u+1/107xz3u-9282yz3u+43/62z4u+62/55x3u2+100/113x2yu2-9205xy2u2-46/13y3u2+43/96x2zu2+10159xyzu2+692y2zu2+859xz2u2-19/74yz2u2+123/47z3u2-9/20x2u3-11391xyu3-2375y2u3+109/24xzu3-57/53yzu3-925z2u3-82/45xu4+97/34yu4+13/82zu4-108/29u5+63/10x3yv+38/17x2y2v-19/115xy3v+3150y4v+22/69x3zv+26/57x2yzv+110/27xy2zv+87/77y3zv+85/18x2z2v+39/47xyz2v-48/17y2z2v-7/27xz3v-13/100yz3v-11662z4v-17/8x3uv+37/11x2yuv+29/11xy2uv-109/88y3uv-2817x2zuv-61/44xyzuv+10/31y2zuv+10010xz2uv+51/86yz2uv-97/83z3uv-89/96x2u2v+4030xyu2v-58/77y2u2v-114/43xzu2v-37/10yzu2v-2011z2u2v+14483xu3v-109/101yu3v+121/102zu3v-79/92u4v+15113x3v2+10781x2yv2-14259xy2v2-113/48y3v2-7/94x2zv2-17/74xyzv2-5/117y2zv2-59/75xz2v2+13188yz2v2+103/43z3v2+4/125x2uv2-52/59xyuv2+85/92y2uv2-1/46xzuv2-9106yzuv2-83/11z2uv2-23/94xu2v2+6742yu2v2-35/107zu2v2-14596u3v2-117/43x2v3+1026xyv3+90/19y2v3+14671xzv3-101/100yzv3+6962z2v3+61/68xuv3+108/37yuv3-4157zuv3-3974u2v3+15677xv4+8661yv4+8459zv4-16/23uv4-37/119v5,13/89x3yz+12068x2y2z-15543xy3z-77/79y4z-12223x3z2-13941x2yz2+115/84xy2z2+13/98y3z2+82/99x2z3+7751xyz3+122/17y2z3-1491xz4+1327yz4+60/17z5+15363x3yu+9780x2y2u+19/117xy3u-1924y4u-14600x3zu+46/41x2yzu-5466xy2zu-73/12y3zu+10838x2z2u-8302xyz2u-89/113y2z2u+53/69xz3u-9224yz3u+47/33z4u-7399x3u2+89/77x2yu2+9312xy2u2-41/80y3u2-732x2zu2-6781xyzu2-8608y2zu2-9270xz2u2-117/58yz2u2-115/68z3u2-48/31x2u3-9067xyu3+97/107y2u3+73/57xzu3-2719yzu3-110/59z2u3-37/86xu4-15796yu4-61/4zu4-115/72u5+6161x3yv+4134x2y2v+677xy3v-8375y4v+1150x3zv+1551x2yzv+4157xy2zv+112/87y3zv+8171x2z2v+6040xyz2v+15651y2z2v-7/66xz3v-47/61yz3v+77/64z4v+14848x3uv+48/119x2yuv-9534xy2uv-117/95y3uv+5/4x2zuv+122xyzuv+90/31y2zuv-41/26xz2uv+31/30yz2uv-10428z3uv-9896x2u2v-71/21xyu2v-55/38y2u2v-29/22xzu2v-11092yzu2v+39/122z2u2v+93/73xu3v+22/49yu3v-21/106zu3v+56u4v+8565x3v2-1695x2yv2+2/17xy2v2+1/78y3v2-113/71x2zv2-41/100xyzv2+55/14y2zv2+15286xz2v2+17/53yz2v2+126/71z3v2-79/87x2uv2+109/97xyuv2-28/31y2uv2-6533xzuv2+22/5yzuv2-10449z2uv2+10830xu2v2-15516yu2v2+28/57zu2v2-81/22u3v2+4198x2v3+5667xyv3-7133y2v3-8408xzv3+11066yzv3-26/125z2v3-808xuv3+95/54yuv3-64/17zuv3-5267u2v3-15333xv4+42/89yv4+63/85zv4+119/113uv4-2011v5,5583x4y+1725x3y2-8652x2y3-91/25xy4-8495x4z-13731x3yz+9298x2y2z-41/111xy3z-15503y4z-13805x3z2+3962x2yz2-2/63xy2z2+3314y3z2+2522x2z3-10/87xyz3-408y2z3+7/16xz4+69/22yz4-7254z5-59/21x4u+115/7x3yu-1718x2y2u+7851xy3u+2632y4u-82/3x3zu+37/86x2yzu+101/113xy2zu+6747y3zu-109/113x2z2u+7399xyz2u+24/103y2z2u+89/9xz3u-14630yz3u+15066z4u-12561x3u2+113/115x2yu2+87/97xy2u2-126/67y3u2-48/7x2zu2+123/103xyzu2-11/107y2zu2-2747xz2u2+8158yz2u2-3/107z3u2+41/6x2u3+12767xyu3+3873y2u3+74/83xzu3-55/119yzu3-24/83z2u3+55xu4-7/95yu4+57/44zu4+2/101u5-6928x4v-121/57x3yv+111/104x2y2v+946xy3v-29y4v+3057x3zv-14/25x2yzv+43/31xy2zv-105/2y3zv+2336x2z2v+61/77xyz2v-7880y2z2v+5/58xz3v+10593yz3v+7094z4v+63/59x3uv-5/69x2yuv-11/81xy2uv-4157y3uv+73/65x2zuv-1676xyzuv-2376y2zuv-85/63xz2uv-95/2yz2uv-14903z3uv-119/110x2u2v-115/24xyu2v+125/9y2u2v+106/87xzu2v-13/12yzu2v-4/19z2u2v+7838xu3v-43/111yu3v+7/113zu3v-12500u4v+7743x3v2-2023x2yv2-85/83xy2v2+49/41y3v2+20/87x2zv2+3932xyzv2-77/6y2zv2+47/90xz2v2-15580yz2v2+39/4z3v2-61/8x2uv2+2518xyuv2+29/98y2uv2+11057xzuv2-18/107yzuv2+708z2uv2+14720xu2v2-3175yu2v2-113/59zu2v2-14735u3v2+7/69x2v3-4029xyv3+54/91y2v3+12372xzv3+67/2yzv3+8856z2v3-2178xuv3+995yuv3+64/95zuv3+4039u2v3-37/44xv4+23/17yv4-3035zv4-103/124uv4+69/64v5,-5583x3y2-1725x2y3+8652xy4+91/25y5+6201x3yz-73/49x2y2z-3844xy3z+10548y4z-11057x3z2-105/122x2yz2+31/53xy2z2+79/89y3z2-24/101x2z3+107/119xyz3-126y2z3+8164xz4+2/77yz4-51/8z5-14941x3yu-106x2y2u+8695xy3u+125/62y4u+4328x3zu+29/117x2yzu-6249xy2zu-2791y3zu+67/49x2z2u-38/29xyz2u+122/41y2z2u+10603xz3u-3029yz3u+5578z4u+14754x3u2-108/79x2yu2+4408xy2u2-12401y3u2-1426x2zu2-1741xyzu2-83/86y2zu2+79/95xz2u2+122/121yz2u2+81/2z3u2-1172x2u3-41/68xyu3-70/3y2u3+24/107xzu3+120/79yzu3+18/119z2u3-65/122xu4+1018yu4+22/107zu4+15189u5+5/8x3yv-12060x2y2v+3/62xy3v-227y4v+60/41x3zv-123/115x2yzv+110/123xy2zv+12864y3zv-86/121x2z2v-69/94xyz2v+14/79y2z2v+118/45xz3v+10842yz3v-37/58z4v+100/69x3uv-47/65x2yuv-7/67xy2uv-93/100y3uv-6262x2zuv-4/75xyzuv+2082y2zuv-9117xz2uv+12450yz2uv-84/67z3uv+123/26x2u2v-51/89xyu2v+19/74y2u2v-104/77xzu2v+318yzu2v+12402z2u2v+95/8xu3v-81/26yu3v-4486zu3v+3872u4v+72/91x3v2-83/63x2yv2+93/92xy2v2-15924y3v2-53/62x2zv2+6046xyzv2+1408y2zv2+60/107xz2v2-1150yz2v2-126/19z3v2-7429x2uv2+2554xyuv2+3602y2uv2+10738xzuv2-57/64yzuv2+86/69z2uv2+8172xu2v2+91/113yu2v2+92/65zu2v2+118/37u3v2+47/83x2v3+12750xyv3+10851y2v3+4216xzv3+6/101yzv3-108z2v3+2920xuv3-101/102yuv3-157zuv3+7742u2v3-7234xv4-2/111yv4+59/33zv4-93/91uv4+24/19v5,1592x4y+75/121x3y2+40/19x2y3-2651xy4+9934x4z+245x3yz+11665x2y2z+30/41xy3z+1823y4z+89/88x3z2-105/46x2yz2+79/58xy2z2-4191y3z2-76/61x2z3-21/32xyz3-9516y2z3-14896xz4-85/77yz4+51/109z5+61/30x4u-10/101x3yu+11796x2y2u+76/101xy3u+123/88y4u-5932x3zu-11857x2yzu+7128xy2zu-45/79y3zu+119/18x2z2u+9/74xyz2u+7042y2z2u-1114xz3u-11/82yz3u-1466z4u-6/85x3u2+27/106x2yu2+14246xy2u2-6216y3u2+47/6x2zu2-45/59xyzu2+89/41y2zu2+41/80xz2u2-7583yz2u2-75/113z3u2-14808x2u3-10873xyu3-90/67y2u3-11081xzu3-7369yzu3-7131z2u3-1402xu4-15386yu4-108/73zu4-5039u5+120/113x4v+10617x3yv-50/87x2y2v-2395xy3v-20/69y4v-8587x3zv+12960x2yzv-41/50xy2zv-13844y3zv-65/32x2z2v-77/122xyz2v-85/66y2z2v+13/100xz3v-20/51yz3v-13676z4v+76/97x3uv+1046x2yuv-8059xy2uv-117/59y3uv-29/105x2zuv+7287xyzuv-107/119y2zuv-35/118xz2uv+79/86yz2uv-2211z3uv+5448x2u2v+62/35xyu2v-2275y2u2v+29/121xzu2v-1674yzu2v-56/43z2u2v-3377xu3v-43/110yu3v+23/10zu3v-24/61u4v+121/53x3v2-4745x2yv2-57/64xy2v2+9554y3v2-12741x2zv2+10449xyzv2+37/108y2zv2+8621xz2v2-11/57yz2v2+1566z3v2+125/49x2uv2-121/118xyuv2+109/84y2uv2-335xzuv2+10167yzuv2-59/109z2uv2-103/119xu2v2+43/13yu2v2-73/87zu2v2+2037u3v2+13002x2v3+83/48xyv3-10713y2v3+1026xzv3-105/64yzv3-37/6z2v3+14779xuv3-6448yuv3+19/69zuv3-1/110u2v3+10010xv4+79/12yv4+12/19zv4-35/61uv4-11/57v5,-1592x3y2-75/121x2y3-40/19xy4+2651y5+39/121x3yz+122/77x2y2z-114/31xy3z+1544y4z+2/3x3z2-10271x2yz2-8373xy2z2+56/61y3z2+55/48x2z3-116xyz3-25/7y2z3-108/113xz4-34/53yz4+5548z5-122x3yu-9690x2y2u+43/87xy3u-5/19y4u+97/54x3zu-17/19x2yzu+4355xy2zu+12/5y3zu-1/100x2z2u+12754xyz2u+13600y2z2u+17/45xz3u-12091yz3u+5145z4u-63/64x3u2-84/31x2yu2-97/41xy2u2+7/13y3u2-79/62x2zu2-80/103xyzu2-69/14y2zu2+119/4xz2u2-35/87yz2u2-13840z3u2+14101x2u3+7952xyu3-1857y2u3-9861xzu3+3180yzu3+75/107z2u3-250xu4-15134yu4+4717zu4-2/41u5+22/27x3yv-8983x2y2v+10520xy3v-113/2y4v+10/73x3zv-1986x2yzv-110/13xy2zv+1550y3zv+32/111x2z2v-111/35xyz2v+101/98y2z2v+8045xz3v-2/89yz3v+2924z4v-79/11x3uv-15178x2yuv+10874xy2uv+54/11y3uv-8950x2zuv+70/53xyzuv-2403y2zuv-8249xz2uv+6935yz2uv+20/89z3uv+885x2u2v-76/71xyu2v-4/17y2u2v-31/52xzu2v-4/99yzu2v+10333z2u2v-93/104xu3v+82/101yu3v-71/37zu3v+9397u4v-15/112x3v2-6614x2yv2+119/2xy2v2+88/119y3v2+306x2zv2+2790xyzv2+10992y2zv2-115/74xz2v2-14711yz2v2+11612z3v2-1788x2uv2-75/97xyuv2+79/30y2uv2+99/59xzuv2-11439yzuv2-121/113z2uv2+108/37xu2v2+37/36yu2v2-3/65zu2v2-55/42u3v2+13/100x2v3-209xyv3-1272y2v3-117/68xzv3+63/94yzv3+32/59z2v3+1013xuv3-3463yuv3+6946zuv3-37/86u2v3+67/117xv4+85/28yv4-3024zv4-82/9uv4-32/65v5,-35/52x4y-12140x3y2+23/83x2y3+69/5xy4-80/79y5+120/43x4z-11865x3yz-3487x2y2z+53/59xy3z+53/102y4z-14083x3z2-14430x2yz2-2442xy2z2-33/104y3z2-91/38x2z3+4/87xyz3-26/57y2z3+4097xz4-9/122yz4+6364z5+9634x4u-97/95x3yu-46/99x2y2u+3847xy3u+121/106y4u+12765x3zu-5292x2yzu+1607xy2zu-67/121y3zu-12/35x2z2u+4/55xyz2u-17/27y2z2u+91/122xz3u-23/31yz3u+65/49z4u+73/46x3u2-124/27x2yu2-9933xy2u2+46/75y3u2+53/114x2zu2+3503xyzu2-14147y2zu2-11283xz2u2+11889yz2u2+99/104z3u2+3117x2u3+12624xyu3-10060y2u3+2193xzu3-80/47yzu3-77/13z2u3+11/31xu4-47/90yu4+49/48zu4-2/105u5-92/61x4v+7443x3yv+35/76x2y2v+114/67xy3v-73/126y4v+97/107x3zv+9464x2yzv+10869xy2zv+15718y3zv-37/33x2z2v+124/13xyz2v-11/26y2z2v-61/40xz3v+91/100yz3v-18/103z4v+60/29x3uv+21/125x2yuv-11117xy2uv+11748y3uv-16/117x2zuv+18/103xyzuv-1711y2zuv+1872xz2uv-109/123yz2uv-18/113z3uv-26/103x2u2v+14140xyu2v+11065y2u2v+8686xzu2v-5/111yzu2v+30/101z2u2v-10501xu3v-36/113yu3v-73/74zu3v+12753u4v-43/52x3v2-76/15x2yv2-5793xy2v2+18/13y3v2+1/79x2zv2+84/23xyzv2-172y2zv2+86/77xz2v2+15/37yz2v2+11835z3v2-6482x2uv2+94/113xyuv2+10727y2uv2-102/41xzuv2+15914yzuv2-12973z2uv2-9038xu2v2-13107yu2v2+1533zu2v2+12549u3v2-13528x2v3+903xyv3+23/114y2v3-123/64xzv3-81/5yzv3+111/103z2v3+4734xuv3-33/20yuv3-7954zuv3-2478u2v3+15518xv4-6723yv4-14/31zv4-3482uv4+10919v5,-3/94x4y-12936x3y2+2/11x2y3+32/23xy4-15921y5+61/93x4z+82/111x3yz-93/2x2y2z-6659xy3z-97/90y4z+402x3z2-14586x2yz2-121/39xy2z2+68/7y3z2+1212x2z3-2980xyz3+49/52y2z3-72/89xz4+92/47yz4+8478z5+2733x4u-103/89x3yu+1166x2y2u-7/53xy3u-106/23y4u+677x3zu+907x2yzu+7891xy2zu-9014y3zu+76/47x2z2u+49/116xyz2u-49/78y2z2u+12261xz3u+118/105yz3u-126/13z4u-8812x3u2-97/120x2yu2-9534xy2u2+92/5y3u2-54/71x2zu2+94/103xyzu2+2256y2zu2+4182xz2u2-5798yz2u2-31/115z3u2-73/98x2u3+15822xyu3+1004y2u3-578xzu3+9494yzu3-6779z2u3+14506xu4+10/121yu4+58/27zu4-2817u5-19/119x4v+7128x3yv+75/64x2y2v-65/109xy3v+5129y4v-53/55x3zv+54/125x2yzv-3009xy2zv+6144y3zv+15601x2z2v+123/55xyz2v-58/77y2z2v-56/61xz3v+121/10yz3v-103/86z4v-93/25x3uv+94/123x2yuv-25/107xy2uv+14807y3uv+65/7x2zuv+87/44xyzuv+6605y2zuv+23/99xz2uv-413yz2uv-17/15z3uv-79/46x2u2v+15240xyu2v-42/67y2u2v+8932xzu2v-5888yzu2v-4204z2u2v+7002xu3v-36/97yu3v-1634zu3v+61/102u4v-14/33x3v2-6520x2yv2+9004xy2v2-67/36y3v2-7/8x2zv2-24/11xyzv2-9373y2zv2+1556xz2v2-79/74yz2v2-6691z3v2+108x2uv2-76/61xyuv2+220y2uv2-1191xzuv2-4/9yzuv2+4546z2uv2+12205xu2v2+9/22yu2v2+64/93zu2v2-44/125u3v2+292x2v3+41/74xyv3+16/79y2v3-15892xzv3+5733yzv3+6796z2v3-42/55xuv3+71/79yuv3-19/104zuv3-38/15u2v3+6436xv4+28/15yv4+87/55zv4+2270uv4-30/41v5,-117/4x3y+97/122x2y2-3618xy3+6566y4+97/113x3z-12634x2yz+9865xy2z-1764y3z+114/31x2z2+5006xyz2+7/44y2z2-15040xz3+8/125yz3+11134z4-12980x3u-79/41x2yu-79/98xy2u+89/65y3u-1217x2zu+89/87xyzu+83/66y2zu+115/11xz2u+123/107yz2u+10920z3u-86/73x2u2-11/94xyu2-14054y2u2+6752xzu2-123/124yzu2+12129z2u2-13310xu3-52/63yu3+12847zu3-1545u4-11064x3v+11499x2yv-37/64xy2v+50/103y3v+123/94x2zv-126xyzv-111/44y2zv+95/14xz2v+113/83yz2v-77/103z3v+41/64x2uv+91/90xyuv-4932y2uv+103/31xzuv+62/63yzuv+1161z2uv-99/106xu2v-3181yu2v-11741zu2v-33/8u3v-3/118x2v2-9369xyv2+527y2v2-113/39xzv2-88/49yzv2-113/101z2v2+95/68xuv2-5930yuv2-20/43zuv2+7/41u2v2+109/93xv3-107/61yv3-8352zv3-5255uv3+12021v4,-2159x4-94/3x3y-4602x2y2+1609xy3+10721y4+28/9x3z-99/35x2yz+1/110xy2z+113/114y3z-118/75x2z2-103/93xyz2-68/67y2z2+13687xz3-1531yz3+61/107z4+6076x3u+9004x2yu+2211xy2u+110/53y3u+47/102x2zu+8495xyzu-9238y2zu+57/121xz2u-8543yz2u+8/19z3u-13527x2u2-13293xyu2+1138y2u2+26/115xzu2+78/53yzu2-12556z2u2+7299xu3+70/19yu3-14687zu3+13559u4+113/9x3v-85/126x2yv-83/3xy2v-3/46y3v+1814x2zv+28/79xyzv+103/51y2zv+78/31xz2v-14387yz2v+1/88z3v+116/75x2uv-101/59xyuv-70/3y2uv+109/71xzuv+13/88yzuv-147z2uv-113/76xu2v-9661yu2v+13855zu2v-6162u3v-1857x2v2-8208xyv2-4634y2v2-6178xzv2-7352yzv2-8247z2v2-113/15xuv2+99/40yuv2+21/97zuv2+11/37u2v2-6605xv3+8964yv3+35/121zv3+8543uv3-6008v4;TestGRRes(Name, 2, I); kill R, Name, @p; ""; 469 470 if( defined(assumeLevel0) ){ assumeLevel = assumeLevel0; } else { kill assumeLevel; } // restore the state of aL 576 471 } 577 472 578 473 ///////////////////////////////////////////////////////// 579 474 580 // ????475 // Q@Woflram? 581 476 proc grzero() 582 477 "presentation of S(0)^1 … … 584 479 " 585 480 { 586 module Z = 0; 587 return ( grobj(Z,intvec(0)) ); 481 return ( grobj(module([0]), intvec(0)) ); 588 482 } 589 483 … … 593 487 " 594 488 { 595 if(p==0){ return ( grzero() ); } // just ERROR ???489 if(p==0){ ERROR("Sorry, we don't know what is A^0!?!?"); } // grzero!? 596 490 597 491 ASSUME(0, p > 0); 492 ASSUME(1, grtest(A) ); 598 493 599 494 if(p==1){ return(A); } … … 617 512 " 618 513 { 514 ASSUME(1, grtest(A) ); 515 ASSUME(1, grtest(B) ); 516 619 517 intvec a = attrib(A, "isHomog"); 620 518 intvec b = attrib(B, "isHomog"); … … 622 520 int r = nrows(A); 623 521 624 ASSUME( 0, r == size(a) ); 625 626 module T; T[r] = 0; T = T, module(transpose(B)); 627 module AB = module(A), transpose(T); 628 629 return(grobj(AB, c)); 522 module T = align(module(B), r); // T; print(T); nrows(T); // BUG!!!! 523 module S = module(A), T; 524 525 return(grobj(S, c)); 630 526 } 631 527 example 632 { "EXAMPLE:"; echo = 2; int assumeLevel = 5; 633 528 { "EXAMPLE:"; echo = 2; 529 530 if( defined(assumeLevel) ){ int assumeLevel0 = assumeLevel; } else { int assumeLevel; export(assumeLevel); } // store the state of aL 531 assumeLevel = 5; 532 634 533 ring r=32003,(x,y,z),dp; 635 534 … … 681 580 grview(T); 682 581 582 if( defined(assumeLevel0) ){ assumeLevel = assumeLevel0; } else { kill assumeLevel; } // restore the state of aL 683 583 } 684 584 … … 689 589 { 690 590 intvec a = attrib(M, "isHomog"); 691 return (grobj(M, intvec( a + intvec(d:size(a))) )); 591 return (grobj(M, intvec( a - intvec(d:size(a))) )); 592 } 593 594 595 proc grtest(def N) 596 "test if N is a matrix/module with matching isHomog attribute (intvec)" 597 { 598 string t = typeof(N); 599 if( (t != "ideal") && (t != "module") && (t != "matrix") ) { return (0); }; // N should be something like a matrix 600 601 // N must be graded! 602 if ( typeof(attrib(N, "isHomog")) != "intvec" ){ return (0); }; 603 604 intvec gr = attrib(N, "isHomog"); // grading weights... 605 if ( nrows(N) > size(gr) ) { return (0); }; // wrong number of rows? 606 607 // if( attrib(N, "rank") != size(gr) ){ return (0); } // wrong rank :( 608 609 610 // if( !homog(N) ) { return (0); }; // N should be homogenous 611 612 613 return (1); 692 614 } 693 615 694 616 proc grisequal (def A, def B) 695 617 "TODO" 696 { 697 return (1==1); // TODO! 618 { 619 ASSUME(1, grtest(A) ); 620 ASSUME(1, grtest(B) ); 621 622 int ra = nrows(A); 623 int rb = nrows(B); 624 625 intvec wa = attrib(A, "isHomog"); 626 intvec wb = attrib(B, "isHomog"); 627 628 if( (ra != rb) || (ncols(A) != ncols(B)) ){ return (0); } // TODO: ??? 629 return ( (wa == wb) && 630 (size(module(matrix(A) - matrix(B))) == 0) ); // TODO: ??? 698 631 } 699 632 … … 703 636 " 704 637 { 705 module Z; Z[a] = 0;706 Z = grobj(Z, intvec(d:a));638 module Z; Z[a] = [0]; 639 Z = grobj(Z, -intvec(d:a)); // will set the rank as well 707 640 708 641 ASSUME(2, grisequal(Z, grpower( grshift(grzero(), d), a ) )); // optional check … … 710 643 } 711 644 712 proc grobj( module M, intvec w)645 proc grobj(def A, intvec w) 713 646 "" 714 647 { 648 module M = module(A); 649 ASSUME(0, size(w) >= nrows(M) ); 650 attrib(M, "rank", size(w)); 715 651 attrib(M, "isHomog", w); 716 attrib(M, "rank", size(w));652 ASSUME(1, grtest(M) ); 717 653 return (M); 718 654 } 655 656 657 static proc align( def A, int d) 658 "analog of align kernel command for older Singular versions 659 this is static since it should not be used by @code{align}-able (newer) 660 Singular releases. 661 Note that this proc does not care about any attributes (of A) 662 " 663 { 664 module T; T[d] = 0; 665 T = T, module(transpose(A)); 666 return( module(transpose(T)) ); 667 } -
Singular/LIB/grobcov.lib
rca3864 r7023ce 1 // ////////////////////////////////////////////////////////////////////////////2 version="version grobcov.lib 4 -0-0-0 Dec_2013 ";1 // 2 version="version grobcov.lib 4.0.1.2 Jan_2015 "; // $Id$ 3 3 category="General purpose"; 4 4 info=" 5 5 LIBRARY: grobcov.lib Groebner Cover for parametric ideals. 6 PURPOSE: Comprehensive Groebner Systems, Groebner Cover, Canonical Forms, 7 Parametric Polynomial Systems. 8 The library contains Montes-Wibmer's algorithms to compute the 9 canonical Groebner cover of a parametric ideal as described in 10 the paper: 11 12 Montes A., Wibmer M., 13 \"Groebner Bases for Polynomial Systems with parameters\". 14 Journal of Symbolic Computation 45 (2010) 1391-1425. 15 The locus algorithm and definitions will be 16 published in a forthcoming paper by Abanades, Botana, Montes, Recio: 17 \''An Algebraic Taxonomy for Locus Computation in Dynamic Geometry\''. 18 19 The central routine is grobcov. Given a parametric 20 ideal, grobcov outputs its Canonical Groebner Cover, consisting 21 of a set of pairs of (basis, segment). The basis (after 22 normalization) is the reduced Groebner basis for each point 23 of the segment. The segments are disjoint, locally closed 24 and correspond to constant lpp (leading power product) 25 of the basis, and are represented in canonical prime 26 representation. The segments are disjoint and cover the 27 whole parameter space. The output is canonical, it only 28 depends on the given parametric ideal and the monomial order. 29 This is much more than a simple Comprehensive Groebner System. 30 The algorithm grobcov allows options to solve partially the 31 problem when the whole automatic algorithm does not finish 32 in reasonable time. 33 34 grobcov uses a first algorithm cgsdr that outputs a disjoint 35 reduced Comprehensive Groebner System with constant lpp. 36 For this purpose, in this library, the implemented algorithm is 37 Kapur-Sun-Wang algorithm, because it is the most efficient 38 algorithm known for this purpose. 39 40 D. Kapur, Y. Sun, and D.K. Wang. 41 \"A New Algorithm for Computing Comprehensive Groebner Systems\". 42 Proceedings of ISSAC'2010, ACM Press, (2010), 29-36. 43 44 cgsdr can be called directly if only a disjoint reduced 45 Comprehensive Groebner System (CGS) is required. 46 47 AUTHORS: Antonio Montes , Hans Schoenemann. 48 OVERVIEW: see \"Groebner Bases for Polynomial Systems with parameters\" 49 Montes A., Wibmer M., 6 7 Comprehensive Groebner Systems, Groebner Cover, Canonical Forms, 8 Parametric Polynomial Systems, Dynamic Geometry, Loci, Envelop, 9 Constructible sets. 10 See 11 12 A. Montes A, M. Wibmer, 13 \"Groebner Bases for Polynomial Systems with parameters\", 50 14 Journal of Symbolic Computation 45 (2010) 1391-1425. 51 15 (http://www-ma2.upc.edu/~montes/). 16 17 AUTHORS: Antonio Montes , Hans Schoenemann. 18 19 OVERVIEW: 20 In 2010, the library was designed to contain Montes-Wibmer's 21 algorithms for compute the canonical Groebner Cover of a 22 parametric ideal as described in the paper: 23 24 Montes A., Wibmer M., 25 \"Groebner Bases for Polynomial Systems with parameters\". 26 Journal of Symbolic Computation 45 (2010) 1391-1425. 27 28 The central routine is grobcov. Given a parametric 29 ideal, grobcov outputs its Canonical Groebner Cover, consisting 30 of a set of pairs of (basis, segment). The basis (after 31 normalization) is the reduced Groebner basis for each point 32 of the segment. The segments are disjoint, locally closed 33 and correspond to constant lpp (leading power product) 34 of the basis, and are represented in canonical prime 35 representation. The segments are disjoint and cover the 36 whole parameter space. The output is canonical, it only 37 depends on the given parametric ideal and the monomial order. 38 This is much more than a simple Comprehensive Groebner System. 39 The algorithm grobcov allows options to solve partially the 40 problem when the whole automatic algorithm does not finish 41 in reasonable time. 42 43 grobcov uses a first algorithm cgsdr that outputs a disjoint 44 reduced Comprehensive Groebner System with constant lpp. 45 For this purpose, in this library, the implemented algorithm is 46 Kapur-Sun-Wang algorithm, because it is the most efficient 47 algorithm known for this purpose. 48 49 D. Kapur, Y. Sun, and D.K. Wang. 50 \"A New Algorithm for Computing Comprehensive Groebner Systems\". 51 Proceedings of ISSAC'2010, ACM Press, (2010), 29-36. 52 53 The library has evolved to include new applications of the 54 Groebner Cover, and new theoretical developments have been done. 55 56 A new set of routines (locus, locusdg, locusto) has been included to 57 compute loci of points. The routines are used in the Dynamic 58 Geometry software Geogebra. They are described in: 59 60 Abanades, Botana, Montes, Recio: 61 \''An Algebraic Taxonomy for Locus Computation in Dynamic Geometry\''. 62 Computer-Aided Design 56 (2014) 22-33. 63 64 Recently also routines for computing the envelop of a family 65 of curves (enverlop, envelopdg), to be used in Dynamic Geometry, 66 has been included and will be described in a forthcoming paper: 67 68 Abanades, Botana, Montes, Recio: 69 \''Envelops in Dynamic Geometry using the Groebner cover\''. 70 71 The actual version also includes two routines (AddCons and AddconsP) 72 for computing the canonical form of a constructible set, given as a 73 union of locally closed sets. They are used in the new version for the 74 computation of loci and envelops. It determines the canonical locally closed 75 level sets of a constructuble. They will be described in a forthcoming paper: 76 77 A. Montes, J.M. Brunat, 78 \"Canonical representations of constructible sets\". 79 80 This version was finished on 31/01/2015 52 81 53 82 NOTATIONS: All given and determined polynomials and ideals are in the … … 62 91 @* If you want to use some internal routine you must 63 92 @* create before the above rings by calling setglobalrings(); 64 @* because mostof the internal routines use these rings.93 @* because some of the internal routines use these rings. 65 94 @* The call to the basic routines grobcov, cgsdr will 66 95 @* kill these rings. 67 96 68 97 PROCEDURES: 69 70 98 grobcov(F); Is the basic routine giving the canonical 71 Groebner cover of the parametric ideal F. 72 This routine accepts many options, that 73 allow to obtain results even when the canonical 74 computation does not finish in reasonable time. 75 76 cgsdr(F); Is the procedure for obtaining a first disjoint, 77 reduced Comprehensive Groebner System that 78 is used in grobcov, that can also be used 79 independently if only the CGS is required. 80 It is a more efficient routine than buildtree 81 (the own routine that is no more used). It uses 82 now KSW algorithm. 83 84 setglobalrings(); Generates the global rings @R, @P and @PR that are 85 respectively the rings Q[a][x], Q[a], Q[x,a]. 86 It is called inside each of the fundamental routines 87 of the library: grobcov, cgsdr, locus, locusdg and killed before 88 the output. 89 So, if the user want to use some other internal routine, 90 then setglobalrings() is to be called before, as most of them use 91 these rings. 92 93 pdivi(f,F); Performs a pseudodivision of a parametric polynomial 94 by a parametric ideal. 95 Can be used without calling presiouly setglobalrings(), 99 Groebner Cover of the parametric ideal F. 100 This routine accepts many options, that 101 allow to obtain results even when the canonical 102 computation does not finish in reasonable time. 103 104 cgsdr(F); Is the procedure for obtaining a first disjoint, 105 reduced Comprehensive Groebner System that 106 is used in grobcov, that can also be used 107 independently if only the CGS is required. 108 It is a more efficient routine than buildtree 109 (the own routine of 2010 that is no more used). 110 Now, KSW algorithm is used. 111 112 setglobalrings(); Generates the global rings @R, @P and @PR that 113 are respectively the rings Q[a][x], Q[a], Q[x,a]. (a=parameters, 114 x=variables) It is called inside each of the fundamental 115 routines of the library: grobcov, cgsdr, locus, locusdg and 116 killed before the output. 117 If the user want to use some other internal routine, 118 then setglobalrings() is to be called before, as most of 119 them use these rings. 120 121 pdivi(f,F); Performs a pseudodivision of a parametric polynomial 122 by a parametric ideal. 96 123 97 124 pnormalf(f,E,N); Reduces a parametric polynomial f over V(E) \ V(N) 98 E is the null ideal and N the non-null ideal 99 over the parameters. 100 Can be used without calling presiouly setglobalrings(), 101 102 Prep(N,M); Computes the P-representation of V(N) \ V(M). 103 Can be used without calling previously setglobalrings(). 104 105 extend(GC); When the grobcov of an ideal has been computed 106 with the default option ('ext',0) and the explicit 107 option ('rep',2) (which is not the default), then 108 one can call extend (GC) (and options) to obtain the 109 full representation of the bases. With the default 110 option ('ext',0) only the generic representation of 111 the bases are computed, and one can obtain the full 112 representation using extend. 113 Can be used without calling presiouly setglobalrings(), 114 115 locus(G): Special routine for determining the locus of points 116 of objects. Given a parametric ideal J with 117 parameters (a_1,..a_m) and variables (x_1,..,xn), 118 representing the system determining 119 the locus of points (a_1,..,a_m)) who verify certain 120 properties, computing the grobcov G of 121 J and applying to it locus, determines the different 122 classes of locus components. They can be 123 Normal, Special, Accumulation point, Degenerate. 124 The output are the components given in P-canonical form 125 of two constructible sets: Normal, and Non-Normal 126 The Normal Set has Normal and Special components 127 The Non-Normal set has Accumulation and Degenerate components. 128 The description of the algorithm and definitions will be 129 given in a forthcoming paper by Abanades, Botana, Montes, Recio: 130 ''An Algebraic Taxonomy for Locus Computation in Dynamic Geometry''. 131 Can be used without calling presiouly setglobalrings(), 132 133 locusdg(G): Is a special routine for computing the locus in dinamical geometry. 134 It detects automatically a possible point that is to be avoided by the mover, 135 whose coordinates must be the last two coordinates in the definition of the ring. 136 If such a point is detected, then it eliminates the segments of the grobcov 137 depending on the point that is to be avoided. 138 Then it calls locus. 139 Can be used without calling presiouly setglobalrings(), 140 141 locusto(L): Transforms the output of locus to a string that 142 can be reed from different computational systems. 143 Can be used without calling presiouly setglobalrings(), 144 145 addcons(L): Given a disjoint set of locally closed subsets in P-representation, 146 it returns the canonical P-representation of the constructible set 147 formed by the union of them. 148 Can be used without calling presiouly setglobalrings(), 125 ( E is the null ideal and N the non-null ideal ) 126 over the parameters. 127 128 Crep(N,M); Computes the canonical C-representation of V(N) \ V(M). 129 130 Prep(N,M); Computes the canonical P-representation of V(N) \ V(M). 131 132 PtoCrep(L) Starting from the canonical Prep of a locally closed set 133 computes its Crep. 134 135 extend(GC); When the grobcov of an ideal has been computed 136 with the default option ('ext',0) and the explicit 137 option ('rep',2) (which is not the default), then 138 one can call extend (GC) (and options) to obtain the 139 full representation of the bases. With the default 140 option ('ext',0) only the generic representation of 141 the bases are computed, and one can obtain the full 142 representation using extend. 143 144 locus(G); Special routine for determining the geometrical locus of points 145 verifying given conditions. Given a parametric ideal J with 146 parameters (x,y) and variables (x_1,..,xn), representing the 147 system determining the locus of points (x,y) who verify certain 148 properties, one can apply locus to the output of grobcov(J), 149 locus determines the different classes of locus components. 150 described in the paper: 151 152 \"An Algebraic Taxonomy for Locus Computation in Dynamic Geometry\", 153 M. Abanades, F. Botana, A. Montes, T. Recio, 154 Computer-Aided Design 56 (2014) 22-33. 155 156 The components can be 'Normal', 'Special', 'Accumulation', 'Degenerate'. 157 The output are the components is given in P-canonical form 158 It also detects automatically a possible point that is to be 159 avoided by the mover, whose coordinates must be the last two 160 coordinates in the definition of the ring. If such a point is detected, 161 then it eliminates the segments of the grobcov depending on the 162 point that is to be avoided. 163 164 locusdg(G); Is a special routine that determines the 'Relevant' components 165 of the locus in dynamic geometry. It is to be called to the output of locus 166 and selects from it the useful components. 167 168 envelop(F,C); Special routine for determining the envelop of a family of curves 169 F in Q[x,y][x_1,..xn] depending on a ideal of constraints C in Q[x_1,..,xn]. 170 It detemines the different components as well as its type: 171 'Normal', 'Special', 'Accumulation', 'Degenerate'. And 172 it also classifies the Special components, determining the 173 zero dimensional antiimage of the component and verifying if 174 the component is a special curve of the family or not. 175 It calls internally first grobcov and then locus with special options 176 to obtain the complete result. 177 The taxonomy that it provides, as well as the algorithms involved 178 will be described in a forthcoming paper: 179 180 Abanades, Botana, Montes, Recio: 181 \''Envelops in Dynamic Geometry using the Gr\"obner cover\''. 182 183 184 envelopdg(ev); Is a special routine to determine the 'Relevant' components 185 of the envelop of a family of curves to be used in Dynamic Geometry. 186 It must be called to the output of envelop(F,C). 187 188 locusto(L); Transforms the output of locus, locusdg, envelop and envelopdg 189 into a string that can be reed from different computational systems. 190 191 AddCons(L); Uses the routine AddConsP. Given a set of locally closed sets as 192 difference of of varieties (does not need to be in C-representation) 193 it returns the canonical P-representation of the constructible set 194 formed by the union of them. The result is formed by a set of embedded, 195 disjoint, locally closed sets (levels). 196 197 AddConsP(L); Given a set of locally closed P-components, it returns the 198 canonical P-representation of the constructible set 199 formed by the union of them, consisting of a set of embedded, 200 disjoint locally closed sets (levels). 201 The routines AddCons and AddConsP and the canonical structure 202 of the constructible sets will be described in a forthcoming paper. 203 204 A. Montes, J.M. Brunat, 205 \"Canonical representations of constructible sets\". 149 206 150 207 SEE ALSO: compregb_lib … … 157 214 158 215 // Library grobcov.lib 159 // (Groebner cover):160 // Release 1: (public)216 // (Groebner Cover): 217 // Release 0: (public) 161 218 // Initial data: 21-1-2008 219 // Uses buildtree for cgsdr 162 220 // Final data: 3-7-2008 163 221 // Release 2: (private) 164 222 // Initial data: 6-9-2009 223 // Last version using buildtree for cgsdr 165 224 // Final data: 25-10-2011 166 // Release 3:225 // Release B: (private) 167 226 // Initial data: 1-7-2012 227 // Uses both buildtree and KSW for cgsdr 168 228 // Final data: 4-9-2012 169 // Release 4: (this release,public)229 // Release G: (public) 170 230 // Initial data: 4-9-2012 231 // Uses KSW algorithm for cgsdr 171 232 // Final data: 21-11-2013 172 // basering Q[a][x]; 173 174 // ************ Begin of buildtree ****************************** 175 176 proc setglobalrings() 177 "USAGE: setglobalrings(); 178 No arguments 179 RETURN: After its call the rings @R=Q[a][x], @P=Q[a], @RP=Q[x,a] are 180 defined as global variables. 181 NOTE: It is called internally by the fundamental routines of the 182 library grobcov, cgsdr, extend, pdivi, pnormalf, locus, locusdg, locusto, 183 and killed before the output. 184 The user does not need to call it, except when it is interested 185 in using some internal routine of the library that 186 uses these rings. 187 The basering R, must be of the form Q[a][x], a=parameters, 188 x=variables, and should be defined previously. 189 KEYWORDS: ring, rings 190 EXAMPLE: setglobalrings; shows an example" 191 { 192 if (defined(@P)) 193 { 194 kill @P; kill @R; kill @RP; 195 } 233 // Release K: (public) 234 // Updated locus: 8-1-2015 235 // Updated AddConsP and AddCons: 8-1-2015 236 // Reformed many routines, examples and helps: 8-1-2015 237 // New routines for computing the envelop of a family of curves: 22-1-2015 238 // Final data: 22-1-2015 239 240 //*************Auxiliary routines************** 241 242 // elimintfromideal: elimine the constant numbers from an ideal 243 // (designed for W, nonnull conditions) 244 // Input: ideal J 245 // Output:ideal K with the elements of J that are non constants, in the 246 // ring K[x1,..,xm] 247 static proc elimintfromideal(ideal J) 248 { 249 int i; 250 int j=0; 251 ideal K; 252 if (size(J)==0){return(ideal(0));} 253 for (i=1;i<=ncols(J);i++){if (size(variables(J[i])) !=0){j++; K[j]=J[i];}} 254 return(K); 255 } 256 257 // delfromideal: deletes the i-th polynomial from the ideal F 258 // Works in any kind of ideal 259 static proc delfromideal(ideal F, int i) 260 { 261 int j; 262 ideal G; 263 if (size(F)<i){ERROR("delfromideal was called with incorrect arguments");} 264 if (size(F)<=1){return(ideal(0));} 265 if (i==0){return(F)}; 266 for (j=1;j<=ncols(F);j++) 267 { 268 if (j!=i){G[ncols(G)+1]=F[j];} 269 } 270 return(G); 271 } 272 273 // delidfromid: deletes the polynomials in J that are in I 274 // Input: ideals I, J 275 // Output: the ideal J without the polynomials in I 276 // Works in any kind of ideal 277 static proc delidfromid(ideal I, ideal J) 278 { 279 int i; list r; 280 ideal JJ=J; 281 for (i=1;i<=size(I);i++) 282 { 283 r=memberpos(I[i],JJ); 284 if (r[1]) 285 { 286 JJ=delfromideal(JJ,r[2]); 287 } 288 } 289 return(JJ); 290 } 291 292 // eliminates the ith element from a list or an intvec 293 static proc elimfromlist(l, int i) 294 { 295 if(typeof(l)=="list"){list L;} 296 if (typeof(l)=="intvec"){intvec L;} 297 if (typeof(l)=="ideal"){ideal L;} 298 int j; 299 if((size(l)==0) or (size(l)==1 and i!=1)){return(l);} 300 if (size(l)==1 and i==1){return(L);} 301 // L=l[1]; 302 if(i==1) 303 { 304 for(j=2;j<=size(l);j++) 305 { 306 L[j-1]=l[j]; 307 } 308 } 309 else 310 { 311 for(j=1;j<=i-1;j++) 312 { 313 L[j]=l[j]; 314 } 315 for(j=i+1;j<=size(l);j++) 316 { 317 L[j-1]=l[j]; 318 } 319 } 320 return(L); 321 } 322 323 // eliminates repeated elements form an ideal or matrix or module or intmat or bigintmat 324 static proc elimrepeated(F) 325 { 326 int i; 327 int nt; 328 if (typeof(F)=="ideal"){nt=ncols(F);} 329 else{nt=size(F);} 330 331 def FF=F; 332 FF=F[1]; 333 for (i=2;i<=nt;i++) 334 { 335 if (not(memberpos(F[i],FF)[1])) 336 { 337 FF[size(FF)+1]=F[i]; 338 } 339 } 340 return(FF); 341 } 342 343 344 // equalideals 345 // Input: ideals F and G; 346 // Output: 1 if they are identical (the same polynomials in the same order) 347 // 0 else 348 static proc equalideals(ideal F, ideal G) 349 { 350 int i=1; int t=1; 351 if (size(F)!=size(G)){return(0);} 352 while ((i<=size(F)) and (t)) 353 { 354 if (F[i]!=G[i]){t=0;} 355 i++; 356 } 357 return(t); 358 } 359 360 // returns 1 if the two lists of ideals are equal and 0 if not 361 static proc equallistideals(list L, list M) 362 { 363 int t; int i; 364 if (size(L)!=size(M)){return(0);} 365 else 366 { 367 t=1; 368 if (size(L)>0) 369 { 370 i=1; 371 while ((t) and (i<=size(L))) 372 { 373 if (equalideals(L[i],M[i])==0){t=0;} 374 i++; 375 } 376 } 377 return(t); 378 } 379 } 380 381 // idcontains 382 // Input: ideal p, ideal q 383 // Output: 1 if p contains q, 0 otherwise 384 // If the routine is to be called from the top, a previous call to 385 // setglobalrings() is needed. 386 static proc idcontains(ideal p, ideal q) 387 { 388 int t; int i; 389 t=1; i=1; 390 def P=p; def Q=q; 391 attrib(P,"isSB",1); 392 poly r; 393 while ((t) and (i<=size(Q))) 394 { 395 r=reduce(Q[i],P); 396 if (r!=0){t=0;} 397 i++; 398 } 399 return(t); 400 } 401 402 403 // selectminideals 404 // given a list of ideals returns the list of integers corresponding 405 // to the minimal ideals in the list 406 // Input: L (list of ideals) 407 // Output: the list of integers corresponding to the minimal ideals in L 408 // Works in Q[u_1,..,u_m] 409 static proc selectminideals(list L) 410 { 411 list P; int i; int j; int t; 412 if(size(L)==0){return(L)}; 413 if(size(L)==1){P[1]=1; return(P);} 414 for (i=1;i<=size(L);i++) 415 { 416 t=1; 417 j=1; 418 while ((t) and (j<=size(L))) 419 { 420 if (i!=j) 421 { 422 if(idcontains(L[i],L[j])==1) 423 { 424 t=0; 425 } 426 } 427 j++; 428 } 429 if (t){P[size(P)+1]=i;} 430 } 431 return(P); 432 } 433 434 435 // Auxiliary routine 436 // elimconstfac: eliminate the factors in the polynom f that are in Q[a] 437 // Input: 438 // poly f: 439 // list L: of components of the segment 440 // Output: 441 // poly f2 where the factors of f in Q[a] that are non-null on any component 442 // have been dropped from f 443 static proc elimconstfac(poly f) 444 { 445 int cond; int i; int j; int t; 446 if (f==0){return(f);} 196 447 def RR=basering; 197 def @R=basering; // must be of the form K[a][x], a=parameters, x=variables 198 list Rx=ringlist(RR); 199 def @P=ring(Rx[1]); 200 list Lx; 201 Lx[1]=0; 202 Lx[2]=Rx[2]+Rx[1][2]; 203 Lx[3]=Rx[1][3]; 204 Lx[4]=Rx[1][4]; 205 Rx[1]=0; 206 def D=ring(Rx); 207 def @RP=D+@P; 208 export(@R); // global ring K[a][x] 209 export(@P); // global ring K[a] 210 export(@RP); // global ring K[x,a] with product order 448 setring(@R); 449 def ff=imap(RR,f); 450 def l=factorize(ff,0); 451 poly f1=1; 452 for(i=2;i<=size(l[1]);i++) 453 { 454 f1=f1*(l[1][i])^(l[2][i]); 455 } 211 456 setring(RR); 212 } 213 example 214 { "EXAMPLE:"; echo = 2; 215 ring R=(0,a,b),(x,y,z),dp; 216 setglobalrings(); 217 Grobcov::@R; 218 Grobcov::@P; 219 Grobcov::@RP; 220 ringlist(Grobcov::@R); 221 ringlist(Grobcov::@P); 222 ringlist(Grobcov::@RP); 223 } 224 225 //*************Auxiliary routines************** 226 227 // cld : clears denominators of an ideal and normalizes to content 1 228 // can be used in @R or @P or @RP 229 // input: 230 // ideal J (J can be also poly), but the output is an ideal; 231 // output: 232 // ideal Jc (the new form of ideal J without denominators and 233 // normalized to content 1) 234 proc cld(ideal J) 235 { 236 if (size(J)==0){return(ideal(0));} 237 int te=0; 238 def RR=basering; 239 if(not(defined(@RP))) 240 { 241 te=1; 242 setglobalrings(); 243 } 244 setring(@RP); 245 def Ja=imap(RR,J); 246 ideal Jb; 247 if (size(Ja)==0){setring(RR); return(ideal(0));} 248 int i; 249 def j=0; 250 for (i=1;i<=ncols(Ja);i++){if (size(Ja[i])!=0){j++; Jb[j]=cleardenom(Ja[i]);}} 251 setring(RR); 252 def Jc=imap(@RP,Jb); 253 if(te){kill @R; kill @RP; kill @P;} 254 return(Jc); 255 } 256 257 proc memberpos(f,J) 457 def f2=imap(@R,f1); 458 return(f2); 459 }; 460 461 static proc memberpos(f,J) 258 462 //"USAGE: memberpos(f,J); 259 463 // (f,J) expected (polynomial,ideal) … … 264 468 // or (ideal,list(ideal)) 265 469 // or (list(intvec), list(list(intvec))). 266 // The ring can be @R or @P or @RP or any other.470 // Works in any kind of ideals 267 471 //RETURN: The list (t,pos) t int; pos int; 268 472 // t is 1 if f belongs to J and 0 if not. … … 379 583 //} 380 584 381 proc subset(J,K) 585 // Auxiliary routine 586 // pos 587 // Input: intvec p of zeros and ones 588 // Output: intvec W of the positions where p has ones. 589 static proc pos(intvec p) 590 { 591 int i; 592 intvec W; int j=1; 593 for (i=1; i<=size(p); i++) 594 { 595 if (p[i]==1){W[j]=i; j++;} 596 } 597 return(W); 598 } 599 600 // Input: 601 // A,B: lists of ideals 602 // Output: 603 // 1 if both lists of ideals are equal, or 0 if not 604 static proc equallistsofideals(list A, list B) 605 { 606 int i; 607 int tes=0; 608 if (size(A)!=size(B)){return(tes);} 609 tes=1; i=1; 610 while(tes==1 and i<=size(A)) 611 { 612 if (equalideals(A[i],B[i])==0){tes=0; return(tes);} 613 i++; 614 } 615 return(tes); 616 } 617 618 // Input: 619 // A,B: lists of P-rep, i.e. of the form [p_i,[p_{i1},..,p_{ij_i}]] 620 // Output: 621 // 1 if both lists of P-reps are equal, or 0 if not 622 static proc equallistsA(list A, list B) 623 { 624 int tes=0; 625 if(equalideals(A[1],B[1])==0){return(tes);} 626 tes=equallistsofideals(A[2],B[2]); 627 return(tes); 628 } 629 630 // Input: 631 // A,B: lists lists of of P-rep, i.e. of the form [[p_1,[p_{11},..,p_{1j_1}]] .. [p_i,[p_{i1},..,p_{ij_i}]] 632 // Output: 633 // 1 if both lists of lists of P-rep are equal, or 0 if not 634 static proc equallistsAall(list A,list B) 635 { 636 int i; int tes; 637 if(size(A)!=size(B)){return(tes);} 638 tes=1; i=1; 639 while(tes and i<=size(A)) 640 { 641 tes=equallistsA(A[i],B[i]); 642 i++; 643 } 644 return(tes); 645 } 646 647 // idint: ideal intersection 648 // in the ring @P. 649 // it works in an extended ring 650 // input: two ideals in the ring @P 651 // output the intersection of both (is not a GB) 652 static proc idint(ideal I, ideal J) 653 { 654 def RR=basering; 655 ring T=0,t,lp; 656 def K=T+RR; 657 setring(K); 658 def Ia=imap(RR,I); 659 def Ja=imap(RR,J); 660 ideal IJ; 661 int i; 662 for(i=1;i<=size(Ia);i++){IJ[i]=t*Ia[i];} 663 for(i=1;i<=size(Ja);i++){IJ[size(Ia)+i]=(1-t)*Ja[i];} 664 ideal eIJ=eliminate(IJ,t); 665 setring(RR); 666 return(imap(K,eIJ)); 667 } 668 669 //purpose ideal intersection called in @R and computed in @P 670 static proc idintR(ideal N, ideal M) 671 { 672 def RR=basering; 673 setring(@P); 674 def Np=imap(RR,N); 675 def Mp=imap(RR,M); 676 def Jp=idint(Np,Mp); 677 setring(RR); 678 return(imap(@P,Jp)); 679 } 680 681 // Auxiliary routine 682 // comb: the list of combinations of elements (1,..n) of order p 683 static proc comb(int n, int p) 684 { 685 list L; list L0; 686 intvec c; intvec d; 687 int i; int j; int last; 688 if ((n<0) or (n<p)) 689 { 690 return(L); 691 } 692 if (p==1) 693 { 694 for (i=1;i<=n;i++) 695 { 696 c=i; 697 L[size(L)+1]=c; 698 } 699 return(L); 700 } 701 else 702 { 703 L0=comb(n,p-1); 704 for (i=1;i<=size(L0);i++) 705 { 706 c=L0[i]; d=c; 707 last=c[size(c)]; 708 for (j=last+1;j<=n;j++) 709 { 710 d[size(c)+1]=j; 711 L[size(L)+1]=d; 712 } 713 } 714 return(L); 715 } 716 } 717 718 // Auxiliary routine 719 // combrep 720 // Input: V=(n_1,..,n_i) 721 // Output: L=(v_1,..,v_p) where p=prod_j=1^i (n_j) 722 // is the list of all intvec v_j=(v_j1,..,v_ji) where 1<=v_jk<=n_i 723 static proc combrep(intvec V) 724 { 725 list L; list LL; 726 int i; int j; int k; intvec W; 727 if (size(V)==1) 728 { 729 for (i=1;i<=V[1];i++) 730 { 731 L[i]=intvec(i); 732 } 733 return(L); 734 } 735 for (i=1;i<size(V);i++) 736 { 737 W[i]=V[i]; 738 } 739 LL=combrep(W); 740 for (i=1;i<=size(LL);i++) 741 { 742 W=LL[i]; 743 for (j=1;j<=V[size(V)];j++) 744 { 745 W[size(V)]=j; 746 L[size(L)+1]=W; 747 } 748 } 749 return(L); 750 } 751 752 static proc subset(J,K) 382 753 //"USAGE: subset(J,K); 383 754 // (J,K) expected (ideal,ideal) … … 405 776 //} 406 777 407 // elimintfromideal: elimine the constant numbers from an ideal 408 // (designed for W, nonnull conditions) 409 // input: ideal J 410 // output:ideal K with the elements of J that are non constants, in the 411 // ring @P 412 proc elimintfromideal(ideal J) 413 { 778 proc setglobalrings() 779 "USAGE: setglobalrings(); 780 No arguments 781 RETURN: After its call the rings @R=Q[a][x], @P=Q[a], @RP=Q[x,a] are 782 defined as global variables. (a=parameters, x=variables) 783 NOTE: It is called internally by many basic routines of the 784 library grobcov, cgsdr, extend, pdivi, pnormalf, locus, locusdg, 785 envelop, envelopdg, and killed before the output. 786 The user does not need to call it, except when it is interested 787 in using some internal routine of the library that 788 uses these rings. 789 The basering R, must be of the form Q[a][x], (a=parameters, 790 x=variables), and should be defined previously. 791 KEYWORDS: ring, rings 792 EXAMPLE: setglobalrings; shows an example" 793 { 794 if (defined(@P)) 795 { 796 kill @P; kill @R; kill @RP; 797 } 798 def RR=basering; 799 def @R=basering; // must be of the form Q[a][x], (a=parameters, x=variables) 800 def Rx=ringlist(RR); 801 def @P=ring(Rx[1]); 802 list Lx; 803 Lx[1]=0; 804 Lx[2]=Rx[2]+Rx[1][2]; 805 Lx[3]=Rx[1][3]; 806 Lx[4]=Rx[1][4]; 807 Rx[1]=0; 808 def D=ring(Rx); 809 def @RP=D+@P; 810 export(@R); // global ring Q[a][x] 811 export(@P); // global ring Q[a] 812 export(@RP); // global ring K[x,a] with product order 813 setring(RR); 814 }; 815 example 816 { 817 "EXAMPLE:"; echo = 2; 818 ring R=(0,a,b),(x,y,z),dp; 819 setglobalrings(); 820 R; 821 Grobcov::@R; 822 Grobcov::@P; 823 Grobcov::@RP; 824 ringlist(Grobcov::@R); 825 ringlist(Grobcov::@P); 826 ringlist(Grobcov::@RP); 827 } 828 829 // cld : clears denominators of an ideal and normalizes to content 1 830 // can be used in @R or @P or @RP 831 // input: 832 // ideal J (J can be also poly), but the output is an ideal; 833 // output: 834 // ideal Jc (the new form of ideal J without denominators and 835 // normalized to content 1) 836 static proc cld(ideal J) 837 { 838 if (size(J)==0){return(ideal(0));} 839 int te=0; 840 def RR=basering; 841 if(not(defined(@RP))) 842 { 843 te=1; 844 setglobalrings(); 845 } 846 setring(@RP); 847 def Ja=imap(RR,J); 848 ideal Jb; 849 if (size(Ja)==0){setring(RR); return(ideal(0));} 414 850 int i; 415 int j=0; 416 ideal K; 417 if (size(J)==0){return(ideal(0));} 418 for (i=1;i<=ncols(J);i++){if (size(variables(J[i])) !=0){j++; K[j]=J[i];}} 419 return(K); 420 } 851 def j=0; 852 for (i=1;i<=ncols(Ja);i++){if (size(Ja[i])!=0){j++; Jb[j]=cleardenom(Ja[i]);}} 853 setring(RR); 854 def Jc=imap(@RP,Jb); 855 if(te){kill @R; kill @RP; kill @P;} 856 return(Jc); 857 }; 421 858 422 859 // simpqcoeffs : simplifies a quotient of two polynomials 423 860 // input: two coeficients (or terms), that are considered as a quotient 424 861 // output: the two coeficients reduced without common factors 425 proc simpqcoeffs(poly n,poly m)426 { 427 numbernc=content(n);428 numbermc=content(m);429 numbergc=gcd(nc,mc);862 static proc simpqcoeffs(poly n,poly m) 863 { 864 def nc=content(n); 865 def mc=content(m); 866 def gc=gcd(nc,mc); 430 867 ideal s=n/gc,m/gc; 431 868 return (s); … … 439 876 // list (poly r, ideal q, poly mu) 440 877 proc pdivi(poly f,ideal F) 441 "USAGE: 442 poly f: the polynomial to be divided443 ideal F: the divisor ideal 444 RETURN: 878 "USAGE: pdivi(f,F); 879 poly f: the polynomialin Q[a][x] to be divided 880 ideal F: the divisor ideal in Q[a][x]. 881 RETURN: A list (poly r, ideal q, poly m). r is the remainder of the 445 882 pseudodivision, q is the set of quotients, and m is the 446 883 coefficient factor by which f is to be multiplied. 447 NOTE: pseudodivision of a poly f by an ideal F in @R. Returns a884 NOTE: pseudodivision of a poly f by an ideal F in Q[a][x]. Returns a 448 885 list (r,q,m) such that m*f=r+sum(q.G), and no lpp of a divisor 449 886 divides a pp of r. … … 451 888 EXAMPLE: pdivi; shows an example" 452 889 { 890 F=simplify(F,2); 453 891 int i; 454 892 int j; 455 // string("T_f=",f);456 893 poly v=1; 457 894 for(i=1;i<=nvars(basering);i++){v=v*var(i);} 458 int te=0;459 def R=basering;460 if (defined(@P)==1){te=1;}461 else{setglobalrings();}462 895 poly r=0; 463 896 poly mu=1; 464 897 def p=f; 465 898 ideal q; 466 for (i=1; i<= size(F); i++){q[i]=0;};899 for (i=1; i<=ncols(F); i++){q[i]=0;}; 467 900 ideal lpf; 468 901 ideal lcf; 469 for (i=1;i<= size(F);i++){lpf[i]=leadmonom(F[i]);}470 for (i=1;i<= size(F);i++){lcf[i]=leadcoef(F[i]);}902 for (i=1;i<=ncols(F);i++){lpf[i]=leadmonom(F[i]);} 903 for (i=1;i<=ncols(F);i++){lcf[i]=leadcoef(F[i]);} 471 904 poly lpp; 472 905 poly lcp; … … 492 925 rho=qlc[1]*qlm; 493 926 p=nu*p-rho*F[i]; 494 // string("i=",i," coef(p,v)=",coef(p,v));495 927 r=nu*r; 496 928 for (j=1;j<=size(F);j++){q[j]=nu*q[j];} … … 504 936 r=r+lcp*lpp; 505 937 p=p-lcp*lpp; 506 // string("pasa al rem p=",p);507 938 } 508 939 } 509 940 list res=r,q,mu; 510 if(te==0){kill @P; kill @R; kill @RP;}511 941 return(res); 512 942 } 513 943 example 514 { "EXAMPLE:"; echo = 2; 944 { 945 "EXAMPLE:"; echo = 2; 515 946 ring R=(0,a,b,c),(x,y),dp; 516 "Divisor=";517 947 poly f=(ab-ac)*xy+(ab)*x+(5c); 518 "Dividends="; 948 // Divisor="; 949 f; 519 950 ideal F=ax+b,cy+a; 520 "(Remainder, quotients, factor)="; 951 // Dividends="; 952 F; 521 953 def r=pdivi(f,F); 954 // (Remainder, quotients, factor)="; 522 955 r; 523 "Verifying the division: r[3]*f-(r[2][1]*F[1]+r[2][2]*F[2])-r[1] =";524 r[3]*f-(r[2][1]*F[1]+r[2][2]*F[2] )-r[1];956 // Verifying the division: 957 r[3]*f-(r[2][1]*F[1]+r[2][2]*F[2]+r[1]); 525 958 } 526 959 … … 534 967 // if red then S reduces by Buchberger 1st criterion 535 968 // (not used) 536 proc pspol(poly f,poly g)969 static proc pspol(poly f,poly g) 537 970 { 538 971 def lcf=leadcoef(f); … … 559 992 // of ideal J (non repeated). Integer factors are ignored, 560 993 // even 0 is ignored. It can be called from ideal @R. 561 proc facvar(ideal J)994 static proc facvar(ideal J) 562 995 //"USAGE: facvar(J); 563 996 // J: an ideal in the parameters … … 605 1038 // ideal E of null-conditions 606 1039 // ideal N of non-null conditions 607 // (E,N) represents V(E) \V(N),608 // Ered eliminates the non-null factors of f in V(E) \V(N)1040 // (E,N) represents V(E) \ V(N), 1041 // Ered eliminates the non-null factors of f in V(E) \ V(N) 609 1042 // output: 610 1043 // poly f2 where the non-null conditions have been dropped from f 611 proc Ered(poly f,ideal E, ideal N)1044 static proc Ered(poly f,ideal E, ideal N) 612 1045 { 613 1046 def RR=basering; … … 663 1096 } 664 1097 665 // pnormalf: reduces a polynomial f wrt a V(E) \V(N)1098 // pnormalf: reduces a polynomial f wrt a V(E) \ V(N) 666 1099 // dividing by E and eliminating factors in N. 667 1100 // called in the ring @R, … … 671 1104 // ideal E (depends only on the parameters) 672 1105 // ideal N (depends only on the parameters) 673 // (E,N) represents V(E) \V(N)1106 // (E,N) represents V(E) \ V(N) 674 1107 // optional: 675 // output: poly f2 reduced wrt to V(E) \V(N)1108 // output: poly f2 reduced wrt to V(E) \ V(N) 676 1109 proc pnormalf(poly f, ideal E, ideal N) 677 "USAGE: 678 f: the polynomial to be reduced modulo V(E)\V(N)679 of a segment in the parameters.680 E: the null conditions ideal 681 N: the non-null conditions 682 RETURN: 1110 "USAGE: pnormalf(f,E,N); 1111 f: the polynomial in Q[a][x] (a=parameters, x=variables) to be 1112 reduced modulo V(E) \ V(N) of a segment in Q[a]. 1113 E: the null conditions ideal in Q[a] 1114 N: the non-null conditions in Q[a] 1115 RETURN: a reduced polynomial g of f, whose coefficients are reduced 683 1116 modulo E and having no factor in N. 684 1117 NOTE: Should be called from ring Q[a][x]. 685 Ideals E and N must be given by polynomials 686 in the parameters. 1118 Ideals E and N must be given by polynomials in Q[a]. 687 1119 KEYWORDS: division, pdivi, reduce 688 EXAMPLE: 1120 EXAMPLE: pnormalf; shows an example" 689 1121 { 690 1122 def RR=basering; … … 705 1137 if(te==0){kill @R; kill @RP; kill @P;} 706 1138 return(f2) 707 } 1139 }; 708 1140 example 709 { "EXAMPLE:"; echo = 2; 1141 { 1142 "EXAMPLE:"; echo = 2; 710 1143 ring R=(0,a,b,c),(x,y),dp; 1144 short=0; 711 1145 poly f=(b^2-1)*x^3*y+(c^2-1)*x*y^2+(c^2*b-b)*x+(a-bc)*y; 712 1146 ideal E=(c-1); 713 1147 ideal N=a-b; 1148 714 1149 pnormalf(f,E,N); 715 }716 717 // idint: ideal intersection718 // in the ring @P.719 // it works in an extended ring720 // input: two ideals in the ring @P721 // output the intersection of both (is not a GB)722 proc idint(ideal I, ideal J)723 {724 def RR=basering;725 ring T=0,t,lp;726 def K=T+RR;727 setring(K);728 def Ia=imap(RR,I);729 def Ja=imap(RR,J);730 ideal IJ;731 int i;732 for(i=1;i<=size(Ia);i++){IJ[i]=t*Ia[i];}733 for(i=1;i<=size(Ja);i++){IJ[size(Ia)+i]=(1-t)*Ja[i];}734 ideal eIJ=eliminate(IJ,t);735 setring(RR);736 return(imap(K,eIJ));737 1150 } 738 1151 … … 740 1153 // input: two polynomials f,g in the ring @R 741 1154 // output: 0 if f<g, 1 if f>=g 742 proc lesspol(poly f, poly g)1155 static proc lesspol(poly f, poly g) 743 1156 { 744 1157 if (leadmonom(f)<leadmonom(g)){return(1);} … … 752 1165 } 753 1166 } 754 } 755 756 // delfromideal: deletes the i-th polynomial from the ideal F 757 proc delfromideal(ideal F, int i) 758 { 759 int j; 760 ideal G; 761 if (size(F)<i){ERROR("delfromideal was called incorrect arguments");} 762 if (size(F)<=1){return(ideal(0));} 763 if (i==0){return(F)}; 764 for (j=1;j<=size(F);j++) 765 { 766 if (j!=i){G[size(G)+1]=F[j];} 767 } 768 return(G); 769 } 770 771 // delidfromid: deletes the polynomials in J that are in I 772 // input: ideals I,J 773 // output: the ideal J without the polynomials in I 774 proc delidfromid(ideal I, ideal J) 775 { 776 int i; list r; 777 ideal JJ=J; 778 for (i=1;i<=size(I);i++) 779 { 780 r=memberpos(I[i],JJ); 781 if (r[1]) 782 { 783 JJ=delfromideal(JJ,r[2]); 784 } 785 } 786 return(JJ); 787 } 1167 }; 788 1168 789 1169 // sortideal: sorts the polynomials in an ideal by lm in ascending order 790 proc sortideal(ideal Fi)1170 static proc sortideal(ideal Fi) 791 1171 { 792 1172 def RR=basering; … … 802 1182 j=1; 803 1183 p=H[1]; 804 for (i=1;i<= size(H);i++)1184 for (i=1;i<=ncols(H);i++) 805 1185 { 806 1186 if(lesspol(H[i],p)){j=i;p=H[j];} 807 1187 } 808 G[ size(G)+1]=p;1188 G[ncols(G)+1]=p; 809 1189 H=delfromideal(H,j); 1190 H=simplify(H,2); 810 1191 } 811 1192 setring(RR); 812 1193 def GG=imap(@RP,G); 1194 GG=simplify(GG,2); 813 1195 return(GG); 814 1196 } 815 1197 816 1198 // mingb: given a basis (gb reducing) it 817 // order the polynomials i sascending order and1199 // order the polynomials in ascending order and 818 1200 // eliminates the polynomials whose lpp are divisible by some 819 1201 // smaller one 820 proc mingb(ideal F)1202 static proc mingb(ideal F) 821 1203 { 822 1204 int t; int i; int j; … … 841 1223 // redgbn: given a minimal basis (gb reducing) it 842 1224 // reduces each polynomial wrt to V(E) \ V(N) 843 proc redgbn(ideal F, ideal E, ideal N)1225 static proc redgbn(ideal F, ideal E, ideal N) 844 1226 { 845 1227 int te=0; … … 859 1241 } 860 1242 861 // eliminates repeated elements form an ideal or matrix or module or intmat or bigintmat862 proc elimrepeated(F)863 {864 int i;865 int nt;866 if (typeof(F)=="ideal"){nt=ncols(F);}867 else{nt=size(F);}868 869 def FF=F;870 FF=F[1];871 for (i=2;i<=nt;i++)872 {873 if (not(memberpos(F[i],FF)[1]))874 {875 FF[size(FF)+1]=F[i];876 }877 }878 return(FF);879 }880 881 proc elimrepeatedvl(F)882 {883 int i;884 def FF=F;885 FF=F[1];886 for (i=2;i<=size(F);i++)887 {888 if (not(memberpos(F[i],FF)[1]))889 {890 FF[size(FF)+1]=F[i];891 }892 }893 return(FF);894 }895 896 897 // equalideals898 // input: 2 ideals F and G;899 // output: 1 if they are identical (the same polynomials in the same order)900 // 0 else901 proc equalideals(ideal F, ideal G)902 {903 int i=1; int t=1;904 if (size(F)!=size(G)){return(0);}905 while ((i<=size(F)) and (t))906 {907 if (F[i]!=G[i]){t=0;}908 i++;909 }910 return(t);911 }912 913 // delintvec914 // input: intvec V915 // int i916 // output:917 // intvec W (equal to V but the coordinate i is deleted918 proc delintvec(intvec V, int i)919 {920 int j;921 intvec W;922 for (j=1;j<i;j++){W[j]=V[j];}923 for (j=i+1;j<=size(V);j++){W[j-1]=V[j];}924 return(W);925 }926 927 1243 //**************Begin homogenizing************************ 928 1244 … … 931 1247 // input: poly f 932 1248 // output 1 if f is homogeneous, 0 if not 933 proc ishomog(f)1249 static proc ishomog(f) 934 1250 { 935 1251 int i; poly r; int d; int dr; … … 947 1263 // postredgb: given a minimal basis (gb reducing) it 948 1264 // reduces each polynomial wrt to the others 949 proc postredgb(ideal F)1265 static proc postredgb(ideal F) 950 1266 { 951 1267 int te=0; … … 964 1280 } 965 1281 966 //purpose ideal intersection called in @R and computed in @P967 proc idintR(ideal N, ideal M)968 {969 def RR=basering;970 setring(@P);971 def Np=imap(RR,N);972 def Mp=imap(RR,M);973 def Jp=idint(Np,Mp);974 setring(RR);975 return(imap(@P,Jp));976 }977 1282 978 1283 //purpose reduced Groebner basis called in @R and computed in @P 979 proc gbR(ideal N)1284 static proc gbR(ideal N) 980 1285 { 981 1286 def RR=basering; … … 997 1302 // poly f: 998 1303 // Output: Na = N:<f> 999 proc incquotient(ideal N, poly f)1304 static proc incquotient(ideal N, poly f) 1000 1305 { 1001 1306 poly g; int i; … … 1044 1349 } 1045 1350 1046 // eliminates the ith element from a list or an intvec1047 proc elimfromlist(def l, int i)1048 {1049 if(typeof(l)=="list"){list L;}1050 if (typeof(l)=="intvec"){intvec L;}1051 if (typeof(l)=="ideal"){ideal L;}1052 int j;1053 if((size(l)==0) or (size(l)==1 and i!=1)){return(l);}1054 if (size(l)==1 and i==1){return(L);}1055 // L=l[1];1056 if(i==1)1057 {1058 for(j=2;j<=size(l);j++)1059 {1060 L[j-1]=l[j];1061 }1062 }1063 else1064 {1065 for(j=1;j<=i-1;j++)1066 {1067 L[j]=l[j];1068 }1069 for(j=i+1;j<=size(l);j++)1070 {1071 L[j-1]=l[j];1072 }1073 }1074 return(L);1075 }1076 1077 1351 // Auxiliary routine to define an order for ideals 1078 1352 // Returns 1 if the ideal a is shoud precede ideal b by sorting them in idbefid order 1079 1353 // 2 if the the contrary happen 1080 1354 // 0 if the order is not relevant 1081 proc idbefid(ideal a, ideal b)1355 static proc idbefid(ideal a, ideal b) 1082 1356 { 1083 1357 poly fa; poly fb; poly la; poly lb; … … 1111 1385 1112 1386 // sort a list of ideals using idbefid 1113 proc sortlistideals(list L)1387 static proc sortlistideals(list L) 1114 1388 { 1115 1389 int i; int j; int n; … … 1134 1408 } 1135 1409 1136 // returns 1 if the two lists of ideals are equal and 0 if not 1137 proc equallistideals(list L, list M) 1138 { 1139 int t; int i; 1140 if (size(L)!=size(M)){return(0);} 1141 else 1142 { 1143 t=1; 1144 if (size(L)>0) 1145 { 1146 i=1; 1147 while ((t) and (i<=size(L))) 1148 { 1149 if (equalideals(L[i],M[i])==0){t=0;} 1150 i++; 1151 } 1152 } 1153 return(t); 1154 } 1410 // Crep 1411 // Computes the C-representation of V(N) \ V(M). 1412 // input: 1413 // ideal N (null ideal) (not necessarily radical nor maximal) 1414 // ideal M (hole ideal) (not necessarily containing N) 1415 // output: 1416 // the list (a,b) of the canonical ideals 1417 // the Crep of V(N) \ V(M) 1418 // Assumed to be called in the ring @R 1419 // Works on the ring @P 1420 proc Crep(ideal N, ideal M) 1421 "USAGE: Crep(N,M); 1422 Input: ideal N (null ideal) (not necessarily radical nor maximal) 1423 ideal M (hole ideal) (not necessarily containing N) 1424 RETURN: The canonical C-representation of the locally closed set. 1425 [ P,Q ], a pair of radical ideals with P included in Q, 1426 representing the set V(P) \ V(Q) = V(N) \ V(M) 1427 NOTE: Operates in a ring R=Q[a] (a=parameters) 1428 KEYWORDS: locally closed set, canoncial form 1429 EXAMPLE: Crep; shows an example" 1430 { 1431 list l; 1432 ideal Np=std(N); 1433 if (equalideals(Np,ideal(1))) 1434 { 1435 l=ideal(1),ideal(1); 1436 return(l); 1437 } 1438 int i; 1439 list L; 1440 ideal Q=Np+M; 1441 ideal P=ideal(1); 1442 L=minGTZ(Np); 1443 for(i=1;i<=size(L);i++) 1444 { 1445 if(idcontains(L[i],Q)==0) 1446 { 1447 P=intersect(P,L[i]); 1448 } 1449 } 1450 P=std(P); 1451 Q=std(radical(Q+P)); 1452 list T=P,Q; 1453 return(T); 1454 } 1455 example 1456 { 1457 "EXAMPLE:"; echo = 2; 1458 if(defined(Grobcov::@P)){kill Grobcov::@R; kill Grobcov::@P; kill Grobcov::@RP;} 1459 ring R=0,(x,y,z),lp; 1460 short=0; 1461 ideal E=x*(x^2+y^2+z^2-25); 1462 ideal N=x*(x-3),y-4; 1463 def Cr=Crep(E,N); 1464 Cr; 1465 def L=Prep(E,N); 1466 L; 1467 def Cr1=PtoCrep(L); 1468 Cr1; 1155 1469 } 1156 1470 … … 1162 1476 // output: 1163 1477 // the ((p_1,(p_11,p_1k_1)),..,(p_r,(p_r1,p_rk_r))); 1164 // the Prep of V(N) \V(M)1165 // Assumed to work in the ring @P of the parameters1166 // Can be used without calling previously setglobalrings().1478 // the Prep of V(N) \ V(M) 1479 // Assumed to be called in the ring @R 1480 // Works on the ring @P 1167 1481 proc Prep(ideal N, ideal M) 1482 "USAGE: Prep(N,M); 1483 Input: ideal N (null ideal) (not necessarily radical nor maximal) 1484 ideal M (hole ideal) (not necessarily containing N) 1485 RETURN: The canonical P-representation of the locally closed set V(N) \ V(M) 1486 Output: [ Comp_1, .. , Comp_s ] where 1487 Comp_i=[p_i,[p_i1,..,p_is_i]] 1488 NOTE: Operates in a ring R=Q[a] (a=parameters) 1489 KEYWORDS: Locally closed set, Canoncial form 1490 EXAMPLE: Prep; shows an example" 1168 1491 { 1169 1492 int te; … … 1172 1495 return(list(list(ideal(1),list(ideal(1))))); 1173 1496 } 1174 def RR=basering;1175 if(defined(@P)){te=1;}1176 else{te=0; setglobalrings();}1177 setring(@P);1178 ideal Np=imap(RR,N);1179 ideal Mp=imap(RR,M);1180 1497 int i; int j; list L0; 1181 1182 list Ni=minGTZ(Np); 1498 list Ni=minGTZ(N); 1183 1499 list prep; 1184 1500 for(j=1;j<=size(Ni);j++) … … 1190 1506 for (i=1;i<=size(Ni);i++) 1191 1507 { 1192 Mij=minGTZ(Ni[i]+M p);1508 Mij=minGTZ(Ni[i]+M); 1193 1509 for(j=1;j<=size(Mij);j++) 1194 1510 { … … 1203 1519 } 1204 1520 if (size(prep)==0){prep=list(list(ideal(1),list(ideal(1))));} 1205 setring(RR); 1206 def pprep=imap(@P,prep); 1207 if(te==0){kill @P; kill @R; kill @RP;} 1208 return(pprep); 1521 def Lout=CompleteA(prep,prep); 1522 return(Lout); 1523 } 1524 example 1525 { 1526 "EXAMPLE:"; echo = 2; 1527 if(defined(Grobcov::@P)){kill Grobcov::@R; kill Grobcov::@P; kill Grobcov::@RP;} 1528 short=0; 1529 ring R=0,(x,y,z),lp; 1530 ideal E=x*(x^2+y^2+z^2-25); 1531 ideal N=x*(x-3),y-4; 1532 Prep(E,N); 1209 1533 } 1210 1534 … … 1213 1537 // input: 1214 1538 // list ((p_1,(p_11,p_1k_1)),..,(p_r,(p_r1,p_rk_r))); 1215 // the P-representation of V(N) \V(M)1539 // the P-representation of V(N) \ V(M) 1216 1540 // output: 1217 1541 // list (ideal ida, ideal idb) 1218 // the C-representaion of V(N)\V(M) = V(ida)\V(idb) 1219 // Assumed to work in the ring @P of the parameters 1220 // If the routine is to be called from the top, a previous call to 1221 // setglobalrings() is needed. 1542 // the C-representaion of V(N) \ V(M) = V(ida) \ V(idb) 1543 // Assumed to be called in the ring @R 1544 // Works on the ring @P 1222 1545 proc PtoCrep(list L) 1546 "USAGE: PtoCrep(L) 1547 Input L: list [ Comp_1, .. , Comp_s ] where 1548 Comp_i=[p_i,[p_i1,..,p_is_i] ], is 1549 the P-representation of a locally closed set V(N) \ V(M) 1550 RETURN: The canonical C-representation of the locally closed set 1551 [ P,Q ], a pair of radical ideals with P included in Q, 1552 representing the set V(P) \ V(Q) 1553 NOTE: Operates in a ring R=Q[a] (a=parameters) 1554 KEYWORDS: locally closed set, canoncial form 1555 EXAMPLE: PtoCrep; shows an example" 1556 { 1557 int te; 1558 def RR=basering; 1559 if(defined(@P)){te=1; setring(@P); list Lp=imap(RR,L);} 1560 else { te=0; def Lp=L;} 1561 def La=PtoCrep0(Lp); 1562 if(te==1) {setring(RR); def LL=imap(@P,La);} 1563 if(te==0){def LL=La;} 1564 return(LL); 1565 } 1566 example 1567 { 1568 "EXAMPLE:"; echo = 2; 1569 if(defined(Grobcov::@P)){kill Grobcov::@R; kill Grobcov::@P; kill Grobcov::@RP;} 1570 short=0; 1571 ring R=0,(x,y,z),lp; 1572 1573 // (P,Q) represents a locally closed set 1574 ideal P=x^3+x*y^2+x*z^2-25*x; 1575 ideal Q=y-4,x*z,x^2-3*x; 1576 1577 // Now compute the P-representation= 1578 def L=Prep(P,Q); 1579 L; 1580 // Now compute the C-representation= 1581 def J=PtoCrep(L); 1582 J; 1583 // Now come back recomputing the P-represetation of the C-representation= 1584 Prep(J[1],J[2]); 1585 } 1586 1587 // PtoCrep0 1588 // Computes the C-representation from the P-representation. 1589 // input: 1590 // list ((p_1,(p_11,p_1k_1)),..,(p_r,(p_r1,p_rk_r))); 1591 // the P-representation of V(N) \ V(M) 1592 // output: 1593 // list (ideal ida, ideal idb) 1594 // the C-representation of V(N) \ V(M) = V(ida) \ V(idb) 1595 // Works in a ring Q[u_1,..,u_m] and is called on it. 1596 static proc PtoCrep0(list L) 1223 1597 { 1224 1598 int te=0; 1225 def RR=basering; 1226 if(defined(@P)){te=1;} 1227 else{te=0; setglobalrings();} 1228 setring(@P); 1229 def Lp=imap(RR,L); 1599 def Lp=L; 1230 1600 int i; int j; 1231 1601 ideal ida=ideal(1); ideal idb=ideal(1); list Lb; ideal N; … … 1241 1611 } 1242 1612 } 1613 //idb=radical(idb); 1243 1614 def La=list(ida,idb); 1244 setring(RR); 1245 def LL=imap(@P,La); 1246 if(te==0){kill @P; kill @R; kill @RP;} 1247 return(LL); 1615 return(La); 1248 1616 } 1249 1617 … … 1254 1622 // and dehomogenize the result. 1255 1623 proc cgsdr(ideal F, list #) 1256 "USAGE: cgsdr(F); To compute a disjoint, reduced CGS. 1624 "USAGE: cgsdr(F); 1625 F: ideal in Q[a][x] (a=parameters, x=variables) to be discussed. 1626 To compute a disjoint, reduced Comprehensive Groebner System (CGS). 1257 1627 cgsdr is the starting point of the fundamental routine grobcov. 1258 Inside grobcov it is used onlywith options 'can' set to 0,1 and1628 Inside grobcov it is used with options 'can' set to 0,1 and 1259 1629 not with options ('can',2). 1260 1630 It is to be used if only a disjoint reduced CGS is required. 1261 F: ideal in Q[a][x] (parameters and variables) to be discussed.1262 1631 1263 1632 Options: To modify the default options, pairs of arguments … … 1275 1644 \"null\",ideal E: The default is (\"null\",ideal(0)). 1276 1645 \"nonnull\",ideal N: The default (\"nonnull\",ideal(1)). 1277 When options 'null' and/or 'nonnull'are given, then1278 the parameter space is restricted to V(E) \V(N).1646 When options \"null\" and/or \"nonnull\" are given, then 1647 the parameter space is restricted to V(E) \ V(N). 1279 1648 \"comment\",0-1: The default is (\"comment\",0). Setting (\"comment\",1) 1280 1649 will provide information about the development of the … … 1285 1654 and the segments grouped by lpp 1286 1655 With options (\"can\",0) and (\"can\",1) the option (\"out\",1) 1287 is set to ( out,0) because it is not compatible.1656 is set to (\"out\",0) because it is not compatible. 1288 1657 One can give none or whatever of these options. 1289 1658 With the default options (\"can\",2,\"out\",1), only the 1290 Kapur-Sun-Wang algorithm is computed. This is very eff ectif1291 but is only the starting point for the computation .1659 Kapur-Sun-Wang algorithm is computed. This is very efficient 1660 but is only the starting point for the computation of grobcov. 1292 1661 When grobcov is computed, the call to cgsdr inside uses 1293 1662 specific options that are more expensive ("can",0-1,"out",0). 1294 RETURN: 1663 RETURN: Returns a list T describing a reduced and disjoint 1295 1664 Comprehensive Groebner System (CGS), 1296 1665 With option (\"out\",0) 1297 1298 1299 1300 1666 the segments are grouped by 1667 leading power products (lpp) of the reduced Groebner 1668 basis and given in P-representation. 1669 The returned list is of the form: 1301 1670 ( 1302 1671 (lpp, (num,basis,segment),...,(num,basis,segment),lpp), … … 1304 1673 (lpp, (num,basis,segment),...,(num,basis,segment),lpp) 1305 1674 ) 1306 1307 1308 1309 1310 1675 The bases are the reduced Groebner bases (after normalization) 1676 for each point of the corresponding segment. 1677 1678 The third element of each lpp segment is the lpp of the 1679 used ideal in the CGS as a string: 1311 1680 with option (\"can\",0) the homogenized basis is used 1312 1681 with option (\"can\",1) the homogenized ideal is used … … 1314 1683 1315 1684 With option (\"out\",1) (default) 1316 1317 1318 1685 only KSW is applied and segments are given as 1686 difference of varieties and are not grouped 1687 The returned list is of the form: 1319 1688 ( 1320 1689 (E,N,B),..(E,N,B) 1321 1690 ) 1322 1323 1324 segment = V(E)\V(N)1325 1326 1327 NOTE: The basering R, must be of the form Q[a][x],a=parameters,1328 x=variables , and should be defined previously, and the ideal1691 E is the null variety 1692 N is the nonnull variety 1693 segment = V(E) \ V(N) 1694 B is the reduced Groebner basis 1695 1696 NOTE: The basering R, must be of the form Q[a][x], (a=parameters, 1697 x=variables), and should be defined previously, and the ideal 1329 1698 defined on R. 1330 1699 KEYWORDS: CGS, disjoint, reduced, Comprehensive Groebner System … … 1337 1706 // INITIALIZING OPTIONS 1338 1707 int i; int j; 1708 def E=ideal(0); 1709 def N=ideal(1); 1710 int comment=0; 1339 1711 int can=2; 1340 1712 int out=1; 1341 1713 poly f; 1342 1714 ideal B; 1343 def E=ideal(0);1344 def N=ideal(1);1345 int comment=0;1346 1715 int start=timer; 1347 1716 list L=#; … … 1404 1773 { 1405 1774 // COMPUTING THE HOMOGOENIZED IDEAL 1406 if(comment> 0){string("Homogenizing the whole ideal: option can=1");}1775 if(comment>=1){string("Homogenizing the whole ideal: option can=1");} 1407 1776 list RRL=ringlist(RR); 1408 1777 RRL[3][1][1]="dp"; … … 1440 1809 BH[i]=homog(BH[i],@t); 1441 1810 } 1442 if (comment>= 1){string("Homogenized system = "); BH;}1811 if (comment>=2){string("Homogenized system = "); BH;} 1443 1812 def GSH=KSW(BH,LH); 1444 1813 setglobalrings(); … … 1488 1857 GS[i][3]=postredgb(mingb(GS[i][3])); 1489 1858 if (typeof(GS[i][7])=="ideal") 1490 { 1491 GS[i][7]=postredgb(mingb(GS[i][7])); 1492 } 1859 { GS[i][7]=postredgb(mingb(GS[i][7]));} 1493 1860 } 1494 1861 } … … 1499 1866 } 1500 1867 example 1501 { "EXAMPLE:"; echo = 2; 1502 "Casas conjecture for degree 4"; 1868 { 1869 "EXAMPLE:"; echo = 2; 1870 // Casas conjecture for degree 4: 1503 1871 ring R=(0,a0,a1,a2,a3,a4),(x1,x2,x3),dp; 1872 short=0; 1504 1873 ideal F=x1^4+(4*a3)*x1^3+(6*a2)*x1^2+(4*a1)*x1+(a0), 1505 1874 x1^3+(3*a3)*x1^2+(3*a2)*x1+(a1), … … 1514 1883 // lpp segments and improve the output 1515 1884 // output: grouped segments by lpp obtained in cgsdr 1516 proc grsegments(list T)1885 static proc grsegments(list T) 1517 1886 { 1518 1887 int i; … … 1545 1914 } 1546 1915 1547 // idcontains1548 // input: ideal p, ideal q1549 // output: 1 if p contains q, 0 otherwise1550 // If the routine is to be called from the top, a previous call to1551 // setglobalrings() is needed.1552 proc idcontains(ideal p, ideal q)1553 {1554 int t; int i;1555 t=1; i=1;1556 def RR=basering;1557 setring(@P);1558 def P=imap(RR,p);1559 def Q=imap(RR,q);1560 attrib(P,"isSB",1);1561 poly r;1562 while ((t) and (i<=size(Q)))1563 {1564 r=reduce(Q[i],P);1565 if (r!=0){t=0;}1566 i++;1567 }1568 setring(RR);1569 return(t);1570 }1571 1572 // selectminindeals1573 // given a list of ideals returns the list of integers corresponding1574 // to the minimal ideals in the list1575 // input: L (list of ideals)1576 // output: the list of integers corresponding to the minimal ideals in L1577 // If the routine is to be called from the top, a previous call to1578 // setglobalrings() is needed.1579 proc selectminideals(list L)1580 {1581 if (size(L)==0){return(L)};1582 def RR=basering;1583 setring(@P);1584 def Lp=imap(RR,L);1585 int i; int j; int t; intvec notsel;1586 list P;1587 for (i=1;i<=size(Lp);i++)1588 {1589 if(memberpos(i,notsel)[1])1590 {1591 i++;1592 if(i>size(Lp)){break;}1593 }1594 t=1;1595 j=1;1596 while ((t) and (j<=size(Lp)))1597 {1598 if (i==j){j++;}1599 if ((j<=size(Lp)) and (memberpos(j,notsel)[1]==0))1600 {1601 1602 if (idcontains(Lp[i],Lp[j]))1603 {1604 notsel[size(notsel)+1]=i;1605 t=0;1606 }1607 }1608 j++;1609 }1610 if (t){P[size(P)+1]=i;}1611 }1612 setring(RR);1613 return(P);1614 }1615 1616 1916 // LCUnion 1617 // Given a list of the P-representations of disjointlocally closed segments1917 // Given a list of the P-representations of locally closed segments 1618 1918 // for which we know that the union is also locally closed 1619 1919 // it returns the P-representation of its union … … 1623 1923 // output: P-representation of the union 1624 1924 // ((P_j,(P_j1,...,P_jk_j | j=1..t))) 1625 // If the routine is to be called from the top, a previous call to 1626 // setglobalrings() is needed. 1627 // Auxiliary routine called by grobcov and addcons 1628 // A previous call to setglobarings() is needed if it is to be used at the top. 1629 proc LCUnion(list LL) 1925 static proc LCUnion(list LL) 1630 1926 { 1631 1927 def RR=basering; 1632 1928 setring(@P); 1633 int care;1634 1929 def L=imap(RR,LL); 1635 1930 int i; int j; int k; list H; list C; list T; 1636 list L0; list P0; list P; list Q0; list Q; intvec Qi; 1637 if(not(defined(@Q2))){list @Q2;} 1638 else{kill @Q2; list @Q2;} 1639 exportto(Top,@Q2); 1931 list L0; list P0; list P; list Q0; list Q; 1640 1932 for (i=1;i<=size(L);i++) 1641 1933 { … … 1647 1939 } 1648 1940 Q0=selectminideals(P0); 1649 //"T_3Q0="; Q0;1650 kill P; list P;1651 1941 for (i=1;i<=size(Q0);i++) 1652 1942 { 1653 Qi=L0[Q0[i]]; 1654 Q[size(Q)+1]=Qi; 1655 P[size(P)+1]=L[Qi[1]][Qi[2]]; 1656 } 1657 @Q2=Q; 1658 if(size(P)==0) 1659 { 1660 setring(RR); 1661 list TT; 1662 return(TT); 1943 Q[i]=L0[Q0[i]]; 1944 P[i]=L[Q[i][1]][Q[i][2]]; 1663 1945 } 1664 1946 // P is the list of the maximal components of the union … … 1676 1958 { 1677 1959 C[size(C)+1]=L[i][j]; 1678 C[size(C)][3]=intvec(i,j);1679 1960 } 1680 1961 } 1681 1962 } 1682 if(size(P[k])>=3){T[size(T)+1]=list(Q[k],P[k][1],addpart(H,C),P[k][3]);} 1683 else{T[size(T)+1]=list(Q[k],P[k][1],addpart(H,C));} 1684 } 1685 @Q2=sortpairs(@Q2); 1963 T[size(T)+1]=list(Q[k],P[k][1],addpart(H,C)); 1964 } 1686 1965 setring(RR); 1687 1966 def TT=imap(@P,T); … … 1699 1978 // posi=(i,j) position of the component 1700 1979 // the list of segments to be added to the holes 1701 proc addpart(list H, list C)1980 static proc addpart(list H, list C) 1702 1981 { 1703 1982 list Q; int i; int j; int k; int l; int t; int t1; … … 1717 1996 if (equalideals(q,C[j][1])) 1718 1997 { 1719 @Q2[size(@Q2)+1]=C[j][3];1998 // \\ @Q2[size(@Q2)+1]=C[j][3]; 1720 1999 t=0; 1721 2000 for (k=1;k<=size(C[j][2]);k++) 1722 2001 { 1723 2002 t1=1; 1724 //kill addq;1725 //list addq;1726 2003 l=1; 1727 2004 while((t1) and (l<=size(Q))) … … 1739 2016 { 1740 2017 addq[size(addq)+1]=C[j][2][k]; 1741 @Q2[size(@Q2)+1]=C[j][3];2018 // \\ @Q2[size(@Q2)+1]=C[j][3]; 1742 2019 } 1743 2020 } … … 1756 2033 list addq; 1757 2034 } 1758 //print("Q="); Q; print("notQ="); notQ;1759 2035 } 1760 2036 i++; … … 1775 2051 // that part. 1776 2052 // Works on @P ring. 1777 proc addpartfine(list H, list C0) 1778 { 2053 static proc addpartfine(list H, list C0) 2054 { 2055 //"T_H="; H; 1779 2056 int i; int j; int k; int te; intvec notQ; int l; list sel; int used; 1780 2057 intvec jtesC; 1781 2058 if ((size(H)==1) and (equalideals(H[1],ideal(1)))){return(H);} 1782 2059 if (size(C0)==0){return(H);} 1783 def RR=basering;1784 setring(@P);1785 2060 list newQ; list nQ; list Q; list nQ1; list Q0; 1786 def Q1= imap(RR,H);1787 //Q1=sortlistideals(Q1 );1788 def C= imap(RR,C0);2061 def Q1=H; 2062 //Q1=sortlistideals(Q1,idbefid); 2063 def C=C0; 1789 2064 while(equallistideals(Q0,Q1)==0) 1790 2065 { … … 1848 2123 } 1849 2124 } 2125 //"T_Q1_0="; Q1; 1850 2126 sel=selectminideals(Q1); 1851 2127 kill nQ1; list nQ1; … … 1856 2132 Q1=nQ1; 1857 2133 } 1858 setring(RR); 2134 if(size(Q1)==0){Q1=ideal(1),ideal(1);} 2135 //"T_Q1_1="; Q1; 1859 2136 //if(used>0){string("addpartfine was ", used, " times used");} 1860 return(imap(@P,Q1)); 1861 } 2137 return(Q1); 2138 } 2139 1862 2140 1863 2141 // Auxiliary routine for grobcov: ideal F is assumed to be homogeneous … … 1869 2147 // where a Prep is ( (p1,(p11,..,p1k_1)),..,(pj,(pj1,..,p1k_j)) ) 1870 2148 // a Crep is ( ida, idb ) 1871 proc gcover(ideal F,list #)2149 static proc gcover(ideal F,list #) 1872 2150 { 1873 2151 int i; int j; int k; ideal lpp; list GPi2; list pairspP; ideal B; int ti; … … 2017 2295 // grobcov 2018 2296 // input: 2019 // ideal F: a parametric ideal in Q[a][x], where a are the parameters 2020 // and x the variables 2297 // ideal F: a parametric ideal in Q[a][x], (a=parameters, x=variables). 2021 2298 // list #: (options) list("null",N,"nonnull",W,"can",0-1,ext",0-1, "rep",0-1-2) 2022 2299 // where … … 2039 2316 proc grobcov(ideal F,list #) 2040 2317 "USAGE: grobcov(F); This is the fundamental routine of the 2041 library. It computes the Groebner cover of a parametric ideal 2042 (see (*) Montes A., Wibmer M., Groebner Bases for Polynomial 2043 Systems with parameters. JSC 45 (2010) 1391-1425.) 2044 The Groebner cover of a parametric ideal consist of a set of 2318 library. It computes the Groebner cover of a parametric ideal. See 2319 Montes A., Wibmer M., 2320 \"Groebner Bases for Polynomial Systems with parameters\". 2321 JSC 45 (2010) 1391-1425.) 2322 The Groebner Cover of a parametric ideal consist of a set of 2045 2323 pairs(S_i,B_i), where the S_i are disjoint locally closed 2046 2324 segments of the parameter space, and the B_i are the reduced … … 2048 2326 2049 2327 The ideal F must be defined on a parametric ring Q[a][x]. 2328 (a=parameters, x=variables) 2050 2329 Options: To modify the default options, pair of arguments 2051 2330 -option name, value- of valid options must be added to the call. … … 2053 2332 Options: 2054 2333 \"null\",ideal E: The default is (\"null\",ideal(0)). 2055 \"nonnull\",ideal N: The default (\"nonnull\",ideal(1)).2334 \"nonnull\",ideal N: The default is (\"nonnull\",ideal(1)). 2056 2335 When options \"null\" and/or \"nonnull\" are given, then 2057 the parameter space is restricted to V(E) \V(N).2336 the parameter space is restricted to V(E) \ V(N). 2058 2337 \"can\",0-1: The default is (\"can\",1). With the default option 2059 2338 the homogenized ideal is computed before obtaining the 2060 Groebner cover, so that the result is the canonical2061 Groebner cover. Setting (\"can\",0) only homogenizes the2339 Groebner Cover, so that the result is the canonical 2340 Groebner Cover. Setting (\"can\",0) only homogenizes the 2062 2341 basis so the result is not exactly canonical, but the 2063 2342 computation is shorter. 2064 2343 \"ext\",0-1: The default is (\"ext\",0). With the default 2065 (\"ext\",0), only the generic representation is computed2066 (single polynomials, but not specializing to non-zero at2067 eachpoint of the segment. With option (\"ext\",1) the2344 (\"ext\",0), only the generic representation of the bases is 2345 computed (single polynomials, but not specializing to non-zero 2346 for every point of the segment. With option (\"ext\",1) the 2068 2347 full representation of the bases is computed (possible 2069 sheaves) and sometimes a simpler result is obtained. 2348 sheaves) and sometimes a simpler result is obtained, 2349 but the computation is more time consuming. 2070 2350 \"rep\",0-1-2: The default is (\"rep\",0) and then the segments 2071 2351 are given in canonical P-representation. Option (\"rep\",1) … … 2087 2367 of the segment. 2088 2368 The lpph corresponds to the lpp of the homogenized ideal 2089 and is different for each segment. It is given as a string. 2090 2091 Basis: to each element of lpp corresponds an I-regular function given 2092 in full representation (by option (\"ext\",1)) or in 2369 and is different for each segment. It is given as a string, 2370 and shown only for information. With the default option 2371 \"can\",1, the segments have different lpph. 2372 2373 Basis: to each element of lpp corresponds an I-regular function 2374 given in full representation (by option (\"ext\",1)) or in 2093 2375 generic representation (default option (\"ext\",0)). The 2094 2376 I-regular function is the corresponding element of the reduced … … 2110 2392 The P-representation of a segment is of the form 2111 2393 ((p_1,(p_11,..,p_1k1)),..,(p_r,(p_r1,..,p_rkr)) 2112 representing the segment U _i (V(p_i) \ U_j (V(p_ij))),2394 representing the segment Union_i ( V(p_i) \ ( Union_j V(p_ij) ) ), 2113 2395 where the p's are prime ideals. 2114 2396 2115 2397 The C-representation of a segment is of the form 2116 (E,N) representing V(E) \V(N), and the ideals E and N are2398 (E,N) representing V(E) \ V(N), and the ideals E and N are 2117 2399 radical and N contains E. 2118 2400 2119 NOTE: The basering R, must be of the form Q[a][x], a=parameters,2120 x=variables , and should be defined previously. The ideal must2401 NOTE: The basering R, must be of the form Q[a][x], (a=parameters, 2402 x=variables), and should be defined previously. The ideal must 2121 2403 be defined on R. 2122 2404 KEYWORDS: Groebner cover, parametric ideal, canonical, discussion of … … 2244 2526 } 2245 2527 example 2246 { "EXAMPLE:"; echo = 2; 2247 "Casas conjecture for degree 4"; 2528 { 2529 "EXAMPLE:"; echo = 2; 2530 // Casas conjecture for degree 4: 2248 2531 ring R=(0,a0,a1,a2,a3,a4),(x1,x2,x3),dp; 2532 short=0; 2249 2533 ideal F=x1^4+(4*a3)*x1^3+(6*a2)*x1^2+(4*a1)*x1+(a0), 2250 x1^3+(3*a3)*x1^2+(3*a2)*x1+(a1),2251 x2^4+(4*a3)*x2^3+(6*a2)*x2^2+(4*a1)*x2+(a0),2252 x2^2+(2*a3)*x2+(a2),2253 x3^4+(4*a3)*x3^3+(6*a2)*x3^2+(4*a1)*x3+(a0),2254 x3+(a3);2534 x1^3+(3*a3)*x1^2+(3*a2)*x1+(a1), 2535 x2^4+(4*a3)*x2^3+(6*a2)*x2^2+(4*a1)*x2+(a0), 2536 x2^2+(2*a3)*x2+(a2), 2537 x3^4+(4*a3)*x3^3+(6*a2)*x3^2+(4*a1)*x3+(a0), 2538 x3+(a3); 2255 2539 grobcov(F); 2256 2540 } … … 2262 2546 // Can be called from the top 2263 2547 proc extend(list GC, list #); 2264 "USAGE: extend(GC); When the grobcov of an ideal has been computed 2265 with the default option (\"ext\",0) and the explicit option 2266 (\"rep\",2) (which is not the default), then one can call 2267 extend (GC) (and options) to obtain the full representation 2268 of the bases. With the default option (\"ext\",0) only the 2269 generic representation of the bases are computed, and one can 2270 obtain the full representation using extend. 2271 \"rep\",0-1-2: The default is (\"rep\",0) and then the segments 2272 are given in canonical P-representation. Option (\"rep\",1) 2273 represents the segments in canonical C-representation, 2274 and option (\"rep\",2) gives both representations. 2275 \"comment\",0-1: The default is (\"comment\",0). Setting 2276 \"comment\" higher will provide information about the 2277 time used in the computation. 2278 One can give none or whatever of these options. 2279 RETURN: The list 2280 ( 2281 (lpp_1,basis_1,segment_1,lpph_1), 2282 ... 2283 (lpp_s,basis_s,segment_s,lpph_s) 2284 ) 2285 2286 The lpp are constant over a segment and correspond to the 2287 set of lpp of the reduced Groebner basis for each point 2288 of the segment. 2289 The lpph corresponds to the lpp of the homogenized ideal 2290 and is different for each segment. It is given as a string. 2291 2292 Basis: to each element of lpp corresponds an I-regular function given 2293 in full representation. The 2294 I-regular function is the corresponding element of the reduced 2295 Groebner basis for each point of the segment with the given lpp. 2296 For each point in the segment, the polynomial or the set of 2297 polynomials representing it, if they do not specialize to 0, 2298 then after normalization, specializes to the corresponding 2299 element of the reduced Groebner basis. In the full representation 2300 at least one of the polynomials representing the I-regular 2301 function specializes to non-zero. 2302 2303 With the default option (\"rep\",0) the segments are given 2304 in P-representation. 2305 With option (\"rep\",1) the segments are given 2306 in C-representation. 2307 With option (\"rep\",2) both representations of the segments are 2308 given. 2309 2310 The P-representation of a segment is of the form 2311 ((p_1,(p_11,..,p_1k1)),..,(p_r,(p_r1,..,p_rkr)) 2312 representing the segment U_i (V(p_i) \ U_j (V(p_ij))), 2313 where the p's are prime ideals. 2314 2315 The C-representation of a segment is of the form 2316 (E,N) representing V(E)\V(N), and the ideals E and N are 2317 radical and N contains E. 2318 2319 NOTE: The basering R, must be of the form Q[a][x], a=parameters, 2320 x=variables, and should be defined previously. The ideal must 2548 "USAGE: extend(GC); The default option of grobcov provides 2549 the bases in generic representation (the I-regular functions 2550 of the bases ara given by a single polynomial. It can specialize 2551 to zero for some points of the segments, but in general, it 2552 is sufficient for many pouposes. Nevertheless the I-regular 2553 functions allow a full representation given bey a set of 2554 polynomials specializing to the value of the function (after normalization) 2555 or to zero, but at least one of the polynomials specializes to non-zero. 2556 The full representation can be obtained by computing the 2557 grobcov with option \"ext\",1. The default option is \"ext\",0. 2558 With option \"ext\",1 the computation can be much more 2559 time consuming, even if the result can be simpler. 2560 Alternatively, one can compute the full representation of the 2561 bases after computing grobcov with the defaoult option \"ext\",0 2562 and the option \"rep\",2, that outputs both the Prep and the Crep 2563 of the segments and then call \"extend\" to the output. 2564 2565 RETURN: When calling extend(grobcov(S,\"rep\",2)) the result is of the form 2566 ( 2567 (lpp_1,basis_1,segment_1,lpph_1), 2568 ... 2569 (lpp_s,basis_s,segment_s,lpph_s) 2570 ) 2571 where each function of the basis can be given by an ideal 2572 of representants. 2573 2574 NOTE: The basering R, must be of the form Q[a][x], (a=parameters, 2575 x=variables), and should be defined previously. The ideal must 2321 2576 be defined on R. 2322 2577 KEYWORDS: Groebner cover, parametric ideal, canonical, discussion of … … 2336 2591 } 2337 2592 if(m==1){"Warning! grobcov has already extended bases"; return(S);} 2338 if(size(GC[1])!=5){"Warning! extend make sense only when grobcov has been called with options 'rep',2,'ext',0"; " "; return();}2593 if(size(GC[1])!=5){"Warning! extend make sense only when grobcov has been called with options 'rep',2,'ext',0"; " "; return();} 2339 2594 int repop=0; 2340 2595 int start3=timer; … … 2434 2689 example 2435 2690 { 2436 ring R=(0,a0,b0,c0,a1,b1,c1,a2,b2,c2),(x), dp; 2691 "EXAMPLE:"; echo = 2; 2692 ring R=(0,a0,b0,c0,a1,b1,c1),(x), dp; 2437 2693 short=0; 2438 2694 ideal S=a0*x^2+b0*x+c0, 2439 a1*x^2+b1*x+c1, 2440 a2*x^2+b2*x+c2; 2441 "System S="; S; 2442 2443 def GCS=grobcov(S,"rep",2,"comment",1); 2444 "grobcov(S,'rep',2,'comment',1)="; GCS; 2445 def FGC=extend(GCS,"rep",0,"comment",1); 2446 "Full representation="; FGC; 2695 a1*x^2+b1*x+c1; 2696 def GCS=grobcov(S,"rep",2); 2697 GCS; 2698 def FGC=extend(GCS,"rep",0); 2699 // Full representation= 2700 FGC; 2447 2701 } 2448 2702 … … 2450 2704 // nonzerodivisor 2451 2705 // input: 2452 // poly g in K[a],2706 // poly g in Q[a], 2453 2707 // list P=(p_1,..p_r) representing a minimal prime decomposition 2454 2708 // output 2455 2709 // poly f such that f notin p_i for all i and 2456 2710 // g-f in p_i for all i such that g notin p_i 2457 proc nonzerodivisor(poly gr, list Pr)2711 static proc nonzerodivisor(poly gr, list Pr) 2458 2712 { 2459 2713 def RR=basering; … … 2492 2746 // input: 2493 2747 // int i: 2494 // list LPr: (p1,..,pr) of prime components of an ideal in K[a]2748 // list LPr: (p1,..,pr) of prime components of an ideal in Q[a] 2495 2749 // output: 2496 2750 // list (fr,fnr) of two polynomials that are equal on V(pi) 2497 2751 // and fr=0 on V(P) \ V(pi), and fnr is nonzero on V(pj) for all j. 2498 proc deltai(int i, list LPr)2752 static proc deltai(int i, list LPr) 2499 2753 { 2500 2754 def RR=basering; … … 2502 2756 def LP=imap(RR,LPr); 2503 2757 int j; poly p; 2504 idealF=ideal(1);2758 def F=ideal(1); 2505 2759 poly f; 2506 2760 poly fn; … … 2539 2793 // output: 2540 2794 // poly P on an open and dense set of V(p_1 int ... p_r) 2541 proc combine(list L, ideal F)2795 static proc combine(list L, ideal F) 2542 2796 { 2543 2797 // ATTENTION REVISE AND USE Pci and F … … 2553 2807 } 2554 2808 2555 // Auxiliary routine2556 // elimconstfac: eliminate the factors in the polynom f that are in K[a]2557 // input:2558 // poly f:2559 // list L: of components of the segment2560 // output:2561 // poly f2 where the factors of f in K[a] that are non-null on any component2562 // have been dropped from f2563 proc elimconstfac(poly f)2564 {2565 int cond; int i; int j; int t;2566 if (f==0){return(f);}2567 def RR=basering;2568 setring(@R);2569 def ff=imap(RR,f);2570 list l=factorize(ff,0);2571 poly f1=1;2572 for(i=2;i<=size(l[1]);i++)2573 {2574 f1=f1*(l[1][i])^(l[2][i]);2575 }2576 setring(RR);2577 def f2=imap(@R,f1);2578 return(f2);2579 }2580 2809 2581 2810 //Auxiliary routine … … 2587 2816 // output: 2588 2817 // t: with value 1 if f reduces modulo P, 0 if not. 2589 proc nullin(poly f,ideal P)2818 static proc nullin(poly f,ideal P) 2590 2819 { 2591 2820 int t; … … 2605 2834 // Input: A polynomial f 2606 2835 // Output: The list of leading terms 2607 proc monoms(poly f)2836 static proc monoms(poly f) 2608 2837 { 2609 2838 list L; … … 2628 2857 // poly f: a generic polynomial in the basis 2629 2858 // ideal idp: such that ideal(S)=idp 2630 // ideal idq: such that S=V(idp) \V(idq)2859 // ideal idq: such that S=V(idp) \ V(idq) 2631 2860 //// NW the list of ((N1,W1),..,(Ns,Ws)) of red-rep of the grouped 2632 2861 //// segments in the lpp-segment NO MORE USED 2633 2862 // output: 2634 proc extend0(poly f, ideal idp, ideal idq)2863 static proc extend0(poly f, ideal idp, ideal idq) 2635 2864 { 2636 2865 matrix CC; poly Q; list NewMonoms; … … 2692 2921 // each intvec v=(i_1,..,is) corresponds to a polynomial in the sheaf 2693 2922 // that will be built from it in extend procedure. 2694 proc findindexpolys(list coefs)2923 static proc findindexpolys(list coefs) 2695 2924 { 2696 2925 int i; int j; intvec numdens; … … 2733 2962 2734 2963 // Auxiliary routine 2735 // extendcoef: given Q,P in K[a] where P/Q specializes on an open and dense subset2964 // extendcoef: given Q,P in Q[a] where P/Q specializes on an open and dense subset 2736 2965 // of the whole V(p1 int...int pr), it returns a basis of the module 2737 2966 // of all syzygies equivalent to P/Q, 2738 proc extendcoef(poly P, poly Q, ideal idp, ideal idq)2967 static proc extendcoef(poly P, poly Q, ideal idp, ideal idq) 2739 2968 { 2740 2969 def RR=basering; … … 2765 2994 // input: 2766 2995 // list L of the polynomials matrix CC 2767 // (we assume that one of them is non-null on V(N) \V(M))2768 // ideal N, ideal M: ideals representing the locally closed set V(N) \V(M)2996 // (we assume that one of them is non-null on V(N) \ V(M)) 2997 // ideal N, ideal M: ideals representing the locally closed set V(N) \ V(M) 2769 2998 // assume to work in @P 2770 proc selectregularfun(matrix CC, ideal NN, ideal MM)2999 static proc selectregularfun(matrix CC, ideal NN, ideal MM) 2771 3000 { 2772 3001 int numcombused; … … 2827 3056 // output: 2828 3057 // object T with index c 2829 proc searchinlist(intvec c,list L)3058 static proc searchinlist(intvec c,list L) 2830 3059 { 2831 3060 int i; list T; … … 2841 3070 } 2842 3071 2843 // Auxiliary routine2844 // comb: the list of combinations of elements (1,..n) of order p2845 proc comb(int n, int p)2846 {2847 list L; list L0;2848 intvec c; intvec d;2849 int i; int j; int last;2850 if ((n<0) or (n<p))2851 {2852 return(L);2853 }2854 if (p==1)2855 {2856 for (i=1;i<=n;i++)2857 {2858 c=i;2859 L[size(L)+1]=c;2860 }2861 return(L);2862 }2863 else2864 {2865 L0=comb(n,p-1);2866 for (i=1;i<=size(L0);i++)2867 {2868 c=L0[i]; d=c;2869 last=c[size(c)];2870 for (j=last+1;j<=n;j++)2871 {2872 d[size(c)+1]=j;2873 L[size(L)+1]=d;2874 }2875 }2876 return(L);2877 }2878 }2879 3072 2880 3073 // Auxiliary routine … … 2895 3088 // The selection is done to obtian the minimal number of elements 2896 3089 // of the sheaf that specializes to non-null everywhere. 2897 proc selectminsheaves(list L)3090 static proc selectminsheaves(list L) 2898 3091 { 2899 3092 list C=allsheaves(L); … … 2909 3102 // list LL of the subsets of C that cover all the subsegments 2910 3103 // (the union of the corresponding L(C) has all 1). 2911 proc smsheaves(list C, list L)3104 static proc smsheaves(list C, list L) 2912 3105 { 2913 3106 int i; int i0; intvec W; … … 2950 3143 // LL is the list of all combrep 2951 3144 // LLS is the list of intvec of the corresponding elements of LL 2952 proc allsheaves(list L)3145 static proc allsheaves(list L) 2953 3146 { 2954 3147 intvec V; list LL; intvec W; int r; intvec U; … … 2986 3179 // Output: 2987 3180 // int nor: the nuber of 1 of v in the positions given by pos. 2988 proc numones(intvec v, intvec pos)3181 static proc numones(intvec v, intvec pos) 2989 3182 { 2990 3183 int i; int n; … … 2994 3187 } 2995 3188 return(n); 2996 }2997 2998 // Auxiliary routine2999 // pos3000 // Input: intvec p of zeros and ones3001 // Output: intvec W of the positions where p has ones.3002 proc pos(intvec p)3003 {3004 int i;3005 intvec W; int j=1;3006 for (i=1; i<=size(p); i++)3007 {3008 if (p[i]==1){W[j]=i; j++;}3009 }3010 return(W);3011 3189 } 3012 3190 … … 3019 3197 // intvec pp: of zeroes and ones, where a 0 stays in pp[i] if either 3020 3198 // already p[i]==0 or c[i]==1. 3021 proc actualize(intvec p, intvec c)3199 static proc actualize(intvec p, intvec c) 3022 3200 { 3023 3201 int i; intvec pp=p; … … 3029 3207 } 3030 3208 3209 3031 3210 // Auxiliary routine 3032 // combrep 3033 // Input: V=(n_1,..,n_i) 3034 // Output: L=(v_1,..,v_p) where p=prod_j=1^i (n_j) 3035 // is the list of all intvec v_j=(v_j1,..,v_ji) where 1<=v_jk<=n_i 3036 proc combrep(intvec V) 3037 { 3038 list L; list LL; 3039 int i; int j; int k; intvec W; 3040 if (size(V)==1) 3041 { 3042 for (i=1;i<=V[1];i++) 3043 { 3044 L[i]=intvec(i); 3045 } 3046 return(L); 3047 } 3048 for (i=1;i<size(V);i++) 3049 { 3050 W[i]=V[i]; 3051 } 3052 LL=combrep(W); 3053 for (i=1;i<=size(LL);i++) 3054 { 3055 W=LL[i]; 3056 for (j=1;j<=V[size(V)];j++) 3057 { 3058 W[size(V)]=j; 3059 L[size(L)+1]=W; 3060 } 3061 } 3062 return(L); 3063 } 3064 3065 // Auxiliary routine 3066 proc reducemodN(poly f,ideal E) 3211 static proc reducemodN(poly f,ideal E) 3067 3212 { 3068 3213 def RR=basering; … … 3081 3226 // Auxiliary routine 3082 3227 // intersp: computes the intersection of the ideals in S in @P 3083 proc intersp(list S)3228 static proc intersp(list S) 3084 3229 { 3085 3230 def RR=basering; … … 3094 3239 // Auxiliary routine 3095 3240 // radicalmember 3096 proc radicalmember(poly f,ideal ida)3241 static proc radicalmember(poly f,ideal ida) 3097 3242 { 3098 3243 int te; … … 3115 3260 } 3116 3261 3117 // Auxiliary routine 3118 // NonNull: returns 1 if the poly f is nonnull on V(E)\V(N), 0 otherwise. 3119 proc NonNull(poly f, ideal E, ideal N) 3120 { 3121 int te=1; int i; 3122 def RR=basering; 3123 setring(@P); 3124 def fp=imap(RR,f); 3125 def Ep=imap(RR,E); 3126 def Np=imap(RR,N); 3127 ideal H; 3128 ideal Ef=Ep+fp; 3129 for (i=1;i<=size(Np);i++) 3130 { 3131 te=radicalmember(Np[i],Ef); 3132 if (te==0){break;} 3133 } 3134 setring(RR); 3135 return(te); 3136 } 3262 // // Auxiliary routine 3263 // // NonNull: returns 1 if the poly f is nonnull on V(E) \ V(N), 0 otherwise. 3264 // // Input: 3265 // // f: polynomial 3266 // // E: null ideal 3267 // // N: nonnull ideal 3268 // // Output: 3269 // // 1 if f is nonnul in V(P) \ V(Q), 3270 // // 0 if it has zeroes inside. 3271 // // Works in @P 3272 // proc NonNull(poly f, ideal E, ideal N) 3273 // { 3274 // int te=1; int i; 3275 // def RR=basering; 3276 // setring(@P); 3277 // def fp=imap(RR,f); 3278 // def Ep=imap(RR,E); 3279 // def Np=imap(RR,N); 3280 // ideal H; 3281 // ideal Ef=Ep+fp; 3282 // for (i=1;i<=size(Np);i++) 3283 // { 3284 // te=radicalmember(Np[i],Ef); 3285 // if (te==0){break;} 3286 // } 3287 // setring(RR); 3288 // return(te); 3289 // } 3137 3290 3138 3291 // Auxiliary routine … … 3149 3302 // points where the q's are null on S. 3150 3303 // The elements of caout are of the form (p,q,prep); 3151 proc selectextendcoef(matrix CC, ideal ida, ideal idb)3304 static proc selectextendcoef(matrix CC, ideal ida, ideal idb) 3152 3305 { 3153 3306 def RR=basering; … … 3196 3349 3197 3350 // Auxiliary routine 3198 // input: 3351 // plusP 3352 // Input: 3199 3353 // ideal E1: in some basering (depends only on the parameters) 3200 3354 // ideal E2: in some basering (depends only on the parameters) 3201 // output:3202 // ideal Ep=E1+E2; computed in P3203 proc plusP(ideal E1,ideal E2)3355 // Output: 3356 // ideal Ep=E1+E2; computed in @P 3357 static proc plusP(ideal E1,ideal E2) 3204 3358 { 3205 3359 def RR=basering; … … 3221 3375 // All the vi without zeroes are in outcomb, and those with zeroes are 3222 3376 // combined to form new intvec with the rest 3223 proc reform(list combpolys, intvec numdens)3377 static proc reform(list combpolys, intvec numdens) 3224 3378 { 3225 3379 list combp0; list combp1; int i; int j; int k; int l; list rest; intvec notfree; … … 3296 3450 } 3297 3451 3298 // Auxiliary routine3299 // nonnullCrep3300 proc nonnullCrep(poly f0,ideal ida0,ideal idb0)3301 {3302 int i;3303 def RR=basering;3304 setring(@P);3305 def f=imap(RR,f0);3306 def ida=imap(RR,ida0);3307 def idb=imap(RR,idb0);3308 def idaf=ida+f;3309 int te=1;3310 for(i=1;i<=size(idb);i++)3311 {3312 if(radicalmember(idb[i],idaf)==0)3313 {3314 te=0; break;3315 }3316 }3317 setring(RR);3318 return(te);3319 }3320 3452 3321 3453 // Auxiliary routine … … 3326 3458 // L=(p1,..,ps); F0=(f1,..,fs); 3327 3459 // F0[i] \in intersect_{j#i} p_i 3328 proc precombint(list L)3460 static proc precombint(list L) 3329 3461 { 3330 3462 int i; int j; int tes; … … 3369 3501 // Auxiliary routine 3370 3502 // minAssGTZ eliminating denominators 3371 proc minGTZ(ideal N);3503 static proc minGTZ(ideal N); 3372 3504 { 3373 3505 int i; int j; … … 3389 3521 // Input: 3390 3522 // ideal E: of null conditions 3391 // ideal N: of non-null conditions representing V(E) \V(N)3523 // ideal N: of non-null conditions representing V(E) \ V(N) 3392 3524 // Output: 3393 // 1 if V(E) \ V(N) = empty3525 // 1 if V(E) \ V(N) = empty 3394 3526 // 0 if not 3395 proc inconsistent(ideal E, ideal N)3527 static proc inconsistent(ideal E, ideal N) 3396 3528 { 3397 3529 int j; … … 3423 3555 // Auxiliary routine 3424 3556 // MDBasis: Minimal Dickson Basis 3425 proc MDBasis(ideal G)3557 static proc MDBasis(ideal G) 3426 3558 { 3427 3559 int i; int j; int te=1; … … 3449 3581 // Auxiliary routine 3450 3582 // primepartZ 3451 proc primepartZ(poly f); 3452 { 3453 def R=basering; 3583 static proc primepartZ(poly f); 3584 { 3454 3585 def cp=content(f); 3455 3586 def fp=f/cp; … … 3458 3589 3459 3590 // LCMLC 3460 proc LCMLC(ideal H)3591 static proc LCMLC(ideal H) 3461 3592 { 3462 3593 int i; … … 3498 3629 // but without canonical description of the segments. 3499 3630 // ((B,E,N),..,(B,E,N)) 3500 proc KSW(ideal F, list #)3631 static proc KSW(ideal F, list #) 3501 3632 { 3502 3633 setglobalrings(); … … 3570 3701 // Auxiliary routine 3571 3702 // sqf 3572 proc sqf(poly f)3703 static proc sqf(poly f) 3573 3704 { 3574 3705 def RR=basering; … … 3589 3720 // The ideal must be defined on C[parameters][variables] 3590 3721 // Output: 3591 proc KSW0(ideal F, ideal E, ideal N, int comment)3722 static proc KSW0(ideal F, ideal E, ideal N, int comment) 3592 3723 { 3593 3724 def R=basering; … … 3612 3743 E0=imap(@P,E1); 3613 3744 N0=imap(@P,N1); 3614 // E0=elimrepeated(E0);3615 // N0=elimrepeated(N0);3616 3745 if (inconsistent(E0,N0)==1) 3617 3746 { … … 3711 3840 // Auxiliary routine 3712 3841 // KSWtocgsdr 3713 proc KSWtocgsdr(list L)3842 static proc KSWtocgsdr(list L) 3714 3843 { 3715 3844 int i; list CG; ideal B; ideal lpp; int j; list NKrep; … … 3737 3866 // the ((p_1,(p_11,..,p_1k_1)),..,(p_r,(p_r1,..,p_rk_r))); 3738 3867 // the Prep of V(N) \ V(W) 3739 proc KtoPrep(ideal N, ideal W)3868 static proc KtoPrep(ideal N, ideal W) 3740 3869 { 3741 3870 int i; int j; … … 3781 3910 // input: the list of vertices of KSW 3782 3911 // output: the same terminal vertices grouped by lpp 3783 proc groupKSWsegments(list T) 3784 { 3785 //"T_T="; T; 3912 static proc groupKSWsegments(list T) 3913 { 3786 3914 int i; int j; 3787 3915 list L; … … 3814 3942 3815 3943 // indepparameters 3816 // Auxiliary routine to detect "Special"components of the locus3944 // Auxiliary routine to detect 'Special' components of the locus 3817 3945 // Input: ideal B 3818 3946 // Output: 3819 3947 // 1 if the solutions of the ideal do not depend on the parameters 3820 3948 // 0 if they depend 3821 proc indepparameters(ideal B)3949 static proc indepparameters(ideal B) 3822 3950 { 3823 3951 def R=basering; … … 3837 3965 // if the dimension in @P of an ideal in the parameters has dimension 0 then it returns 0 3838 3966 // else it retuns 1 3839 proc dimP0(ideal N)3967 static proc dimP0(ideal N) 3840 3968 { 3841 3969 def R=basering; … … 3850 3978 } 3851 3979 3852 // Auxiliary routine.3853 // input: ideals E and F (assumed in ring @P3854 // returns: 1 if ideal E is contained in ideal F (assumed F is std basis)3855 // 0 if not3856 proc containedideal(ideal E, ideal F)3857 {3858 int i; int t; poly f;3859 if(equalideals(F,ideal(0)))3860 {3861 if(equalideals(E,ideal(0))==0){return(0);}3862 else(return(1));3863 }3864 t=1; i=1;3865 while((t==1) and (i<=size(E)))3866 {3867 attrib(F,"isSB",1);3868 f=reduce(E[i],F);3869 if(f!=0){t=0;}3870 i++;3871 }3872 return(t);3873 }3874 3875 // addcons: given a set of locally closed sets given in P-representation,3876 // (particularly a subset of components of a selection of segments3877 // of the Grobner cover), it builds the canonical P-representation3878 // of the corresponding constructible set, of its union, including levels it they are.3879 // input: a list L of disjoint segments (for exmple a selection of segments of the Groebner cover)3880 // of the form3881 // ( ( (p1_1,(p1_11,..,p1_1k_1).. (p1_s,(p1_s1,..,p1_sk_s)),..,3882 // ( (pn_1,(pn_11,..,pn_1j_1).. (pn_s,(pn_s1,..,pn_sj_s)) )3883 // output: The canonical P-representation of the constructible set resulting by3884 // adding the given components.3885 // The first element of each component can be ignored. It is only for internal use.3886 // The fifth element of each component is the level of the constructible set3887 // of the component.3888 // It is no need a previous call to setglobalrings()3889 proc addcons(list L)3890 "USAGE: addcons( ( ( (p1_1,(p1_11,..,p1_1k_1).. (p1_s,(p1_s1,..,p1_sk_s)),..,3891 ( (pn_1,(pn_11,..,pn_1j_1).. (pn_s,(pn_s1,..,pn_sj_s)) ) )3892 a list L of locally closed sets in P-representation3893 RETURN: the canonical P-representation of the constructible set of the union.3894 NOTE: It is called internally by the routines locus, locusdg,3895 3896 KEYWORDS: P-representation, constructible set3897 EXAMPLE: adccons; shows an example"3898 {3899 int te;3900 if(defined(@P)){te=1;}3901 else{setglobalrings();}3902 list notadded; list P0;3903 int i; int j; int k; int l;3904 intvec v; intvec v1; intvec v0;3905 ideal J; list K; list L1;3906 for(i=1;i<=size(L);i++)3907 {3908 if(equalideals(L[i][1][1],ideal(1))==0)3909 {L1[size(L1)+1]=L[i];}3910 }3911 L=L1;3912 for(i=1;i<=size(L);i++)3913 {3914 for(j=1;j<=size(L[i]);j++)3915 {3916 v=i,j;3917 notadded[size(notadded)+1]=v;3918 }3919 }3920 //"T_notadded="; notadded;3921 int level=1;3922 list P=L;3923 list LL;3924 list Ln;3925 //int cont=0;3926 while(size(notadded)>0)3927 {3928 kill notadded; list notadded;3929 for(i=1;i<=size(P);i++)3930 {3931 for(j=1;j<=size(P[i]);j++)3932 {3933 v=i,j;3934 notadded[size(notadded)+1]=v;3935 }3936 }3937 //"T_notadded="; notadded;3938 //cont++;3939 P0=P;3940 Ln=LCUnion(P);3941 //"T_Ln="; Ln;3942 notadded=minuselements(notadded,@Q2);3943 //"T_@Q2="; @Q2;3944 //"T_notadded="; notadded;3945 for(i=1;i<=size(Ln);i++)3946 {3947 //Ln[i][4]= ; JA HAURIA DE VENIR DE LCUnion3948 Ln[i][5]=level;3949 LL[size(LL)+1]=Ln[i];3950 }3951 i=0;j=0;3952 v=0,0;3953 v0=0,0;3954 kill P; list P;3955 for(l=1;l<=size(notadded);l++)3956 {3957 v1=notadded[l];3958 if(v1[1]<>v0[1]){i++;j=1; P[i]=K;} // list P[i];3959 else3960 {3961 if(v1[2]<>v0[2])3962 {3963 j=j+1;3964 }3965 }3966 v=i,j;3967 //"T_v1="; v1;3968 P[i][j]=K; P[i][j][1]=J; P[i][j][2]=K;3969 P[i][j][1]=P0[v1[1]][v1[2]][1];3970 //"T_P0[v1[1]][v1[2]][2]="; P0[v1[1]][v1[2]][2];3971 //"T_size(P0[v1[1]][v1[2]][2])="; size(P0[v1[1]][v1[2]][2]);3972 for(k=1;k<=size(P0[v1[1]][v1[2]][2]);k++)3973 {3974 P[i][j][2][k]=P0[v1[1]][v1[2]][2][k];3975 //string("T_P[",i,"][",j,"][2][",k,"]="); P[i][j][2][k];3976 }3977 v0=v1;3978 //"T_P_1="; P;3979 }3980 //"T_P="; P;3981 level++;3982 //if(cont>3){break;}3983 //kill notadded; list notadded;3984 }3985 if(defined(@Q2)){kill @Q2;}3986 if(te==0){kill @P; kill @R; kill @RP;}3987 //"T_LL_sortida addcons="; LL; "Fi sortida";3988 return(LL);3989 }3990 example3991 {3992 "EXAMPLE:"; echo = 2;3993 ring R=(0,a,b),(x1,y1,x2,y2,p,r),dp;3994 ideal S93=(a+1)^2+b^2-(p+1)^2,3995 (a-1)^2+b^2-(1-r)^2,3996 a*y1-b*x1-y1+b,3997 a*y2-b*x2+y2-b,3998 -2*y1+b*x1-(a+p)*y1+b,3999 2*y2+b*x2-(a+r)*y2-b,4000 (x1+1)^2+y1^2-(x2-1)^2-y2^2;4001 short=0;4002 "System S93="; S93; " ";4003 def GC93=grobcov(S93);4004 "grobcov(S93)="; GC93; " ";4005 int i;4006 list H;4007 for(i=1;i<=size(GC93);i++){H[i]=GC93[i][3];}4008 "H="; H;4009 "addcons(H)="; addcons(H);4010 }4011 4012 3980 // Takes a list of intvec and sorts it and eliminates repeated elements. 4013 // Auxiliary routine used in addcons4014 proc sortpairs(L)3981 // Auxiliary routine 3982 static proc sortpairs(L) 4015 3983 { 4016 3984 def L1=sort(L); … … 4020 3988 4021 3989 // Eliminates the pairs of L1 that are also in L2. 4022 // Auxiliary routine used in addcons4023 proc minuselements(list L1,list L2)3990 // Auxiliary routine 3991 static proc minuselements(list L1,list L2) 4024 3992 { 4025 3993 int i; … … 4032 4000 } 4033 4001 4002 // NorSing 4003 // Input: 4004 // ideal B: the basis of a component of the grobcov 4005 // ideal E: the top of the component (assumed to be of dimension > 0 (single equation) 4006 // ideal N: the holes of the component 4007 // Output: 4008 // int d: the dimension of B on the variables reduced by the holes. 4009 // if d>0 then the component is 'Normal' 4010 // if d==0 then the component is 'Singular' 4011 static proc NorSing(ideal B, ideal E, ideal N, list #) 4012 { 4013 int i; int j; int Fenv=0; int env; int dd; 4014 list DD=#; 4015 def RR=basering; 4016 int moverdim=2; 4017 int version=0; 4018 int nv=nvars(RR); 4019 if(nv<4){version=1;} 4020 int d; 4021 poly F; 4022 for(i=1;i<=(size(DD) div 2);i++) 4023 { 4024 if(DD[2*i-1]=="movdim"){moverdim=DD[2*i];} 4025 if(DD[2*i-1]=="version"){version=DD[2*i];} 4026 if(DD[2*i-1]=="family"){F=DD[2*i];} 4027 } 4028 if(F!=0){Fenv=1;} 4029 //"T_B="; B; "E="; E; "N="; N; 4030 list L0; 4031 if(dimP0(E)==0){L0=2,"Normal";} // 2 es fals pero ha de ser >0 encara que sigui 0 4032 else 4033 { 4034 if(version==0) 4035 { 4036 //"T_B="; B; // Computing std(B+E,plex(x,y,x1,..xn)) one can detect if there is a first part 4037 // independent of parameters giving the variables with dimension 0 4038 dd=indepparameters(B); 4039 if (dd==1){d=0; L0=d,string(B),determineF(B,F,E);} 4040 else{d=1; L0=2,"Normal";} 4041 } 4042 else 4043 { 4044 def RH=ringlist(RR); 4045 //"T_RH="; RH; 4046 def H=RH; 4047 H[1]=0; 4048 H[2]=RH[1][2]+RH[2]; 4049 int n=size(H[2]); 4050 intvec ll; 4051 for(i=1;i<=n;i++) 4052 { 4053 ll[i]=1; 4054 } 4055 H[3][1][1]="lp"; 4056 H[3][1][2]=ll; 4057 def RRH=ring(H); 4058 setring(RRH); 4059 ideal BH=imap(RR,B); 4060 ideal EH=imap(RR,E); 4061 ideal NH=imap(RR,N); 4062 if(Fenv==1){poly FH=imap(RR,F);} 4063 for(i=1;i<=size(EH);i++){BH[size(BH)+1]=EH[i];} 4064 BH=std(BH); // MOLT COSTOS!!! 4065 ideal G; 4066 ideal r; poly q; 4067 for(i=1;i<=size(BH);i++) 4068 { 4069 r=factorize(BH[i],1); 4070 q=1; 4071 for(j=1;j<=size(r);j++) 4072 { 4073 if((pdivi(r[j],NH)[1] != 0) or (equalideals(ideal(NH),ideal(1)))) 4074 { 4075 q=q*r[j]; 4076 } 4077 } 4078 if(q!=1){G[size(G)+1]=q;} 4079 } 4080 setring RR; 4081 def GG=imap(RRH,G); 4082 ideal GGG; 4083 if(defined(L0)){kill L0; list L0;} 4084 for(i=1;i<=size(GG);i++) 4085 { 4086 if(indepparameters(GG[i])){GGG[size(GGG)+1]=GG[i];} 4087 } 4088 GGG=std(GGG); 4089 ideal GLM; 4090 for(i=1;i<=size(GGG);i++) 4091 { 4092 GLM[i]=leadmonom(GGG[i]); 4093 } 4094 attrib(GLM,"IsSB",1); 4095 d=dim(std(GLM)); 4096 string antiim=string(GGG); 4097 L0=d,antiim; 4098 if(d==0) 4099 { 4100 //" ";string("Antiimage of Special component = ", GGG); 4101 if(Fenv==1) 4102 { 4103 L0[3]=determineF(GGG,F,E); 4104 } 4105 } 4106 else 4107 { 4108 L0[2]="Normal"; 4109 } 4110 } 4111 } 4112 return(L0); 4113 } 4114 4115 static proc determineF(ideal A,poly F,ideal E) 4116 { 4117 int env; int i; 4118 def RR=basering; 4119 def RH=ringlist(RR); 4120 def H=RH; 4121 H[1]=0; 4122 H[2]=RH[1][2]+RH[2]; 4123 int n=size(H[2]); 4124 intvec ll; 4125 for(i=1;i<=n;i++) 4126 { 4127 ll[i]=1; 4128 } 4129 H[3][1][1]="lp"; 4130 H[3][1][2]=ll; 4131 def RRH=ring(H); 4132 4133 //" ";string("Antiimage of Special component = ", GGG); 4134 4135 setring(RRH); 4136 list LL; 4137 def AA=imap(RR,A); 4138 def FH=imap(RR,F); 4139 def EH=imap(RR,E); 4140 ideal M=std(AA+FH); 4141 def rh=reduce(EH,M); 4142 if(rh==0){env=1;} else{env=0;} 4143 setring RR; 4144 //L0[3]=env; 4145 return(env); 4146 } 4147 4148 // DimPar 4149 // Auxilliary routine to NorSing determining the dimension of a parametric ideal 4150 // Does not use @P and define it directly because is assumes that 4151 // variables and parameters have been inverted 4152 static proc DimPar(ideal E) 4153 { 4154 def RRH=basering; 4155 def RHx=ringlist(RRH); 4156 def Prin=ring(RHx[1]); 4157 setring(Prin); 4158 def E2=std(imap(RRH,E)); 4159 def d=dim(E2); 4160 setring RRH; 4161 return(d); 4162 } 4163 4034 4164 // locus0(G): Private routine used by locus (the public routine), that 4035 4165 // builds the diferent components. 4036 4166 // input: The output G of the grobcov (in generic representation, which is the default option) 4167 // Options: The algorithm allows the following options ar pair of arguments: 4168 // "movdim", d : by default movdim is 2 but it can be set to other values 4169 // "version", v : There are two versions of the algorithm. ('version',1) is 4170 // a full algorithm that always distinguishes correctly between 'Normal' 4171 // and 'Special' components, whereas ('version',0) can decalre a component 4172 // as 'Normal' being really 'Special', but is more effective. By default ('version',1) 4173 // is used when the number of variables is less than 4 and 0 if not. 4174 // The user can force to use one or other version, but it is not recommended. 4175 // "system", ideal F: if the initial systrem is passed as an argument. This is actually not used. 4176 // "comments", c: by default it is 0, but it can be set to 1. 4177 // Usually locus problems have mover coordinates, variables and tracer coordinates. 4178 // The mover coordinates are to be placed as the last variables, and by default, 4179 // its number is 2. If one consider locus problems in higer dimensions, the number of 4180 // mover coordinates (placed as the last variables) is to be given as an option. 4037 4181 // output: 4038 4182 // list, the canonical P-representation of the Normal and Non-Normal locus: … … 4046 4190 // If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level 4047 4191 // gives the depth of the component. 4048 proc locus0(list GG, list #) 4049 { 4050 int t1=1; int t2=1; 4192 static proc locus0(list GG, list #) 4193 { 4194 int te=0; 4195 int t1=1; int t2=1; int i; 4051 4196 def R=basering; 4197 //if(defined(@P)==1){te=1; kill @P; kill @R; kill @RP; } 4198 //setglobalrings(); 4199 // Options 4200 list DD=#; 4052 4201 int moverdim=nvars(R); 4202 int version=0; 4203 int nv=nvars(R); 4204 if(nv<4){version=1;} 4205 int comment=0; 4206 ideal Fm; 4207 poly F; 4208 for(i=1;i<=(size(DD) div 2);i++) 4209 { 4210 if(DD[2*i-1]=="movdim"){moverdim=DD[2*i];} 4211 if(DD[2*i-1]=="version"){version=DD[2*i];} 4212 if(DD[2*i-1]=="system"){Fm=DD[2*i];} 4213 if(DD[2*i-1]=="comment"){comment=DD[2*i];} 4214 if(DD[2*i-1]=="family"){F=DD[2*i];} 4215 } 4053 4216 list HHH; 4054 4217 if (GG[1][1][1]==1 and GG[1][2][1]==1 and GG[1][3][1][1][1]==0 and GG[1][3][1][2][1]==1){return(HHH);} 4055 list Lop=#; 4056 if(size(Lop)>0){moverdim=Lop[1];} 4057 setglobalrings(); 4058 list G1; list G2; 4218 list G1; list G2; 4059 4219 def G=GG; 4060 4220 list Q1; list Q2; 4061 int i; intd; int j; int k;4221 int d; int j; int k; 4062 4222 t1=1; 4063 4223 for(i=1;i<=size(G);i++) … … 4115 4275 } 4116 4276 else{list P1;} 4117 ideal BB; 4277 ideal BB; int dd; list NS; 4118 4278 for(i=1;i<=size(P1);i++) 4119 4279 { 4120 if (indepparameters(P1[i][3])==1){P1[i][3]="Special";} 4121 else{P1[i][3]="Normal";} 4280 NS=NorSing(P1[i][3],P1[i][1],P1[i][2][1],DD); 4281 dd=NS[1]; 4282 if(dd==0){P1[i][3]=NS;} //"Special"; 4283 else{P1[i][3]="Normal";} 4122 4284 } 4123 4285 list P2; … … 4133 4295 for(i=1;i<=size(P2);i++){Q2[i]=l; Q2[i][1]=P2[i];} P2=Q2; 4134 4296 4135 setring @P;4297 setring(@P); 4136 4298 ideal J; 4137 4299 if(t1==1) 4138 4300 { 4139 4301 def C1=imap(R,P1); 4140 def L1= addcons(C1);4302 def L1=AddLocus(C1); 4141 4303 } 4142 4304 else{list C1; list L1; kill P1; list P1;} … … 4144 4306 { 4145 4307 def C2=imap(R,P2); 4146 def L2= addcons(C2);4147 4308 def L2=AddLocus(C2); 4309 } 4148 4310 else{list L2; list C2; kill P2; list P2;} 4149 4311 for(i=1;i<=size(L2);i++) … … 4169 4331 def L=imap(@P,LN); 4170 4332 for(i=1;i<=size(L);i++){if(size(L[i][2])==0){L[i][2]=ideal(1);}} 4171 kill @R; kill @RP; kill @P;4333 //if(te==0){kill @R; kill @RP; kill @P;} 4172 4334 list LL; 4173 4335 for(i=1;i<=size(L);i++) 4174 4336 { 4175 LL[i]=l; 4176 LL[i]=elimfromlist(L[i],1); 4177 } 4178 return(LL); 4179 } 4180 4181 // locus0dg(G): Private routine used by locusdg (the public routine), that 4182 // builds the diferent components used in Dynamical Geometry 4183 // input: The output G of the grobcov (in generic representation, which is the default option) 4184 // output: 4185 // list, the canonical P-representation of the Relevant components of the locus in Dynamical Geometry, 4186 // i.e. the Normal and Accumulation components. 4187 // This routine is compemented by locusdg that calls it in order to eliminate problems 4188 // with degenerate points of the mover. 4189 // The output components are given as 4190 // ((p1,(p11,..p1s_1),type_1,level_1),..,(pk,(pk1,..pks_k),type_k,level_k) 4191 // whwre type_i is always "Relevant". 4192 // The components are given in canonical P-representation of the subset. 4193 // If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level 4194 // gives the depth of the component. 4195 proc locus0dg(list GG, list #) 4196 { 4197 int t1=1; int t2=1; int ojo; 4198 def R=basering; 4199 int moverdim=nvars(R); 4200 list HHH; 4201 if (GG[1][1][1]==1 and GG[1][2][1]==1 and GG[1][3][1][1][1]==0 and GG[1][3][1][2][1]==1){return(HHH);} 4202 list Lop=#; 4203 if(size(Lop)>0){moverdim=Lop[1];} 4204 setglobalrings(); 4205 list G1; list G2; 4206 def G=GG; 4207 list Q1; list Q2; 4208 int i; int d; int j; int k; 4209 t1=1; 4210 for(i=1;i<=size(G);i++) 4211 { 4212 attrib(G[i][1],"IsSB",1); 4213 d=locusdim(G[i][2],moverdim); 4214 if(d==0){G1[size(G1)+1]=G[i];} 4215 else 4216 { 4217 if(d>0){G2[size(G2)+1]=G[i];} 4218 } 4219 } 4220 if(size(G1)==0){t1=0;} 4221 if(size(G2)==0){t2=0;} 4222 setring(@RP); 4223 if(t1) 4224 { 4225 list G1RP=imap(R,G1); 4226 } 4227 else {list G1RP;} 4228 list P1RP; 4229 ideal B; 4230 for(i=1;i<=size(G1RP);i++) 4231 { 4232 kill B; 4233 ideal B; 4234 for(k=1;k<=size(G1RP[i][3]);k++) 4235 { 4236 attrib(G1RP[i][3][k][1],"IsSB",1); 4237 G1RP[i][3][k][1]=std(G1RP[i][3][k][1]); 4238 for(j=1;j<=size(G1RP[i][2]);j++) 4239 { 4240 B[j]=reduce(G1RP[i][2][j],G1RP[i][3][k][1]); 4241 } 4242 P1RP[size(P1RP)+1]=list(G1RP[i][3][k][1],G1RP[i][3][k][2],B); 4243 } 4244 } 4245 setring(R); 4246 ideal h; 4247 if(t1) 4248 { 4249 def P1=imap(@RP,P1RP); 4250 for(i=1;i<=size(P1);i++) 4251 { 4252 for(j=1;j<=size(P1[i][3]);j++) 4253 { 4254 h=factorize(P1[i][3][j],1); 4255 P1[i][3][j]=h[1]; 4256 for(k=2;k<=size(h);k++) 4257 { 4258 P1[i][3][j]=P1[i][3][j]*h[k]; 4259 } 4260 } 4261 } 4262 } 4263 else{list P1;} 4264 ideal BB; 4265 for(i=1;i<=size(P1);i++) 4266 { 4267 if (indepparameters(P1[i][3])==1){P1[i][3]="Special";} 4268 else{P1[i][3]="Relevant";} 4269 } 4270 list P2; 4271 for(i=1;i<=size(G2);i++) 4272 { 4273 for(k=1;k<=size(G2[i][3]);k++) 4274 { 4275 P2[size(P2)+1]=list(G2[i][3][k][1],G2[i][3][k][2]); 4276 } 4277 } 4278 list l; 4279 for(i=1;i<=size(P1);i++){Q1[i]=l; Q1[i][1]=P1[i];} P1=Q1; 4280 for(i=1;i<=size(P2);i++){Q2[i]=l; Q2[i][1]=P2[i];} P2=Q2; 4281 4282 setring @P; 4283 ideal J; 4284 if(t1==1) 4285 { 4286 def C1=imap(R,P1); 4287 def L1=addcons(C1); 4288 } 4289 else{list C1; list L1; kill P1; list P1;} 4290 if(t2==1) 4291 { 4292 def C2=imap(R,P2); 4293 def L2=addcons(C2); 4294 } 4295 else{list L2; list C2; kill P2; list P2;} 4296 for(i=1;i<=size(L2);i++) 4297 { 4298 J=std(L2[i][2]); 4299 d=dim(J); // AQUI 4300 if(d==0) 4301 { 4302 L2[i][4]=string("Relevant",L2[i][4]); 4303 } 4304 else{L2[i][4]=string("Degenerate",L2[i][4]);} 4305 } 4306 list LN; 4307 list ll; list l0; 4308 if(t1==1) 4309 { 4310 for(i=1;i<=size(L1);i++) 4311 { 4312 if(L1[i][4]=="Relevant") 4313 { 4314 LN[size(LN)+1]=l0; 4315 LN[size(LN)][1]=L1[i]; 4316 } 4317 } 4318 } 4319 if(t2==1) 4320 { 4321 for(i=1;i<=size(L2);i++) 4322 { 4323 if(L2[i][4]=="Relevant") 4324 { 4325 LN[size(LN)+1]=l0; 4326 LN[size(LN)][1]=L2[i]; 4327 } 4328 } 4329 } 4330 list LNN; 4331 kill ll; list ll; list lll; list llll; 4332 for(i=1;i<=size(LN);i++) 4333 { 4334 LNN[size(LNN)+1]=l0; 4335 ll=LN[i][1]; lll[1]=ll[2]; lll[2]=ll[3]; lll[3]=ll[4]; LNN[size(LNN)][1]=lll; 4336 } 4337 kill LN; list LN; 4338 LN=addcons(LNN); 4339 if(size(LN)==0){ojo=1;} 4340 setring(R); 4341 if(ojo==1){list L;} 4342 else 4343 { 4344 def L=imap(@P,LN); 4345 for(i=1;i<=size(L);i++){if(size(L[i][2])==0){L[i][2]=ideal(1);}} 4346 } 4347 kill @R; kill @RP; kill @P; 4348 list LL; 4349 for(i=1;i<=size(L);i++) 4350 { 4351 LL[i]=l; 4352 LL[i]=elimfromlist(L[i],1); 4353 } 4354 return(LL); 4355 } 4356 4337 if(typeof(L[i][4])=="list") {L[i][4][1]="Special";} 4338 l[1]=L[i][2]; 4339 l[2]=L[i][3]; 4340 l[3]=L[i][4]; 4341 l[4]=L[i][5]; 4342 L[i]=l; 4343 } 4344 return(L); 4345 } 4357 4346 4358 4347 // locus(G): Special routine for determining the locus of points 4359 // of geometrical constructions. Given a parametric ideal J with 4360 // parameters (a_1,..a_m) and variables (x_1,..,xn), 4361 // representing the system determining 4362 // the locus of points (a_1,..,a_m) who verify certain 4363 // properties, computing the grobcov G of 4364 // J and applying to it locus, determines the different 4365 // classes of locus components. The components can be 4366 // Normal, Special, Accumulation, Degenerate. 4367 // The output are the components given in P-canonical form 4368 // of at most 4 constructible sets: Normal, Special, Accumulation, 4369 // Degenerate. 4370 // The description of the algorithm and definitions is 4371 // given in a forthcoming paper by Abanades, Botana, Montes, Recio. 4372 // Usually locus problems have mover coordinates, variables and tracer coordinates. 4373 // The mover coordinates are to be placed as the last variables, and by default, 4374 // its number is 2. If one consider locus problems in higer dimensions, the number of 4375 // mover coordinates (placed as the last variables) is to be given as an option. 4376 // 4348 // of geometrical constructions. 4377 4349 // input: The output G of the grobcov (in generic representation, which is the default option for grobcov) 4378 4350 // output: … … 4397 4369 // gives the depth of the component of the constructible set. 4398 4370 proc locus(list GG, list #) 4399 "USAGE: locus(G); 4400 The input must be the grobcov of a parametrical ideal 4401 RETURN: The locus. 4402 The output are the components of four constructible subsets of the locus 4403 of the parametrical system: Normal , Special, Accumulation and Degenerate. 4404 These components are 4405 given as a list of (pi,(pi1,..pis_i),type_i,level_i) varying i, 4406 where the p's are prime ideals, the type can be: Normal, Special, 4407 Accumulation, Degenerate. 4408 NOTE: It can only be called after computing the grobcov of the 4409 parametrical ideal in generic representation ('ext',0), 4410 which is the default. 4411 The basering R, must be of the form Q[a_1,..,a_m][x_1,..,x_n]. 4412 KEYWORDS: geometrical locus, locus, loci. 4413 EXAMPLE: locus; shows an example" 4414 { 4371 "USAGE: locus(G) 4372 The input must be the grobcov of a parametrical ideal in Q[a][x], 4373 (a=parameters, x=variables). In fact a must be the tracer coordinates 4374 and x the mover coordinates and other auxiliary ones. 4375 Special routine for determining the locus of points 4376 of geometrical constructions. Given a parametric ideal J 4377 representing the system determining the locus of points (a) 4378 who verify certain properties, the call to locus on the output of grobcov( J ) 4379 determines the different classes of locus components, following 4380 the taxonomy defined in 4381 Abanades, Botana, Montes, Recio: 4382 \"An Algebraic Taxonomy for Locus Computation in Dynamic Geometry\". 4383 Computer-Aided Design 56 (2014) 22-33. 4384 The components can be Normal, Special, Accumulation, Degenerate. 4385 OPTIONS: The algorithm allows the following options as pair of arguments: 4386 \"movdim\", d : by default movdim is 2 but it can be set to other values, 4387 and represents the number of mever variables. they should be given as 4388 the last variables of the ring. 4389 \"version\", v : There are two versions of the algorithm. (\"version\",1) is 4390 a full algorithm that always distinguishes correctly between 'Normal' 4391 and 'Special' components, whereas \("version\",0) can decalre a component 4392 as 'Normal' being really 'Special', but is more effective. By default (\"version\",1) 4393 is used when the number of variables is less than 4 and 0 if not. 4394 The user can force to use one or other version, but it is not recommended. 4395 \"system\", ideal F: if the initial system is passed as an argument. This is actually not used. 4396 \"comments\", c: by default it is 0, but it can be set to 1. 4397 Usually locus problems have mover coordinates, variables and tracer coordinates. 4398 The mover coordinates are to be placed as the last variables, and by default, 4399 its number is 2. If one consider locus problems in higer dimensions, the number of 4400 mover coordinates (placed as the last variables) is to be given as an option. 4401 RETURN: The locus. The output is a list of the components ( C_1,.. C_n ) where 4402 C_i = (p_i,(p_i1,..p_is_i), type_i,l evel_i ) and type_i can be 4403 'Normal', 'Special', Accumulation', 'Degenerate'. The 'Special' components 4404 return more information, namely the antiimage of the component, that 4405 is 0-dimensional for these kind of components. 4406 Normal components: for each point in the component, 4407 the number of solutions in the variables is finite, and 4408 the solutions depend on the point in the component. 4409 Special components: for each point in the component, 4410 the number of solutions in the variables is finite. The 4411 antiimage of the component is 0-dimensional. 4412 Accumlation points: are 0-dimensional components whose 4413 antiimage is not zero-dimansional. 4414 Degenerate components: are components of dimension greater than 0 4415 whose antiimage is not-zero-diemansional. 4416 The components are given in canonical P-representation. 4417 The levels of a class of locus are 1, 4418 because they represent locally closed. sets. 4419 NOTE: It can only be called after computing the grobcov of the 4420 parametrical ideal in generic representation ('ext',0), 4421 which is the default. 4422 The basering R, must be of the form Q[a_1,..,a_m][x_1,..,x_n]. 4423 KEYWORDS: geometrical locus, locus, loci. 4424 EXAMPLE: locus; shows an example" 4425 { 4426 int tes=0; int i; 4415 4427 def R=basering; 4416 int dd=2; int comment=0; 4428 if(defined(@P)==1){tes=1; kill @P; kill @R; kill @RP;} 4429 setglobalrings(); 4430 // Options 4417 4431 list DD=#; 4418 if (size(DD)>1){comment=1;} 4419 if(size(DD)>0){dd=DD[1];} 4420 int i; int j; int k; 4432 int moverdim=nvars(R); 4433 int version=0; 4434 int nv=nvars(R); 4435 if(nv<4){version=1;} 4436 int comment=0; 4437 ideal Fm; 4438 for(i=1;i<=(size(DD) div 2);i++) 4439 { 4440 if(DD[2*i-1]=="movdim"){moverdim=DD[2*i];} 4441 if(DD[2*i-1]=="version"){version=DD[2*i];} 4442 if(DD[2*i-1]=="system"){Fm=DD[2*i];} 4443 if(DD[2*i-1]=="comment"){comment=DD[2*i];} 4444 if(DD[2*i-1]=="family"){poly F=DD[2*i];} 4445 } 4446 int j; int k; 4421 4447 def B0=GG[1][2]; 4422 if (equalideals(B0,ideal(1))) 4423 { 4424 return(locus0(GG)); 4448 def H0=GG[1][3][1][1]; 4449 if (equalideals(B0,ideal(1)) or (equalideals(H0,ideal(0))==0)) 4450 { 4451 return(locus0(GG,DD)); 4425 4452 } 4426 4453 else … … 4449 4476 } 4450 4477 N=px,py; 4451 setglobalrings();4452 4478 te=indepparameters(N); 4453 4479 if(te) … … 4469 4495 if(te==0){nGP[size(nGP)+1]=GP[j];} 4470 4496 } 4471 } 4472 } 4497 } 4498 else{"Warning! Problem with more than one mover. Not able to solve it."; list L; return(L);} 4499 } 4500 def LL=locus0(nGP,DD); 4473 4501 kill @RP; kill @P; kill @R; 4474 return( locus0(nGP,dd));4502 return(LL); 4475 4503 } 4476 4504 example 4477 {"EXAMPLE:"; echo = 2; 4478 ring R=(0,a,b),(x4,x3,x2,x1),dp; 4479 ideal S=(x1-3)^2+(x2-1)^2-9, 4480 (4-x2)*(x3-3)+(x1-3)*(x4-1), 4481 (3-x1)*(x3-x1)+(4-x2)*(x4-x2), 4482 (4-x4)*a+(x3-3)*b+3*x4-4*x3, 4483 (a-x1)^2+(b-x2)^2-(x1-x3)^2-(x2-x4)^2; 4484 short=0; 4485 locus(grobcov(S)); " "; 4486 kill R; 4505 { 4506 "EXAMPLE:"; echo = 2; 4487 4507 ring R=(0,a,b),(x,y),dp; 4488 4508 short=0; 4489 "Concoid"; 4509 4510 // Concoid 4490 4511 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4491 "System="; S96; " "; 4512 // System S96= 4513 S96; 4492 4514 locus(grobcov(S96)); 4493 kill R; ring R=(0,x,y),(x1,x2),dp; 4515 kill R; 4516 // ******************************************** 4517 ring R=(0,a,b),(x4,x3,x2,x1),dp; 4518 short=0; 4519 ideal S=(x1-3)^2+(x2-1)^2-9, 4520 (4-x2)*(x3-3)+(x1-3)*(x4-1), 4521 (3-x1)*(x3-x1)+(4-x2)*(x4-x2), 4522 (4-x4)*a+(x3-3)*b+3*x4-4*x3, 4523 (a-x1)^2+(b-x2)^2-(x1-x3)^2-(x2-x4)^2; 4524 // System S= 4525 S; 4526 locus(grobcov(S)); 4527 kill R; 4528 "********************************************"; 4529 4530 ring R=(0,x,y),(x1,x2),dp; 4531 short=0; 4494 4532 ideal S=-(x - 5)*(x1 - 1) - (x2 - 2)*(y - 2), 4495 (x1 - 5)^2 + (x2 - 2)^2 - 4, 4496 -2*(x - 5)*(x2 - 2) + 2*(x1 - 5)*(y - 2); 4497 "System="; S; 4498 locus(grobcov(S)); " "; 4499 ideal S1=-(x - x1)*(x1 - 4) + (x2 - y)*(x2 - 4), 4500 (x1 - 4)^2 + (x2 - 2)^2 - 4, 4501 -2*(x1 - 4)*(2*x2 - y - 4) - 2*(x - 2*x1 + 4)*(x2 - 2); 4502 "System="; S1; 4503 locus(grobcov(S1)); 4533 (x1 - 5)^2 + (x2 - 2)^2 - 4, 4534 -2*(x - 5)*(x2 - 2) + 2*(x1 - 5)*(y - 2); 4535 // System S= 4536 S; 4537 locus(grobcov(S)); 4504 4538 } 4505 4539 … … 4523 4557 // mover coordinates (placed as the last variables) is to be given as an option. 4524 4558 // 4525 // input: The output G of the grobcov (in generic representation, which is the default option for grobcov)4559 // input: The output of locus(G); 4526 4560 // output: 4527 4561 // list, the canonical P-representation of the Normal and Non-Normal locus: … … 4544 4578 // If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level 4545 4579 // gives the depth of the component of the constructible set. 4546 proc locusdg(list GG, list #) 4547 "USAGE: locus(G); 4548 The input must be the grobcov of a parametrical ideal 4549 RETURN: The locus. 4550 The output are the components of two constructible subsets of the locus 4551 of the parametrical system.: Normal and Non-normal. 4552 These components are 4553 given as a list of (pi,(pi1,..pis_i),type_i,level_i) varying i, 4554 where the p's are prime ideals, the type can be: Normal, Special, 4555 Accumulation, Degenerate. 4556 NOTE: It can only be called after computing the grobcov of the 4557 parametrical ideal in generic representation ('ext',0), 4558 which is the default. 4559 The basering R, must be of the form Q[a_1,..,a_m][x_1,..,x_n]. 4560 KEYWORDS: geometrical locus, locus, loci. 4561 EXAMPLE: locusdg; shows an example" 4562 { 4563 def R=basering; 4564 int dd=2; int comment=0; 4565 list DD=#; 4566 if (size(DD)>1){comment=1;} 4567 if(size(DD)>0){dd=DD[1];} 4568 int i; int j; int k; 4569 def B0=GG[1][2]; 4570 if (equalideals(B0,ideal(1))) 4571 { 4572 return(locus0dg(GG)); 4573 } 4574 else 4575 { 4576 int n=nvars(R); 4577 ideal vmov=var(n-1),var(n); 4578 ideal N; 4579 intvec xw; intvec yw; 4580 for(i=1;i<=n-1;i++){xw[i]=0;} 4581 xw[n]=1; 4582 for(i=1;i<=n;i++){yw[i]=0;} 4583 yw[n-1]=1; 4584 poly px; poly py; 4585 int te=1; 4586 i=1; 4587 while( te and i<=size(B0)) 4588 { 4589 if((deg(B0[i],xw)==1) and (deg(B0[i])==1)){px=B0[i]; te=0;} 4590 i++; 4591 } 4592 i=1; te=1; 4593 while( te and i<=size(B0)) 4594 { 4595 if((deg(B0[i],yw)==1) and (deg(B0[i])==1)){py=B0[i]; te=0;} 4596 i++; 4597 } 4598 N=px,py; 4599 setglobalrings(); 4600 te=indepparameters(N); 4601 if(te) 4602 { 4603 string("locus detected that the mover must avoid point (",N,") in order to obtain the correct locus"); 4604 // eliminates segments of GG where N is contained in the basis 4605 list nGP; 4606 def GP=GG; 4607 ideal BP; 4608 for(j=1;j<=size(GP);j++) 4609 { 4610 te=1; k=1; 4611 BP=GP[j][2]; 4612 while((te==1) and (k<=size(N))) 4613 { 4614 if(pdivi(N[k],BP)[1]!=0){te=0;} 4615 k++; 4616 } 4617 if(te==0){nGP[size(nGP)+1]=GP[j];} 4618 } 4619 } 4620 } 4621 //"T_nGP="; nGP; 4622 kill @RP; kill @P; kill @R; 4623 return(locus0dg(nGP,dd)); 4580 proc locusdg(list L) 4581 "USAGE: locusdg(L) The call must be locusdg(locus(grobcov(S))). 4582 RETURN: The output is the list of the 'Relevant' components of the locus 4583 in Dynamic Geometry:(C1,..,C:m), where 4584 C_i= ( p_i,(p_i1,..p_is_i), 'Relevant', level_i ) 4585 The 'Relevant' components are the 'Normal' and 'Accumulation' components 4586 of the locus. (See help for locus). 4587 4588 NOTE: It can only be called after computing the locus. 4589 Calling sequence: locusdg(locus(grobcov(S))); 4590 KEYWORDS: geometrical locus, locus, loci, dynamic geometry 4591 EXAMPLE: locusdg; shows an example" 4592 { 4593 list LL; 4594 int i; 4595 for(i=1;i<=size(L);i++) 4596 { 4597 if(typeof(L[i][3])=="string") 4598 { 4599 if((L[i][3]=="Normal") or (L[i][3]=="Accumulation")){L[i][3]="Relevant"; LL[size(LL)+1]=L[i];} 4600 } 4601 } 4602 return(LL); 4624 4603 } 4625 4604 example 4626 {"EXAMPLE:"; echo = 2; 4605 { 4606 "EXAMPLE:"; echo = 2; 4607 ring R=(0,a,b),(x,y),dp; 4608 short=0; 4609 4610 // Concoid 4611 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4612 // System S96= 4613 S96; 4614 locus(grobcov(S96)); 4615 locusdg(locus(grobcov(S96))); 4616 kill R; 4617 "********************************************"; 4627 4618 ring R=(0,a,b),(x4,x3,x2,x1),dp; 4628 4619 ideal S=(x1-3)^2+(x2-1)^2-9, 4629 (4-x2)*(x3-3)+(x1-3)*(x4-1),4630 (3-x1)*(x3-x1)+(4-x2)*(x4-x2),4631 (4-x4)*a+(x3-3)*b+3*x4-4*x3,4632 (a-x1)^2+(b-x2)^2-(x1-x3)^2-(x2-x4)^2;4620 (4-x2)*(x3-3)+(x1-3)*(x4-1), 4621 (3-x1)*(x3-x1)+(4-x2)*(x4-x2), 4622 (4-x4)*a+(x3-3)*b+3*x4-4*x3, 4623 (a-x1)^2+(b-x2)^2-(x1-x3)^2-(x2-x4)^2; 4633 4624 short=0; 4634 locus(grobcov(S)); " "; 4625 locus(grobcov(S)); 4626 locusdg(locus(grobcov(S))); 4635 4627 kill R; 4636 ring R=(0,a,b),(x,y),dp; 4628 "********************************************"; 4629 4630 ring R=(0,x,y),(x1,x2),dp; 4637 4631 short=0; 4638 "Concoid";4639 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1;4640 "System="; S96; " ";4641 locusdg(grobcov(S96));4642 kill R; ring R=(0,x,y),(x1,x2),dp;4643 4632 ideal S=-(x - 5)*(x1 - 1) - (x2 - 2)*(y - 2), 4644 (x1 - 5)^2 + (x2 - 2)^2 - 4, 4645 -2*(x - 5)*(x2 - 2) + 2*(x1 - 5)*(y - 2); 4646 "System="; S; 4647 locusdg(grobcov(S)); " "; 4648 ideal S1=-(x - x1)*(x1 - 4) + (x2 - y)*(x2 - 4), 4649 (x1 - 4)^2 + (x2 - 2)^2 - 4, 4650 -2*(x1 - 4)*(2*x2 - y - 4) - 2*(x - 2*x1 + 4)*(x2 - 2); 4651 "System="; S1; 4652 locusdg(grobcov(S1)); 4633 (x1 - 5)^2 + (x2 - 2)^2 - 4, 4634 -2*(x - 5)*(x2 - 2) + 2*(x1 - 5)*(y - 2); 4635 locus(grobcov(S)); 4636 locusdg(locus(grobcov(S))); 4653 4637 } 4654 4638 … … 4660 4644 // string s: The output of locus converted to a string readable by other programs 4661 4645 proc locusto(list L) 4662 "USAGE: locusto(L); 4663 The argument must be the output of locus of a parametrical ideal 4646 "USAGE: locusto(L); 4647 The argument must be the output of locus or locusdg or 4648 envelop or envelopdg. 4664 4649 It transforms the output into a string in standard form 4665 4650 readable in many languages (Geogebra). 4666 4651 RETURN: The locus in string standard form 4667 NOTE: It can only be called after computing the locus(grobcov(F)) of the 4668 parametrical ideal. 4669 The basering R, must be of the form Q[a,b,..][x,y,..]. 4652 NOTE: It can only be called after computing either 4653 - locus(grobcov(F)) -> locusto( locus(grobcov(F)) ) 4654 - locusdg(locus(grobcov(F))) -> locusto( locusdg(locus(grobcov(F))) ) 4655 - envelop(F,C) -> locusto( envelop(F,C) ) 4656 -envelopdg(envelop(F,C)) -> locusto( envelopdg(envelop(F,C)) ) 4670 4657 KEYWORDS: geometrical locus, locus, loci. 4671 4658 EXAMPLE: locusto; shows an example" … … 4699 4686 if(size(L[i])>=3) 4700 4687 { 4701 s[size(s)]=","; 4702 s=string(s,string(L[i][3]),"]"); 4688 s=string(s,",["); 4689 if(typeof(L[i][3])=="string") 4690 { 4691 s=string(s,string(L[i][3]),"]]"); 4692 } 4693 else 4694 { 4695 for(k=1;k<=size(L[i][3]);k++) 4696 { 4697 s=string(s,"[",L[i][3][k],"],"); 4698 } 4699 s[size(s)]="]"; 4700 s=string(s,"]"); 4701 } 4703 4702 } 4704 4703 if(size(L[i])>=4) … … 4714 4713 } 4715 4714 example 4716 {"EXAMPLE:"; echo = 2; 4717 ring R=(0,a,b),(x,y),dp; 4715 { 4716 "EXAMPLE:"; echo = 2; 4717 ring R=(0,x,y),(x1,y1),dp; 4718 4718 short=0; 4719 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4720 "System="; S96; " "; 4721 locusto(locus(grobcov(S96))); 4722 } 4723 4724 // Auxiliary routione 4719 ideal S=x1^2+y1^2-4,(y-2)*x1-x*y1+2*x,(x-x1)^2+(y-y1)^2-1; 4720 locusto(locus(grobcov(S))); 4721 locusto(locusdg(locus(grobcov(S)))); 4722 kill R; 4723 "********************************************"; 4724 4725 // 1. Take a fixed line l: x1-y1=0 and consider 4726 // the family F of a lines parallel to l passing through the mover point M 4727 // 2. Consider a circle x1^2+x2^2-25, and a mover point M(x1,x2) on it. 4728 // 3. Compute the envelop of the family of lines. 4729 4730 ring R=(0,x,y),(x1,y1),lp; 4731 poly F=(y-y1)-(x-x1); 4732 ideal C=x1^2+y1^2-25; 4733 short=0; 4734 4735 // Curves Family F= 4736 F; 4737 // Conditions C= 4738 C; 4739 4740 locusto(envelop(F,C)); 4741 locusto(envelopdg(envelop(F,C))); 4742 kill R; 4743 "********************************************"; 4744 4745 // Steiner Deltoid 4746 // 1. Consider the circle x1^2+y1^2-1=0, and a mover point M(x1,y1) on it. 4747 // 2. Consider the triangle A(0,1), B(-1,0), C(1,0). 4748 // 3. Consider lines passing through M perpendicular to two sides of ABC triangle. 4749 // 4. Obtain the envelop of the lines above. 4750 4751 ring R=(0,x,y),(x1,y1,x2,y2),lp; 4752 ideal C=(x1)^2+(y1)^2-1, 4753 x2+y2-1, 4754 x2-y2-x1+y1; 4755 matrix M[3][3]=x,y,1,x2,y2,1,x1,0,1; 4756 poly F=det(M); 4757 4758 short=0; 4759 4760 // Curves Family F= 4761 F; 4762 // Conditions C= 4763 C; 4764 4765 locusto(envelop(F,C)); 4766 locusto(envelopdg(envelop(F,C))); 4767 } 4768 4769 // Auxiliary routine 4725 4770 // locusdim 4726 4771 // input: 4727 4772 // B: ideal, a basis of a segment of the grobcov 4728 // dgdim: int, the dimension of the mover (for locus dg)4773 // dgdim: int, the dimension of the mover (for locus) 4729 4774 // by default dgdim is equal to the number of variables 4730 proc locusdim(ideal B, list #)4775 static proc locusdim(ideal B, list #) 4731 4776 { 4732 4777 def R=basering; … … 4752 4797 } 4753 4798 } 4754 //"T_B0="; B0;4755 //"T_v="; v;4756 4799 def RR=ringlist(R); 4757 4800 def RR0=RR; 4758 4801 RR0[2]=v; 4759 4802 def R0=ring(RR0); 4760 //ringlist(R0);4761 4803 setring(R0); 4762 4804 def B0r=imap(R,B0); … … 4767 4809 } 4768 4810 4769 // locusdgto: Transforms the output of locus to a string that 4770 // can be read by different computational systems. 4771 // input: 4772 // list L: The output of locus 4773 // output: 4774 // string s: The output of locus converted to a string readable by other programs 4775 // Outputs only the relevant dynamical geometry components. 4776 // Without unnecessary parenthesis 4777 proc locusdgto(list LL) 4811 // // locusdgto: Transforms the output of locusdg to a string that 4812 // // can be read by different computational systems. 4813 // // input: 4814 // // list L: The output of locus 4815 // // output: 4816 // // string s: The output of locus converted to a string readable by other programs 4817 // // Outputs only the relevant dynamical geometry components. 4818 // // Without unnecessary parenthesis 4819 // proc locusdgto(list LL) 4820 // "USAGE: locusdgto(L); 4821 // The argument must be the output of locusdg of a parametrical ideal 4822 // It transforms the output into a string in standard form 4823 // readable in many languages (Geogebra). 4824 // RETURN: The locusdg in string standard form 4825 // NOTE: It can only be called after computing the locusdg(grobcov(F)) of the 4826 // parametrical ideal. 4827 // The basering R, must be of the form Q[a,b,..][x,y,..]. 4828 // KEYWORDS: geometrical locus, locus, loci. 4829 // EXAMPLE: locusdgto; shows an example" 4830 // { 4831 // int i; int j; int k; int short0=short; int ojo; 4832 // int te=0; 4833 // short=0; 4834 // if(size(LL)==0){ojo=1; list L;} 4835 // else 4836 // { 4837 // def L=LL; 4838 // } 4839 // string s="["; string sf="]"; string st=s+sf; 4840 // if(size(L)==0){return(st);} 4841 // ideal p; 4842 // ideal q; 4843 // for(i=1;i<=size(L);i++) 4844 // { 4845 // if(L[i][3]=="Relevant") 4846 // { 4847 // s=string(s,"[["); 4848 // for (j=1;j<=size(L[i][1]);j++) 4849 // { 4850 // s=string(s,L[i][1][j],","); 4851 // } 4852 // s[size(s)]="]"; 4853 // s=string(s,",["); 4854 // for(j=1;j<=size(L[i][2]);j++) 4855 // { 4856 // s=string(s,"["); 4857 // for(k=1;k<=size(L[i][2][j]);k++) 4858 // { 4859 // s=string(s,L[i][2][j][k],","); 4860 // } 4861 // s[size(s)]="]"; 4862 // s=string(s,","); 4863 // } 4864 // s[size(s)]="]"; 4865 // s=string(s,"]"); 4866 // s[size(s)]="]"; 4867 // s=string(s,","); 4868 // } 4869 // } 4870 // if(s=="["){s="[]";} 4871 // else{s[size(s)]="]";} 4872 // short=short0; 4873 // return(s); 4874 // } 4875 // example 4876 // {"EXAMPLE:"; echo = 2; 4877 // ring R=(0,a,b),(x,y),dp; 4878 // short=0; 4879 // ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4880 // "System="; S96; " "; 4881 // "locusdgto(locusdg(grobcov(S96)))="; 4882 // locusdgto(locusdg(grobcov(S96))); 4883 // } 4884 4885 static proc norspec(ideal F) 4778 4886 { 4779 4887 def RR=basering; 4780 int i; int j; int k; int short0=short; int ojo; 4781 int te=0; 4782 if(defined(@P)){te=1;} 4783 else{setglobalrings();} 4784 setring @P; 4888 def Rx=ringlist(RR); 4889 4890 def Rx=ringlist(RR); 4891 def @P=ring(Rx[1]); 4892 list Lx; 4893 Lx[1]=0; 4894 Lx[2]=Rx[2]+Rx[1][2]; 4895 Lx[3]=Rx[1][3]; 4896 Lx[4]=Rx[1][4]; 4897 Rx[1]=0; 4898 def D=ring(Rx); 4899 def @RP=D+@P; 4900 exportto(Top,@R); // global ring Q[a][x] 4901 exportto(Top,@P); // global ring Q[a] 4902 exportto(Top,@RP); // global ring K[x,a] with product order 4903 setring(RR); 4904 4905 } 4906 4907 // envelop 4908 // Input: n arguments 4909 // poly F: the polynomial defining the family of curves in ring R=0,(x,y),(x1,..,xn),lp; 4910 // ideal C=g1,..,g_{n-1}: the set of constraints 4911 // Output: the components of the envolvent; 4912 proc envelop(poly F, ideal C, list #) 4913 "USAGE: envelop(F,C); 4914 The first argument F must be the family of curves of which 4915 on want to compute the envelop. 4916 The second argument C must be the ideal of conditions 4917 over the variables, and should contain as polynomials 4918 as the number of variables -1. 4919 RETURN: The components of the envelop with its taxonomy: 4920 The taxonomy distinguishes 'Normal', 4921 'Special', 'Accumulation', 'Degenerate' components. 4922 In the case of 'Special' components, it also 4923 outputs the antiimage of the component 4924 and an integer (0-1). If the integer is 0 4925 the component is not a curve of the family and is 4926 not considered as 'Relevant' by the envelopdg routine 4927 applied to it, but is considered as 'Relevant' if the integer is 1. 4928 NOTE: grobcov is called internally. 4929 The basering R, must be of the form Q[a][x] (a=parameters, x=variables). 4930 KEYWORDS: geometrical locus, locus, loci, envelop 4931 EXAMPLE: envelop; shows an example" 4932 { 4933 int tes=0; int i; int j; 4934 def R=basering; 4935 if(defined(@P)==1){tes=1; kill @P; kill @R; kill @RP;} 4936 setglobalrings(); 4937 // Options 4938 list DD=#; 4939 int moverdim=nvars(R); 4940 int version=0; 4941 int nv=nvars(R); 4942 if(nv<4){version=1;} 4943 int comment=0; 4944 ideal Fm; 4945 for(i=1;i<=(size(DD) div 2);i++) 4946 { 4947 if(DD[2*i-1]=="movdim"){moverdim=DD[2*i];} 4948 if(DD[2*i-1]=="version"){version=DD[2*i];} 4949 if(DD[2*i-1]=="system"){Fm=DD[2*i];} 4950 if(DD[2*i-1]=="comment"){comment=DD[2*i];} 4951 } 4952 int n=nvars(R); 4953 list v; 4954 for(i=1;i<=n;i++){v[size(v)+1]=var(i);} 4955 def MF=jacob(F); 4956 def TMF=transpose(MF); 4957 def Mg=MF; 4958 def TMg=TMF; 4959 for(i=1;i<=n-1;i++) 4960 { 4961 Mg=jacob(C[i]); 4962 TMg=transpose(Mg); 4963 TMF=concat(TMF,TMg); 4964 } 4965 poly J=det(TMF); 4966 ideal S=ideal(F)+C+ideal(J); 4967 DD[size(DD)+1]="family"; 4968 DD[size(DD)+1]=F; 4969 def G=grobcov(S,DD); 4970 def L=locus(G, DD); 4971 return(L); 4972 } 4973 example 4974 { 4975 "EXAMPLE:"; echo = 2; 4976 // Steiner Deltoid 4977 // 1. Consider the circle x1^2+y1^2-1=0, and a mover point M(x1,y1) on it. 4978 // 2. Consider the triangle A(0,1), B(-1,0), C(1,0). 4979 // 3. Consider lines passing through M perpendicular to two sides of ABC triangle. 4980 // 4. Obtain the envelop of the lines above. 4981 4982 ring R=(0,x,y),(x1,y1,x2,y2),lp; 4983 ideal C=(x1)^2+(y1)^2-1, 4984 x2+y2-1, 4985 x2-y2-x1+y1; 4986 matrix M[3][3]=x,y,1,x2,y2,1,x1,0,1; 4987 poly F=det(M); 4988 4785 4989 short=0; 4786 if(size(LL)==0){ojo=1; list L;} 4787 else 4788 { 4789 def L=imap(RR,LL); 4790 } 4791 string s="["; string sf="]"; string st=s+sf; 4792 if(size(L)==0){return(st);} 4793 ideal p; 4794 ideal q; 4990 4991 // Curves Family F= 4992 F; 4993 // Conditions C= 4994 C; 4995 4996 def Env=envelop(F,C); 4997 Env; 4998 } 4999 5000 // envelopdg 5001 // Input: list L: the output of envelop(poly F, ideal C, list #) 5002 // Output: the relevant components of the envolvent in dynamic geometry; 5003 proc envelopdg(list L) 5004 "USAGE: envelopdg(L); 5005 The input list L must be the output of the call to 5006 the routine 'envolop' of the family of curves 5007 RETURN: The relevant components of the envelop in Dynamic Geometry. 5008 'Normal' and 'Accumulation' components are always considered 5009 'Relevant'. 'Special' components of the envelop outputs 5010 three objects in its characterization: 'Special', the antiimage ideal, 5011 and the integer 0 or 1, that indicates that the given component is 5012 formed (1) or is not formed (0) by curves of the family. Only if yes, 5013 'envelopdg' considers the component as 'Relevant' . 5014 NOTE: It must be called to the output of the 'envelop' routine. 5015 The basering R, must be of the form Q[a,b,..][x,y,..]. 5016 KEYWORDS: geometrical locus, locus, loci, envelop. 5017 EXAMPLE: envelop; shows an example" 5018 { 5019 list LL; 5020 list Li; 5021 int i; 4795 5022 for(i=1;i<=size(L);i++) 4796 5023 { 4797 if(L[i][3]=="Relevant") 4798 { 4799 s=string(s,"[["); 4800 for (j=1;j<=size(L[i][1]);j++) 4801 { 4802 s=string(s,L[i][1][j],","); 4803 } 4804 s[size(s)]="]"; 4805 s=string(s,",["); 4806 for(j=1;j<=size(L[i][2]);j++) 4807 { 4808 s=string(s,"["); 4809 for(k=1;k<=size(L[i][2][j]);k++) 5024 if(typeof(L[i][3])=="string") 5025 { 5026 if((L[i][3]=="Normal") or (L[i][3]=="Accumulation")){Li=L[i]; Li[3]="Relevant"; LL[size(LL)+1]=Li;} 5027 } 5028 else 5029 { 5030 if(typeof(L[i][3])=="list") 5031 { 5032 if(L[i][3][3]==1) 4810 5033 { 4811 s=string(s,L[i][2][j][k],",");5034 Li=L[i]; Li[3]="Relevant"; LL[size(LL)+1]=Li; 4812 5035 } 4813 s[size(s)]="]"; 4814 s=string(s,","); 4815 } 4816 s[size(s)]="]"; 4817 s=string(s,"]"); 4818 s[size(s)]="]"; 4819 s=string(s,","); 4820 } 4821 } 4822 if(s=="["){s="[]";} 4823 else{s[size(s)]="]";} 4824 setring(RR); 4825 short=short0; 4826 if(te==0){kill @P; kill @R; kill @RP;} 4827 return(s); 5036 } 5037 } 5038 } 5039 return(LL); 5040 } 5041 example 5042 { 5043 "EXAMPLE:"; echo = 2; 5044 5045 // 1. Take a fixed line l: x1-y1=0 and consider 5046 // the family F of a lines parallel to l passing through the mover point M 5047 // 2. Consider a circle x1^2+x2^2-25, and a mover point M(x1,x2) on it. 5048 // 3. Compute the envelop of the family of lines. 5049 5050 ring R=(0,x,y),(x1,y1),lp; 5051 short=0; 5052 poly F=(y-y1)-(x-x1); 5053 ideal C=x1^2+y1^2-25; 5054 short=0; 5055 5056 // Curves Family F= 5057 F; 5058 // Conditions C= 5059 C; 5060 5061 envelop(F,C); 5062 envelopdg(envelop(F,C)); 4828 5063 } 4829 5064 4830 5065 //********************* End locus **************************** 5066 5067 //********************* Begin AddCons ********************** 5068 5069 // Input: L1,L2: lists of components with common top 5070 // Output L: list of the union of L1 and L2. 5071 static proc Add2ComWithCommonTop(list L1, list L2) 5072 { 5073 int i; int j; ideal pij; list L; list Lp; list PR; int k; 5074 for(i=1;i<=size(L1[2]);i++) 5075 { 5076 for(j=1;j<=size(L2[2]);j++) 5077 { 5078 pij=std(L1[2][i]+L2[2][j]); 5079 PR=minGTZ(pij); 5080 for(k=1;k<=size(PR);k++) 5081 { 5082 Lp[size(Lp)+1]=PR[k]; 5083 } 5084 } 5085 } 5086 for(i=1; i<=size(Lp);i++) 5087 { 5088 for(j=i+1;j<=size(Lp);j++) 5089 { 5090 if(idcontains(Lp[i],Lp[j])) {Lp=delete(Lp,j);} 5091 } 5092 for(j=1;j<i;j++) 5093 { 5094 if(idcontains(Lp[i],Lp[j])){Lp=delete(Lp,j); j=j-1; i=i-1;} 5095 } 5096 } 5097 L[1]=L1[1]; 5098 L[2]=Lp; 5099 return(L); 5100 } 5101 5102 // Input: L list od P-rep of components to be added. L[i]=[p_i,[p_{i1},...p_{ir_i}]] 5103 // Output: lists A,B,L 5104 // where no top in the lists are repeated 5105 // A: list of components with higher tops 5106 // B: list of components with lower tops 5107 // L1: A,B 5108 static proc SepareAB(list L) 5109 { 5110 int i; int j; list Ln=L; 5111 for(i=1;i<=size(Ln);i++) 5112 { 5113 for(j=i+1;j<=size(Ln);j++) 5114 { 5115 if (equalideals(Ln[j][1],Ln[i][1])) 5116 { 5117 Ln[i]=Add2ComWithCommonTop(Ln[i],Ln[j]); 5118 Ln=delete(Ln,j); 5119 j=j-1; 5120 } 5121 } 5122 } 5123 list A; list B; int clas; list T; list L1; 5124 for(i=1;i<=size(Ln);i++) 5125 { 5126 j=1; 5127 clas=0; 5128 while((clas==0) and (j<=size(Ln))) 5129 { 5130 if(j!=i) 5131 { 5132 if(idcontains(Ln[i][1],Ln[j][1]) ) {B[size(B)+1]=Ln[i]; clas=1;} 5133 } 5134 j++; 5135 } 5136 if(clas==0) {A[size(A)+1]=Ln[i];} 5137 } 5138 L1=A; for(j=1;j<=size(B);j++){L1[size(L1)+1]=B[j];} 5139 T[1]=A; T[2]=B; T[3]=L1; 5140 return(T); 5141 } 5142 5143 // Input: 5144 // A1: list of high set of P-reps to be completed by the remaining P-reps 5145 // L1: the list A1, completed with the list of lower P-reps. 5146 // Output: 5147 // A: list A1 completed with all possible parts of the remaining parts of L1 with the 5148 // condition of building locally closed sets. 5149 static proc CompleteA(list A1,list L1) 5150 { 5151 int modif; int i; int j; int k; int l; 5152 ideal pij; ideal pk; ideal pijkl; ideal pkl; 5153 int n; list nl; int te; int clas; list vvv; list AAA; 5154 list Lp; int m; ideal Pij; 5155 list A0; 5156 modif=1; 5157 list A=A1; 5158 while(modif==1) 5159 { 5160 modif=0; 5161 A0=A; 5162 for(i=1;i<=size(A);i++) 5163 { 5164 for(j=1;j<=size(A[i][2]); j++) 5165 { 5166 pij=A[i][2][j]; 5167 for(k=1;k<=size(L1);k++) 5168 { 5169 if(k!=i) 5170 { 5171 pk=L1[k][1]; 5172 if(idcontains(pij,pk)==1) 5173 { 5174 te=0; 5175 kill nl; 5176 list nl; l=1; 5177 while((te==0) and (l<=size(L1[k][2]))) 5178 { 5179 pkl=L1[k][2][l]; 5180 if((equalideals(pij,pkl)==1) or (idcontains(pij,pkl)==1)) {te=1;} 5181 l++; 5182 } // end while ((te=0) and (l>... 5183 //"T_te="; te; pause(); 5184 if(te==0) 5185 { 5186 modif=1; 5187 kill Pij; ideal Pij=1; 5188 for(l=1; l<=size(L1[k][2]);l++) 5189 { 5190 pkl=L1[k][2][l]; 5191 pijkl=std(pij+pkl); 5192 Pij=intersect(Pij,pijkl); 5193 } 5194 kill Lp; list Lp; 5195 Lp=minGTZ(Pij); 5196 for(m=1;m<=size(Lp);m++) 5197 { 5198 nl[size(nl)+1]=Lp[m]; 5199 } 5200 A[i][2]=delete(A[i][2], j); 5201 for(n=1;n<=size(nl);n++) 5202 { 5203 A[i][2][size(A[i][2])+1]=nl[n]; 5204 } 5205 } // end if(te==0) 5206 } // end if(idcontains(pij,pk)==1) 5207 } // end if (k!=i) 5208 } // end for k 5209 } // end for j 5210 kill vvv; list vvv; 5211 if(modif==1) 5212 // Select the maximal ideals of the set A[I][2][j] 5213 { 5214 kill nl; list nl; 5215 nl=selectminideals(A[i][2]); 5216 kill AAA; list AAA; 5217 for(j=1;j<=size(nl);j++) 5218 { 5219 AAA[size(AAA)+1]=A[i][2][nl[j]]; 5220 } 5221 A[i][2]=AAA; 5222 } // end if(modif=1) 5223 } // end for i 5224 modif=1-equallistsAall(A,A0); 5225 } // end while(modif==1) 5226 return(A); 5227 } 5228 5229 // Input: 5230 // A: list of the top P-reps of one level 5231 // B: list of remaining lower P-reps that have not yeen be possible to add 5232 // Output: 5233 // Bn: list B where the elements that are completely included in A are removed and the parts that are 5234 // included in A also. 5235 static proc ReduceB(list A,list B) 5236 { 5237 int i; int j; list nl; list Bn; int te; int k; int elim; 5238 ideal pC; ideal pD; ideal pCD; ideal pBC; list nB; int j0; 5239 for(i=1;i<=size(B);i++) 5240 { 5241 j=1; te=0; 5242 while((te==0) and (j<=size(A))) 5243 { 5244 if(idcontains(B[i][1],A[j][1])){te=1; j0=j;} 5245 else{j++;} 5246 } 5247 pD=B[i][2][1]; 5248 for(k=2;k<=size(B[i][2]);k++){pD=intersect(pD,B[i][2][k]);} 5249 pC=A[j0][2][1]; 5250 for(k=2;k<=size(A[j0][2]);k++) {pC=intersect(pC,A[j0][2][k]);} 5251 pCD=std(pD+pC); 5252 pBC=std(B[i][1]+pC); 5253 elim=0; 5254 if(idcontains(pBC,pCD)){elim=1;} // B=delfromlist(B,i);i=i-1; 5255 else 5256 { 5257 nB=Prep(pBC,pCD); 5258 if(equalideals(nB[1][1],ideal(1))==0) 5259 { 5260 for(k=1;k<=size(nB);k++){Bn[size(Bn)+1]=nB[k];} 5261 } 5262 } 5263 } // end for i 5264 return(Bn); 5265 } 5266 5267 // AddConsP: given a set of components of locally closed sets in P-representation, it builds the 5268 // canonical P-representation of the corresponding constructible set, of its union, 5269 // including levels it they are. 5270 proc AddConsP(list L) 5271 "USAGE: AddConsP(L) 5272 Input L: list of components in P-rep to be added 5273 [ [[p_1,[p_11,..,p_1,r1]],..[p_k,[p_k1,..,p_kr_k]] ] 5274 RETURN: 5275 list of lists of levels of the different locally closed sets of 5276 the canonical P-rep of the constructible. 5277 [ [level_1,[ [Comp_11,..Comp_1r_1] ] ], .. , 5278 [level_s,[ [Comp_s1,..Comp_sr_1] ] 5279 ] 5280 where level_i=i, Comp_ij=[ p_i,[p_i1,..,p_it_i] ] is a prime component. 5281 NOTE: Operates in a ring R=Q[u_1,..,u_m] 5282 KEYWORDS: Constructible set, Canoncial form 5283 EXAMPLE: AddConsP; shows an example" 5284 { 5285 list LL; list A; list B; list L1; list T; int level=0; list h; 5286 LL=L; int i; 5287 while(size(LL)!=0) 5288 { 5289 level++; 5290 L1=SepareAB(LL); 5291 A=L1[1]; B=L1[2]; LL=L1[3]; 5292 A=CompleteA(A,LL); 5293 for(i=1;i<=size(A);i++) 5294 { 5295 LL[i]=A[i]; 5296 } 5297 h[1]=level; h[2]=A; 5298 T[size(T)+1]=h; 5299 LL=ReduceB(A,B); 5300 } 5301 return(T); 5302 } 5303 example 5304 { 5305 "EXAMPLE:"; echo = 2; 5306 if (defined(Grobcov::@P)){kill Grobcov::@P; kill Grobcov::@R; kill Grobcov::@RP;} 5307 ring R=0,(x,y,z),lp; 5308 short=0; 5309 5310 ideal P1=x; 5311 ideal Q1=x,y; 5312 ideal P2=y; 5313 ideal Q2=y,z; 5314 5315 list L=list(Prep(P1,Q1)[1],Prep(P2,Q2)[1]); 5316 L; 5317 AddConsP(L); 5318 } 5319 5320 // AddCons: given a set of locally closed sets by pairs of ideal, it builds the 5321 // canonical P-representation of the corresponding constructible set, of its union, 5322 // including levels it they are. 5323 // It makes a call to AddConsP after transforming the input. 5324 // Input list of lists of pairs of ideals representing locally colsed sets: 5325 // L= [ [E1,N1], .. , [E_s,N_s] ] 5326 // Output: The canonical frepresentation of the constructible set union of the V(E_i) \ V(N_i) 5327 // T=[ [level_1,[ [p_1,[p_11,..,p_1s_1]],.., [p_k,[p_k1,..,p_ks_k]] ]],, .. , [level_r,[.. ]] ] 5328 proc AddCons(list L) 5329 "USAGE: AddCons(L) 5330 Calls internally AddConsP and allows a different input. 5331 Input L: list of pairs of of ideals [ [P_1,Q_1], .., [Pr,Qr] ] 5332 representing a set of locally closed setsV(P_i) \ V(Q_i) 5333 to be added. 5334 RETURN: 5335 list of lists of levels of the different locally closed sets of 5336 the canonical P-rep of the constructible. 5337 [ [level_1,[ [Comp_11,..Comp_1r_1] ] ], .. , 5338 [level_s,[ [Comp_s1,..Comp_sr_1] ] 5339 ] 5340 where level_i=i, Comp_ij=[ p_i,[p_i1,..,p_it_i] ] is a prime component. 5341 NOTE: Operates in a ring R=Q[u_1,..,u_m] 5342 KEYWORDS: Constructible set, Canoncial form 5343 EXAMPLE: AddCons; shows an example" 5344 { 5345 int i; list H; list P; int j; 5346 for(i=1;i<=size(L);i++) 5347 { 5348 P=Prep(L[i][1],L[i][2]); 5349 for(j=1;j<=size(P);j++) 5350 { 5351 H[size(H)+1]=P[j]; 5352 } 5353 } 5354 return(AddConsP(H)); 5355 } 5356 example 5357 { 5358 "EXAMPLE:"; echo = 2; 5359 if (defined(Grobcov::@P)){kill Grobcov::@P; kill Grobcov::@R; kill Grobcov::@RP;} 5360 ring R=0,(x,y,z),lp; 5361 short=0; 5362 5363 ideal P1=x; 5364 ideal Q1=x,y; 5365 ideal P2=y; 5366 ideal Q2=y,z; 5367 5368 list L=list(list(P1,Q1), list(P2,Q2) ); 5369 L; 5370 5371 AddCons(L); 5372 } 5373 5374 // AddLocus: auxilliary routine for locus0 that computes the components of the constructible: 5375 // Input: the list of locally closed sets to be added, each with its type as third argument 5376 // L=[ [LC[11],,,LC[1k_1], .., [LC[r1],,,LC[rk_r] ] where 5377 // LC[1]=[p1,[p11,..,p1k],typ] 5378 // Output: the list of components of the constructible union of the L, with the type of the corresponding top 5379 // and the level of the constructible 5380 // L4= [[v1,p1,[p11,..,p1l],typ_1,level]_1 ,.. [vs,ps,[ps1,..,psl],typ_s,level_s] 5381 static proc AddLocus(list L) 5382 { 5383 // int te0=0; 5384 // def RR=basering; 5385 // if(defined(@P)){te0=1; def Rx=@R; kill @P; setring RR;} 5386 list L1; int i; int j; list L2; list L3; 5387 list l1; list l2; 5388 intvec v; 5389 for(i=1; i<=size(L); i++) 5390 { 5391 for(j=1;j<=size(L[i]);j++) 5392 { 5393 l1[1]=L[i][j][1]; 5394 l1[2]=L[i][j][2]; 5395 l2[1]=l1[1]; 5396 if(size(L[i][j])>2){l2[3]=L[i][j][3];} 5397 v[1]=i; v[2]=j; 5398 l2[2]=v; 5399 L1[size(L1)+1]=l1; 5400 L2[size(L2)+1]=l2; 5401 } 5402 } 5403 L3=AddConsP(L1); 5404 list L4; int level; 5405 ideal p1; ideal pp1; int t; int k; int k0; string typ; list l4; 5406 for(i=1;i<=size(L3);i++) 5407 { 5408 level=L3[i][1]; 5409 for(j=1;j<=size(L3[i][2]);j++) 5410 { 5411 p1=L3[i][2][j][1]; 5412 t=1; k=1; 5413 while((t==1) and (k<=size(L2))) 5414 { 5415 pp1=L2[k][1]; 5416 if(equalideals(p1,pp1)){t=0; k0=k;} 5417 k++; 5418 } 5419 if(t==0) 5420 { 5421 v=L2[k0][2]; 5422 } 5423 else{"ERROR p1 NOT FOUND";} 5424 l4[1]=v; l4[2]=p1; l4[3]=L3[i][2][j][2]; l4[5]=level; 5425 if(size(L2[k0])>2){l4[4]=L2[k0][3];} 5426 L4[size(L4)+1]=l4; 5427 } 5428 } 5429 return(L4); 5430 } 5431 5432 //********************* End AddCons ********************** 4831 5433 ; -
Singular/LIB/grwalk.lib
r48d66a r7023ce 255 255 } 256 256 257 proc gwalk(ideal Go, list #)258 "SYNTAX: gwalk(ideal i );259 gwalk(ideal i, int vec v, intvec w);257 proc gwalk(ideal Go, int reduction,int printout, list #) 258 "SYNTAX: gwalk(ideal i, int reduction, int printout); 259 gwalk(ideal i, int reduction, int printout, intvec v, intvec w); 260 260 TYPE: ideal 261 261 PURPOSE: compute the standard basis of the ideal, calculated via … … 284 284 //print("//** help ring = " + string(basering)); 285 285 ideal G = fetch(xR, Go); 286 G = system("Mwalk", G, curr_weight, target_weight,basering );286 G = system("Mwalk", G, curr_weight, target_weight,basering,reduction,printout); 287 287 288 288 setring xR; … … 300 300 ring r = 32003,(z,y,x), lp; 301 301 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 302 gwalk(I );302 gwalk(I,0,1); 303 303 } 304 304 … … 346 346 } 347 347 348 proc fwalk(ideal Go, list #)349 "SYNTAX: fwalk(ideal i );350 fwalk(ideal i, int vec v, intvec w);348 proc fwalk(ideal Go, int reduction, int printout, list #) 349 "SYNTAX: fwalk(ideal i,int reductioin); 350 fwalk(ideal i, int reduction intvec v, intvec w); 351 351 TYPE: ideal 352 352 PURPOSE: compute the standard basis of the ideal w.r.t. the … … 372 372 373 373 ideal G = fetch(xR, Go); 374 G = system("Mfwalk", G, curr_weight, target_weight );374 G = system("Mfwalk", G, curr_weight, target_weight, reduction, printout); 375 375 376 376 setring xR; … … 387 387 ring r = 32003,(z,y,x), lp; 388 388 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 389 fwalk(I); 389 int reduction = 1; 390 int printout = 1; 391 fwalk(I,reduction,printout); 390 392 } 391 393 … … 437 439 } 438 440 439 proc pwalk(ideal Go, int n1, int n2, list #)440 "SYNTAX: pwalk(int d, ideal i, int n1, int n2 );441 pwalk(int d, ideal i, int n1, int n2, int vec v, intvec w);441 proc pwalk(ideal Go, int n1, int n2, int reduction, int printout, list #) 442 "SYNTAX: pwalk(int d, ideal i, int n1, int n2, int reduction, int printout); 443 pwalk(int d, ideal i, int n1, int n2, int reduction, int printout, intvec v, intvec w); 442 444 TYPE: ideal 443 445 PURPOSE: compute the standard basis of the ideal, calculated via … … 477 479 ideal G = fetch(xR, Go); 478 480 481 <<<<<<< HEAD 482 G = system("Mpwalk",G,n1,n2,curr_weight,target_weight,nP,reduction,printout); 483 484 ======= 479 485 G = system("Mpwalk", G, n1, n2, curr_weight, target_weight,nP); 480 486 487 >>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596 481 488 setring xR; 482 489 //kill Go; … … 492 499 ring r = 32003,(z,y,x), lp; 493 500 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 494 //I = std(I); 495 //ring rr = 32003,(z,y,x),lp; 496 //ideal I = fetch(r,I); 497 pwalk(I,2,2); 501 int reduction = 1; 502 int printout = 2; 503 pwalk(I,2,2,reduction,printout); 498 504 } 499 505 -
Singular/LIB/homolog.lib
rca3864 r7023ce 534 534 { // compute resolution via sres command 535 535 if( attrib(M,"isSB")==0 ) { 536 if (size(M)==0) { attrib(M,"isSB")=1; } 537 else { M=std(M); } 536 M=std(M); 538 537 } 539 538 list resl = sres(M,max+1); -
Singular/LIB/modwalk.lib
-
Property
mode
changed from
100644
to100755
r48d66a r7023ce 16 16 17 17 PROCEDURES: 18 modpWalk(ideal,int,int,int[,int,int,int,int]) standard basis conversion of I in prime characteristic 18 19 modWalk(ideal,int,int[,int,int,int,int]); standard basis conversion of I using modular methods (chinese remainder) 19 20 "; … … 29 30 //////////////////////////////////////////////////////////////////////////////// 30 31 31 static proc modpWalk(def II, int p, int variant, list #)32 proc modpWalk(def II, int p, int variant, int reduction, list #) 32 33 "USAGE: modpWalk(I,p,#); I ideal, p integer, variant integer 33 34 ASSUME: If size(#) > 0, then … … 80 81 } 81 82 } 83 <<<<<<< HEAD 84 ======= 82 85 83 86 //------------------------- make i homogeneous ----------------------------- … … 106 109 } 107 110 111 >>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596 108 112 //------------------------- compute a standard basis mod p ----------------------------- 109 110 113 if(variant == 1) 111 114 { 112 115 if(size(#)>0) 113 116 { 114 i = rwalk(i,radius,pert_deg,#); 115 // rwalk(i,radius,pert_deg,#); std(i); 117 i = rwalk(i,radius,pert_deg,reduction,#); 116 118 } 117 119 else 118 120 { 119 i = rwalk(i,radius,pert_deg );121 i = rwalk(i,radius,pert_deg,reduction); 120 122 } 121 123 } … … 124 126 if(size(#) == 2) 125 127 { 126 i = gwalk(i, #);128 i = gwalk(i,reduction,#); 127 129 } 128 130 else 129 131 { 130 i = gwalk(i );132 i = gwalk(i,reduction); 131 133 } 132 134 } … … 135 137 if(size(#) == 2) 136 138 { 137 i = frandwalk(i,radius, #);139 i = frandwalk(i,radius,reduction,#); 138 140 } 139 141 else 140 142 { 141 i = frandwalk(i,radius );143 i = frandwalk(i,radius,reduction); 142 144 } 143 145 } … … 157 159 if(size(#) == 2) 158 160 { 159 i=prwalk(i,radius,pert_deg,pert_deg, #);161 i=prwalk(i,radius,pert_deg,pert_deg,reduction,#); 160 162 } 161 163 else 162 164 { 163 i=prwalk(i,radius,pert_deg,pert_deg );165 i=prwalk(i,radius,pert_deg,pert_deg,reduction); 164 166 } 165 167 } … … 168 170 if(size(#) == 2) 169 171 { 170 i=pwalk(i,pert_deg,pert_deg, #);172 i=pwalk(i,pert_deg,pert_deg,reduction,#); 171 173 } 172 174 else 173 175 { 176 <<<<<<< HEAD 177 i=pwalk(i,pert_deg,pert_deg,reduction); 178 ======= 174 179 i=pwalk(i,pert_deg,pert_deg); 175 180 } … … 189 194 kill HomR; 190 195 } 191 } 192 } 196 >>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596 197 } 198 } 199 193 200 setring R0; 194 201 return(list(fetch(@r,i),p)); … … 204 211 ring ra = 0,x(1..4),(a(a),lp); 205 212 ideal I = std(cyclic(4)); 213 int reduction = 1; 206 214 ring rb = 0,x(1..4),(a(b),lp); 207 215 ideal I = imap(ra,I); 208 modpWalk(I,p,1, a,b);216 modpWalk(I,p,1,reduction,a,b); 209 217 std(I); 210 218 } … … 212 220 //////////////////////////////////////////////////////////////////////////////// 213 221 214 proc modWalk(def II, int variant, list #)222 proc modWalk(def II, int variant, int reduction, list #) 215 223 "USAGE: modWalk(II); II ideal or list(ideal,int) 216 224 ASSUME: If variant = … … 487 495 if(n2 > 4) 488 496 { 489 //L[5] = prime(random(an,en));497 L[5] = prime(random(an,en)); 490 498 } 491 499 if(printlevel >= 10) … … 504 512 for(i=1; i<=size(L); i++) 505 513 { 506 Arguments[i] = list(II,L[i],variant, list(curr_weight,target_weight));514 Arguments[i] = list(II,L[i],variant,reduction,list(curr_weight,target_weight)); 507 515 } 508 516 } … … 511 519 for(i=1; i<=size(L); i++) 512 520 { 513 Arguments[i] = list(II,L[i],variant );521 Arguments[i] = list(II,L[i],variant,reduction); 514 522 } 515 523 } … … 528 536 //------------------- Now all leading ideals are the same -------------------- 529 537 //------------------- Lift results to basering via farey --------------------- 530 531 538 tt = timer; rt = rtimer; 532 539 N = T2[1]; … … 545 552 546 553 //---------------- Test if we already have a standard basis of I -------------- 547 548 554 tt = timer; rt = rtimer; 549 pTest = pTestSB(I,J,L,variant); 550 //pTest = primeTestSB(I,J,L,variant); 555 pTest = primeTest(J, prime(random(1000000000,2134567879))); 551 556 if(printlevel >= 10) 552 557 { … … 596 601 } 597 602 //-------------- We do not already have a standard basis of I, therefore do the main computation for more primes -------------- 598 599 603 T1 = H; 600 604 T2 = N; … … 613 617 for(i=j; i<=size(L); i++) 614 618 { 615 //Arguments[i-j+1] = list(II,L[i],variant,list(curr_weight,target_weight)); 616 Arguments[size(Arguments)+1] = list(II,L[i],variant,list(curr_weight,target_weight)); 619 Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction,list(curr_weight,target_weight)); 617 620 } 618 621 } … … 621 624 for(i=j; i<=size(L); i++) 622 625 { 623 //Arguments[i-j+1] = list(II,L[i],variant); 624 Arguments[size(Arguments)+1] = list(II,L[i],variant); 626 Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction); 625 627 } 626 628 } … … 632 634 for(i=1; i<=size(PP); i++) 633 635 { 634 //P[size(P) + 1] = PP[i];635 636 T1[size(T1) + 1] = PP[i][1]; 636 637 T2[size(T2) + 1] = bigint(PP[i][2]); … … 649 650 echo = 2; 650 651 ring R=0,(x,y,z),lp; 651 ideal I= -x+y2z-z,xz+1,x2+y2-1;652 // I is a standard basis in dp653 ideal J = modWalk(I,1 );652 ideal I= y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 653 int reduction = 0; 654 ideal J = modWalk(I,1,1); 654 655 J; 655 656 } … … 772 773 return(J); 773 774 } 774 ////////////////////////////////////////////////////////////////////////////////// 775 static proc primeTestSB(def II, ideal J, list L, int variant, list #) 776 "USAGE: primeTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int 777 RETURN: 1 (resp. 0) if for a randomly chosen prime p that is not in L 778 J mod p is (resp. is not) a standard basis of I mod p 779 EXAMPLE: example primeTestSB; shows an example 780 " 781 { 782 if(typeof(II) == "ideal") 783 { 784 ideal I = II; 785 int radius = 2; 786 } 787 if(typeof(II) == "list") 788 { 789 ideal I = II[1]; 790 int radius = II[2]; 791 } 792 793 int i,j,k,p; 794 def R = basering; 795 list r = ringlist(R); 796 797 while(!j) 798 { 799 j = 1; 800 p = prime(random(1000000000,2134567879)); 801 for(i = 1; i <= size(L); i++) 802 { 803 if(p == L[i]) 804 { 805 j = 0; 806 break; 807 } 808 } 809 if(j) 810 { 811 for(i = 1; i <= ncols(I); i++) 812 { 813 for(k = 2; k <= size(I[i]); k++) 814 { 815 if((denominator(leadcoef(I[i][k])) mod p) == 0) 816 { 817 j = 0; 818 break; 819 } 820 } 821 if(!j) 822 { 823 break; 824 } 825 } 826 } 827 if(j) 828 { 829 if(!primeTest(I,p)) 830 { 831 j = 0; 832 } 833 } 834 } 835 r[1] = p; 836 def @R = ring(r); 837 setring @R; 838 ideal I = imap(R,I); 839 ideal J = imap(R,J); 840 attrib(J,"isSB",1); 841 842 int t = timer; 843 j = 1; 844 if(isIncluded(I,J) == 0) 845 { 846 j = 0; 847 } 848 if(printlevel >= 11) 849 { 850 "isIncluded(I,J) takes "+string(timer - t)+" seconds"; 851 "j = "+string(j); 852 } 853 t = timer; 854 if(j) 855 { 856 if(size(#) > 0) 857 { 858 ideal K = modpWalk(I,p,variant,#)[1]; 859 } 860 else 861 { 862 ideal K = modpWalk(I,p,variant)[1]; 863 } 864 t = timer; 865 if(isIncluded(J,K) == 0) 866 { 867 j = 0; 868 } 869 if(printlevel >= 11) 870 { 871 "isIncluded(K,J) takes "+string(timer - t)+" seconds"; 872 "j = "+string(j); 873 } 874 } 875 setring R; 876 877 return(j); 878 } 879 example 880 { "EXAMPLE:"; echo = 2; 881 intvec L = 2,3,5; 882 ring r = 0,(x,y,z),lp; 883 ideal I = x+1,x+y+1; 884 ideal J = x+1,y; 885 primeTestSB(I,I,L,1); 886 primeTestSB(I,J,L,1); 887 } 888 889 //////////////////////////////////////////////////////////////////////////////// 890 static proc pTestSB(ideal I, ideal J, list L, int variant, list #) 891 "USAGE: pTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int 892 RETURN: 1 (resp. 0) if for a randomly chosen prime p that is not in L 893 J mod p is (resp. is not) a standard basis of I mod p 894 EXAMPLE: example pTestSB; shows an example 895 " 896 { 897 int i,j,k,p; 898 def R = basering; 899 list r = ringlist(R); 900 901 while(!j) 902 { 903 j = 1; 904 p = prime(random(1000000000,2134567879)); 905 for(i = 1; i <= size(L); i++) 906 { 907 if(p == L[i]) { j = 0; break; } 908 } 909 if(j) 910 { 911 for(i = 1; i <= ncols(I); i++) 912 { 913 for(k = 2; k <= size(I[i]); k++) 914 { 915 if((denominator(leadcoef(I[i][k])) mod p) == 0) { j = 0; break; } 916 } 917 if(!j){ break; } 918 } 919 } 920 if(j) 921 { 922 if(!primeTest(I,p)) { j = 0; } 923 } 924 } 925 r[1] = p; 926 def @R = ring(r); 927 setring @R; 928 ideal I = imap(R,I); 929 ideal J = imap(R,J); 930 attrib(J,"isSB",1); 931 932 int t = timer; 933 j = 1; 934 if(isIncluded(I,J) == 0) { j = 0; } 935 936 if(printlevel >= 11) 937 { 938 "isIncluded(I,J) takes "+string(timer - t)+" seconds"; 939 "j = "+string(j); 940 } 941 942 t = timer; 943 if(j) 944 { 945 if(size(#) > 0) 946 { 947 ideal K = modpStd(I,p,variant,#[1])[1]; 948 } 949 else 950 { 951 ideal K = groebner(I); 952 } 953 t = timer; 954 if(isIncluded(J,K) == 0) { j = 0; } 955 956 if(printlevel >= 11) 957 { 958 "isIncluded(J,K) takes "+string(timer - t)+" seconds"; 959 "j = "+string(j); 960 } 961 } 962 setring R; 963 return(j); 964 } 965 example 966 { "EXAMPLE:"; echo = 2; 967 intvec L = 2,3,5; 968 ring r = 0,(x,y,z),dp; 969 ideal I = x+1,x+y+1; 970 ideal J = x+1,y; 971 pTestSB(I,I,L,2); 972 pTestSB(I,J,L,2); 973 } 775 974 776 //////////////////////////////////////////////////////////////////////////////// 975 777 static proc mixedTest() -
Property
mode
changed from
-
Singular/LIB/noether.lib
rca3864 r7023ce 67 67 for ( ii = 1; ii <= size(I); ii++ ) 68 68 { 69 Y= findvars(I[ii],1)[1];69 Y=variables(I[ii]); 70 70 l=rvar(Y[1][1]); 71 71 if (size(Y[1])==1) … … 89 89 else 90 90 { 91 P2=findvars(ideal(P1[1..t]) ,1)[3];91 P2=findvars(ideal(P1[1..t]))[3]; 92 92 for ( jj = 1; jj <= size(P2[1]); jj++ ) 93 93 { -
Singular/LIB/normal.lib
rca3864 r7023ce 1148 1148 "// the ideal was the zero-ideal"; 1149 1149 } 1150 // execute("ring newR7="+charstr(basering)+",("+varstr(basering)+"),("1151 // +ordstr(basering)+");");1152 1150 def newR7 = ring(gnirlist); 1153 1151 setring newR7; … … 1597 1595 // Now RR[2] must be 1, hence the test for normality was positive 1598 1596 MB=SM[2]; 1599 //execute("ring newR7="+charstr(basering)+",("+varstr(basering)+"),("1600 // +ordstr(basering)+");");1601 1597 def newR7 = ring(gnirlist); 1602 1598 setring newR7; … … 1901 1897 //ideal new2=SL[1],SM[2]; 1902 1898 1903 //execute("ring newR1="+charstr(basering)+",("+varstr(basering)+"),("