Changeset 3c4dcc in git
- Timestamp:
- May 6, 2005, 4:39:20 PM (18 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 0d217d3f1cc4c0449bdb078c65fd1f43cd1a2b84
- Parents:
- e6fb5315eb32da00236163ce10f9bdafaaa0bd47
- Location:
- Singular/LIB
- Files:
-
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/KVequiv.lib
re6fb531 r3c4dcc 1 // $Id: KVequiv.lib,v 1. 1 2001-11-27 15:56:15 anneExp $1 // $Id: KVequiv.lib,v 1.2 2005-05-06 14:38:03 hannes Exp $ 2 2 // (anne, last modified 27.11.2001) 3 3 ///////////////////////////////////////////////////////////////////////////// … … 5 5 ///////////////////////////////////////////////////////////////////////////// 6 6 7 version="$Id: KVequiv.lib,v 1. 1 2001-11-27 15:56:15 anneExp $";7 version="$Id: KVequiv.lib,v 1.2 2005-05-06 14:38:03 hannes Exp $"; 8 8 info=" 9 9 LIBRARY: KVequiv.lib PROCEDURES RELATED TO K_V-EQUIVALENCE … … 15 15 derlogV(iV); derlog(V(iV)) 16 16 KVtangent(I,rname,dername,k) K_V tangent space to given singularity 17 KVversal(KVtan,I,rname,idname) K_V versal family 17 KVversal(KVtan,I,rname,idname) K_V versal family 18 18 KVvermap(KVtan,I) section inducing K_V versal family 19 19 lft_vf(I,rname,idname) liftable vector fields … … 21 21 REMARKS: 22 22 * monomial ordering should be of type (c,...) 23 * monomial ordering should be local on the original (2) rings 23 * monomial ordering should be local on the original (2) rings 24 24 "; 25 25 //////////////////////////////////////////////////////////////////////////// … … 31 31 32 32 // then the ones written in C/C++ 33 LIB("loctriv.so"); 33 LIB("loctriv.so"); 34 34 35 35 //////////////////////////////////////////////////////////////////////////// … … 39 39 proc derlogV(ideal iV) 40 40 "USAGE: @code{derlogV(iV)}; @code{iV} ideal 41 RETURN: matrix whose columns generate derlog(V(iV)) 41 RETURN: matrix whose columns generate derlog(V(iV)) 42 42 EXAMPLE: @code{example derlogV}; shows an example 43 43 " … … 79 79 @code{rname,dername} strings 80 80 @code{[k]} int 81 RETURN: K_V tangent space to a singularity given as a section of a 82 model singularity 83 NOTE: The model singularity lives in the ring given by rname and 81 RETURN: K_V tangent space to a singularity given as a section of a 82 model singularity 83 NOTE: The model singularity lives in the ring given by rname and 84 84 its derlog(V) is given by dername in that ring. The section is 85 specified by the generators of mapi. If k is given, the first k 85 specified by the generators of mapi. If k is given, the first k 86 86 variables are used as variables, the remaining ones as parameters 87 87 EXAMPLE: @code{example KVtangent}; shows an example … … 178 178 @code{rname,idname} strings 179 179 RETURN: list; The first entry of the list is the new ring in which the 180 K_V versal family lives, the second is the name of the ideal 181 describing a K_V versal family of a singularity given as section 180 K_V versal family lives, the second is the name of the ideal 181 describing a K_V versal family of a singularity given as section 182 182 of a model singularity (which was specified as idname in rname) 183 183 NOTE: The section is given by the generators of I, KVtan is the matrix 184 184 describing the K_V tangent space to the singularity (as returned 185 by KVtangent). rname denotes the ring in which the model 185 by KVtangent). rname denotes the ring in which the model 186 186 singularity lives, and idname is the name of the ideal in this ring 187 187 defining the singularity. … … 231 231 // Extend our current ring by adjoining the correct number of variables 232 232 // A(i) for the parameters and copy our objects to this ring 233 //--------------------------------------------------------------------------- 233 //--------------------------------------------------------------------------- 234 234 def rbas=basering; 235 235 ring rtemp=0,(A(1..size(kbKVt))),(c,dp); … … 270 270 ideal idy=ab,cd; 271 271 def dV=derlogV(idy); 272 echo=1; 272 echo=1; 273 273 export ry; export dV; export idy; echo=2; 274 274 ring rx=0,(x,y,z),ds; … … 279 279 setring rnew; 280 280 `li[2]`; 281 echo=1; 281 echo=1; 282 282 setring ry; kill idy; kill dV; setring rx; kill ry; 283 283 } … … 286 286 proc KVvermap(matrix KVtan, ideal mapi) 287 287 "USAGE: @code{KVvermap(KVtan,I)}; @code{KVtan} matrix, @code{I} ideal 288 RETURN: list; The first entry of the list is the new ring in which the 289 versal object lives, the second specifies a map describing the 290 section which yields a K_V versal family of the original 288 RETURN: list; The first entry of the list is the new ring in which the 289 versal object lives, the second specifies a map describing the 290 section which yields a K_V versal family of the original 291 291 singularity which was given as section of a model singularity 292 292 NOTE: The section is given by the generators of I, KVtan is the matrix … … 321 321 // Extend our current ring by adjoining the correct number of variables 322 322 // A(i) for the parameters and copy our objects to this ring 323 //--------------------------------------------------------------------------- 323 //--------------------------------------------------------------------------- 324 324 def rbas=basering; 325 325 ring rtemp=0,(A(1..size(kbKVt))),(c,dp); … … 350 350 ideal idy=ab,cd; 351 351 def dV=derlogV(idy); 352 echo=1; 352 echo=1; 353 353 export ry; export dV; export idy; echo=2; 354 354 ring rx=0,(x,y,z),ds; … … 359 359 setring rnew; 360 360 `li[2]`; 361 echo=1; 361 echo=1; 362 362 setring ry; kill idy; kill dV; setring rx; kill ry; 363 363 } … … 373 373 RETURN: list 374 374 [1]: ring in which objects specified by the strings [2] and [3] live 375 [2]: name of ideal describing the liftable vector fields - 375 [2]: name of ideal describing the liftable vector fields - 376 376 computed up to order b in the parameters 377 377 [3]: name of basis of the K_V-normal space of the original singularity 378 378 [4]: (if 6th argument is given) 379 ring in which the reduction of the liftable vector fields has 379 ring in which the reduction of the liftable vector fields has 380 380 taken place. 381 381 [5]: name of liftable vector fields in ring [4] … … 386 386 ring rname in the ideal idname, the resulting expression is 387 387 quasihomogeneous; wv specifies the weight vector of the ring rname. 388 389 388 b is the degree bound up in the perturbation parameters up to which 389 computations are performed. 390 390 NOTE: the original ring should not contain any variables of name 391 391 A(i) or e(j) 392 EXAMPLE:@code{example lft_vf;} gives an example 392 EXAMPLE:@code{example lft_vf;} gives an example 393 393 " 394 394 { … … 431 431 // first prepare derlog(V) for the model singularity 432 432 // and set the correct weights 433 //--------------------------------------------------------------------------- 433 //--------------------------------------------------------------------------- 434 434 def @dV=derlogV(`idname`); 435 435 export(@dV); … … 453 453 } 454 454 //--------------------------------------------------------------------------- 455 // Construction of the versal family 455 // Construction of the versal family 456 456 //--------------------------------------------------------------------------- 457 457 list lilit=KVvermap(KVt,mapi); … … 464 464 //--------------------------------------------------------------------------- 465 465 // put the unperturbed and the perturbed tangent space into a module 466 // (1st component unperturbed) and run a groebner basis computation 466 // (1st component unperturbed) and run a groebner basis computation 467 467 // which only considers spolys with non-vanishing first component 468 468 //--------------------------------------------------------------------------- 469 469 def rxa=basering; 470 string rchange="ring rexa=" + charstr(basering) + ",(e(1.." + 471 string(ncols(mapi)) + ")," + varstr(basering) + 470 string rchange="ring rexa=" + charstr(basering) + ",(e(1.." + 471 string(ncols(mapi)) + ")," + varstr(basering) + 472 472 "),(c,ws(" + string((-1)*wv) + "," + string(ivm) + "),dp);"; 473 473 execute(rchange); … … 557 557 mt=mt,Aus2[2,i]; 558 558 } 559 } 559 } 560 560 //--------------------------------------------------------------------------- 561 561 // * change weights of the A(i) such that Aus2[1,i] and Aus2[2,i] have the 562 562 // same leading term, if the first one is non-zero 563 // * reduce mt by mx 563 // * reduce mt by mx 564 564 // * find l such that (x_1,...,x_n)^l * eid can be used instead of noether 565 565 // which we have to avoid because we are playing with the weights … … 571 571 } 572 572 mx=jet(mx,counter*(b+1),qiv); 573 rchange="ring rexaw=" + charstr(basering) + ",(" + varstr(basering) + 573 rchange="ring rexaw=" + charstr(basering) + ",(" + varstr(basering) + 574 574 "),(c,ws(" + string((-1)*wv) + "," + string(ivm) + 575 575 "," + string(oiv) + "));"; … … 654 654 ideal idy=ab,cd; 655 655 def dV=derlogV(idy); 656 echo=1; 656 echo=1; 657 657 export ry; export dV; export idy; echo=2; 658 658 ring rx=0,(x,y,z),ds; … … 665 665 `li[2]`; 666 666 `li[3]`; 667 echo=1; 667 echo=1; 668 668 setring ry; kill idy; kill dV; setring rx; kill ry; 669 669 } -
Singular/LIB/algebra.lib
re6fb531 r3c4dcc 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: algebra.lib,v 1.1 0 2005-04-28 09:22:14 SingularExp $";2 version="$Id: algebra.lib,v 1.11 2005-05-06 14:38:03 hannes Exp $"; 3 3 category="Commutative Algebra"; 4 4 info=" … … 99 99 // e.g.: 100 100 def S = l[2]; setring S; check; 101 101 "); 102 102 return(l); 103 103 } … … 287 287 "USAGE: algDependent(f[,c]); f ideal (say, f = f1,...,fm), c integer 288 288 RETURN: 289 @format 289 @format 290 290 a list l of size 2, l[1] integer, l[2] ring: 291 291 - l[1] = 1 if f1,...,fm are algebraic dependent, 0 if not … … 398 398 // e.g.: 399 399 def S = l[2]; setring S; ker; 400 400 "); 401 401 return (L); 402 402 } … … 492 492 "USAGE: is_injective(phi[,c,s]); phi map, pr reimage ring, c int, s string 493 493 RETURN: 494 @format 494 @format 495 495 - 1 (type int) if phi is injective, 0 if not (if s is not given). 496 496 - If s is given, return a list l of size 2, l[1] int, l[2] ring: … … 564 564 // e.g.: 565 565 def S = l[2]; setring S; ker; 566 566 "); 567 567 return(L); 568 568 } … … 754 754 "USAGE: noetherNormal(id[,p]); id ideal, p integer 755 755 RETURN: 756 @format 756 @format 757 757 a list l two ideals, say I,J: 758 758 - I is generated by a subset of the variables with size(I) = dim(id) -
Singular/LIB/brnoeth.lib
re6fb531 r3c4dcc 1 version="$Id: brnoeth.lib,v 1.1 4 2005-04-19 15:23:38 SingularExp $";1 version="$Id: brnoeth.lib,v 1.15 2005-05-06 14:38:04 hannes Exp $"; 2 2 category="Coding theory"; 3 3 info=" … … 1148 1148 int i,j,k; 1149 1149 int m,n; 1150 // list L@HNE=essdevelop(CHI); 1150 // list L@HNE=essdevelop(CHI); 1151 1151 list LLL=ratdevelop(CHI); 1152 1152 if (typeof(LLL[1])=="ring") { … … 2043 2043 + "executing Adj_div, as 'a' is used for " 2044 2044 + "the name of the parameter of the field extensions needed."); 2045 ERROR("Please rename or kill the object named 'a'"); 2045 ERROR("Please rename or kill the object named 'a'"); 2046 2046 } 2047 2047 } … … 2197 2197 See @ref{Adj_div} for a description of the entries in L. 2198 2198 NOTE: The list_expression should be the output of the procedure Adj_div.@* 2199 Raising @code{printlevel}, additional comments are displayed 2199 Raising @code{printlevel}, additional comments are displayed 2200 2200 (default: @code{printlevel=0}). 2201 2201 WARNING: The parameter of the needed field extensions is called 'a'. Thus, … … 2220 2220 + "executing Adj_div, as 'a' is used for " 2221 2221 + "the name of the parameter of the field extensions needed."); 2222 ERROR("Please rename or kill the object named 'a'"); 2222 ERROR("Please rename or kill the object named 'a'"); 2223 2223 } 2224 2224 } … … 2918 2918 if (typeof(LLL[1])=="ring") { 2919 2919 def altring=basering; 2920 def HNEring = LLL[1]; 2920 def HNEring = LLL[1]; 2921 2921 setring HNEring; 2922 2922 def L@HNE = hne[1]; … … 2951 2951 } 2952 2952 kill LLL; 2953 2953 2954 2954 list BRANCH=list(); 2955 2955 BRANCH[1]=Maux; -
Singular/LIB/center.lib
re6fb531 r3c4dcc 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: center.lib,v 1.1 3 2005-02-23 18:10:44 levandovExp $";2 version="$Id: center.lib,v 1.14 2005-05-06 14:38:08 hannes Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 6 6 AUTHOR: Oleksandr Motsak, motsak@mathematik.uni-kl.de. 7 7 OVERVIEW: 8 This is a library for computing the central elements and centralizers of elements in various noncommutative algebras. 8 This is a library for computing the central elements and centralizers of elements in various noncommutative algebras. 9 9 Implementation is based on algorithms, written in the frame of the diploma thesis by O. Motsak (advisor: Prof. S.A. Ovsienko, support: V. Levandovskyy), at Kyiv Taras Shevchenko University (Ukraine) with the title 'An algorithm for the computation of the center of noncommutative polynomial algebra'. 10 10 … … 12 12 13 13 PROCEDURES: 14 15 16 17 14 center(MaxDeg[,N]); computes the generators of the center of a basering, 15 centralizer(f, MaxDeg[,N]); computes the generators of the centralizer of f in a basering, 16 inCenter(l); checks the centrality of elements of list/ideal/poly l 17 inCentralizer(l, f); checks the commutativity wrt polynomial f of polynomials of list/ideal/poly l 18 18 19 19 KEYWORDS: inCenter; inCentralizer; center; centralizer 20 20 "; 21 21 22 23 22 /******************************************************/ 24 23 // stuff … … 26 25 /******************************************************/ 27 26 static proc myValue ( def s, list # ) 28 " 29 27 " 28 return s or (typeof(s))(#) 30 29 " 31 30 { … … 34 33 { 35 34 if ( typeof( #[1] ) == typeof(s) ) 36 37 38 35 { 36 @p = #[1]; 37 }; 39 38 }; 40 39 return (@p); … … 44 43 static proc myInt ( list # ) 45 44 " 46 45 return 0 or int(#) 47 46 " 48 47 { … … 54 53 static proc myPoly ( list # ) 55 54 " 56 55 return 0 or poly(#) 57 56 " 58 57 { … … 64 63 static proc myRing ( list # ) 65 64 " 66 65 return basring or ring(#) 67 66 " 68 67 { … … 74 73 static proc myString ( list # ) 75 74 " 76 75 return basring or ring(#) 77 76 " 78 77 { … … 84 83 static proc myIdeal ( list # ) 85 84 " 86 85 return 0 or ideal(#) 87 86 " 88 87 { … … 107 106 print (#); 108 107 }; 109 }; 108 }; 110 109 111 110 /******************************************************/ … … 134 133 static proc maxDeg( def z ) 135 134 " 136 137 138 " 139 { 140 int max = -1; 135 returns: int : max of givendeg( z_i ), among all z_i \in z 136 returns -1 if z is empty or contain only 0 polynomial 137 " 138 { 139 int max = -1; 141 140 int d; 142 141 … … 144 143 { 145 144 d = deg(z[i]); 146 if( d > max ) 147 148 149 145 if( d > max ) 146 { 147 max = d; 148 }; 150 149 }; 151 150 … … 159 158 static proc myCoeff ( poly f, poly m ) 160 159 " 161 162 160 input: poly f, 161 return: coeff at m 163 162 " 164 163 { … … 166 165 167 166 int i = size(f); 168 167 169 168 while ( (i>0) and (leadmonom(f[i])<m) ) 170 169 { … … 173 172 if( i == 0 ) 174 173 { 175 return ( 0 ); 174 return ( 0 ); 176 175 }; 177 176 … … 180 179 return ( leadcoef(f[i]) ); 181 180 }; 182 181 183 182 return ( 0 ); 184 183 }; … … 194 193 V[k] = var(k); 195 194 }; 196 195 197 196 return (V); 198 197 }; … … 207 206 208 207 poly v, d; int i; 209 208 210 209 for ( int k = 2; k <= N; k++ ) 211 210 { 212 211 v = V[k]; 213 212 for ( i = 1; i < k; i++ ) 214 215 216 M[k,i] = v*d - d*v;// [var(k),var(i)]217 M[i,k] = -M[k,i];// [var(i),var(k)] == -[var(k),var(i)]218 213 { 214 d = V[i]; 215 M[k,i] = v*d - d*v; // [var(k),var(i)] 216 M[i,k] = -M[k,i]; // [var(i),var(k)] == -[var(k),var(i)] 217 }; 219 218 }; 220 219 … … 233 232 int i, j; poly a; poly d; 234 233 235 int N 236 list V 234 int N = nvars( basering ); 235 list V = my_vars(); 237 236 matrix M = my_commutators(); 238 237 … … 240 239 241 240 int cartan; 242 241 243 242 list RESULT = list(); 244 243 int r_begin = 1; 245 244 int r_end = N; 246 245 247 246 248 247 for ( int k = 1; k <= N; k++ ) … … 251 250 cartan = 1; 252 251 for ( i = 1; i <= N; i++ ) 253 254 255 256 257 a = myCoeff( d, V[j] ); 258 259 260 261 262 263 }; 264 265 252 { 253 d = M[k,i]; 254 for ( j = 1; j <= N; j++ ) 255 { 256 a = myCoeff( d, V[j] ); 257 A[i,j] = a; 258 259 if( (i!=j) and (a!=0) ) 260 { 261 cartan = 0; 262 }; 263 }; 264 }; 266 265 267 266 if ( cartan ) 268 { 269 270 271 272 273 274 r_end--; 275 276 277 }; 278 267 { 268 RESULT[r_begin] = list( V[k], cartan, A ); 269 r_begin++; 270 } else 271 { 272 RESULT[r_end] = list( V[k], cartan, A ); 273 r_end--; 274 }; 275 276 }; 277 279 278 return (RESULT); 280 279 … … 291 290 kill ( @@@SORTEDVARARRAY ); 292 291 }; 293 292 294 293 list @@@SORTEDVARARRAY; 295 294 list V = my_associated(); 296 295 297 296 // cartans - first then others... 298 297 299 298 for ( int i = 1; i<= size(V); i++ ) 300 299 { 301 300 @@@SORTEDVARARRAY[i] = V[i][1]; 302 301 }; 303 302 304 303 Print( "@@@SORTEDVARARRAY: " + string(@@@SORTEDVARARRAY) ); 305 306 export(@@@SORTEDVARARRAY); 304 305 export(@@@SORTEDVARARRAY); 307 306 }; 308 307 … … 321 320 Print( "Error: my_var_init() was not called before this..." ); 322 321 return( var(@number) ); 323 322 324 323 }; 325 324 … … 346 345 " 347 346 { 348 string s = ""; 349 347 string s = ""; 348 350 349 while ( param != 0 ) 351 350 { 352 351 s = string ( param % 2 ) + s; 353 352 param = param / 2; 354 n --; 353 n --; 355 354 }; 356 355 while ( n > 0 ) … … 375 374 // setup redSB, redTail options 376 375 export(@@@MY_QIDEAL); 377 376 378 377 option(redSB); 379 378 option(redTail); 380 379 381 380 }; 382 381 }; … … 397 396 { 398 397 /* 399 400 param = myValue(param, #); 401 398 int param = 1 ; // by def: reduce both 1st and 2nd entries 399 param = myValue(param, #); 400 string bits = myBitParam( param, 8 ); 402 401 */ 403 402 BCall( "QNF_poly", p ); 404 403 405 404 p = NF( p, @@@MY_QIDEAL ); 406 405 407 406 ECall( "QNF_poly", p ); 408 407 }; // QRing … … 423 422 +2 7 => reduce every 2nd entry 424 423 425 424 --- (for PBW in qrings) --- 426 425 427 426 +4 6 => kill out pbw entries where pbw monom (1) was affected … … 429 428 //?? wofuer? 430 429 +8 5 => reduce every 3rd entry 431 430 432 431 " 433 432 { … … 437 436 438 437 int param = 1 + 2; // by def: reduce both 1st and 2nd entries 439 param = myValue(param, #); 440 438 param = myValue(param, #); 439 441 440 string bits = myBitParam( param, 8 ); 442 441 … … 444 443 445 444 poly temp; 446 445 447 446 for ( int i = size(l); i>0 ; i -- ) 448 449 450 451 452 453 454 455 456 457 if ( bits[6] == "1" ) 458 459 460 if( temp != l[i] ) 461 462 463 464 465 466 467 468 if ( bits[8] == "1" ) 469 470 471 472 473 474 475 476 { 477 // 1st 478 479 480 { 481 482 483 484 485 486 487 488 if ( bits[6] == "1" ) 489 490 491 if( temp != l[i][1] ) 492 493 494 495 496 497 498 499 if ( bits[8] == "1" ) 500 501 502 503 504 505 506 507 508 509 510 511 { 512 513 514 515 516 517 518 l[i][2] = temp; 519 520 521 522 523 524 447 { 448 449 if ( typeof( l[i] ) == "poly" ) 450 { 451 452 if ( (bits[8] == "1") or (bits[6] == "1") ) 453 { 454 temp = NF( l[i], @@@MY_QIDEAL ); 455 456 if ( bits[6] == "1" ) 457 {// for PBW in qrings: kill out pbw entries where pbw monom was reduced 458 459 if( temp != l[i] ) 460 { 461 l = delete( l, i ); 462 i --; 463 continue; 464 }; 465 }; 466 467 if ( bits[8] == "1" ) 468 { 469 l[i] = temp; 470 }; 471 }; 472 }; 473 474 if ( typeof( l[i] ) == "list" ) 475 { 476 // 1st 477 478 if ( size(l[i])>0 ) 479 { 480 if ( (bits[8] == "1") or (bits[6] == "1") ) 481 { 482 if( typeof( l[i][1] ) == "poly" ) 483 { 484 485 temp = NF( l[i][1], @@@MY_QIDEAL ); 486 487 if ( bits[6] == "1" ) 488 {// for PBW in qrings: kill out pbw entries where pbw monom was reduced 489 490 if( temp != l[i][1] ) 491 { 492 l = delete( l, i ); 493 i --; 494 continue; 495 }; 496 }; 497 498 if ( bits[8] == "1" ) 499 { 500 l[i][1] = temp; 501 }; 502 503 }; 504 }; 505 }; 506 507 // 2nd 508 509 if ( size(l[i])>1 ) 510 { 511 if ( bits[7] == "1" ) 512 { 513 if( typeof( l[i][2] ) == "poly" ) 514 { 515 temp = NF( l[i][2], @@@MY_QIDEAL ); 516 517 l[i][2] = temp; 518 }; 519 }; 520 }; 521 }; 522 }; 523 525 524 ECall( "QNF_list", "list" ); 526 525 527 526 }; // Qring 528 527 529 528 return ( l ); 530 529 }; … … 545 544 static proc uni_poly( poly p ) 546 545 " 547 548 " 549 { 550 poly @tt = poly(0); 546 returns polynomial with the same monomials but without coefficients. 547 " 548 { 549 poly @tt = poly(0); 551 550 for ( int @k = size(p); @k > 0; @k -- ) 552 551 { 553 552 @tt = @tt + leadmonom(p[@k]); 554 }; 555 return (@tt); 553 }; 554 return (@tt); 556 555 }; 557 556 … … 560 559 { 561 560 int @n = size( @t ); 562 561 563 562 if ( @n == 0 ) 564 563 { 565 564 return (@def); 566 565 }; 567 566 568 567 number @max = leadcoef(@t[1]); 569 568 number @mm; 570 571 if ( @n > 1) 569 570 if ( @n > 1) 572 571 { 573 572 for ( int @i = 2; @i <= @n ;@i ++ ) 574 575 576 if ( @mm < 0 ) 577 578 579 580 581 if( @mm > @max ) 582 583 584 585 586 }; 587 573 { 574 @mm = leadcoef ( @t[@i] ); 575 if ( @mm < 0 ) 576 { 577 @mm = -@mm; 578 }; 579 580 if( @mm > @max ) 581 { 582 @max = @mm; 583 }; 584 }; 585 }; 586 588 587 @max = @max + 1; 589 if ( @max == 0 ) 588 if ( @max == 0 ) 590 589 { 591 590 @max = @max + 1; … … 599 598 { 600 599 int @l, @k; 601 600 602 601 poly @t, @tt; 603 602 604 603 @l = size (@given); 605 604 606 605 @t = poly(0); 607 606 for ( @k = @l; @k > 0; @k -- ) 608 607 { 609 608 if (@num == 1) 610 611 612 613 614 @tt = @given[@k][2]; 615 616 609 { 610 @tt = @given[@k]; 611 } else 612 { 613 @tt = @given[@k][2]; 614 }; 615 617 616 @t = @t + uni_poly( @tt ); 618 617 }; 619 618 620 619 return ( uni_poly(@t) ); 621 620 }; … … 626 625 static proc LM ( intvec exp ) 627 626 " 628 629 627 input : given exponent 628 return: monom with this exponent... 630 629 " 631 630 { … … 635 634 @deg = exp[@i]; 636 635 if ( @deg > 0 ) 637 638 639 636 { 637 @f = @f * (var(@i)^(@deg)); 638 }; 640 639 }; 641 640 … … 651 650 static proc zSort ( list @z ) 652 651 " 653 Sort elements of a list of polynoms, 654 652 Sort elements of a list of polynoms, 653 and normalize 655 654 " 656 655 { … … 664 663 { 665 664 if ( @z[1] == 0 ) // if zero => empty list 666 667 668 }; 665 { 666 return(list()); 667 }; 669 668 670 669 @z[1] = @z[1] * ( 1/leadcoef(@z[1]) ) ; … … 674 673 675 674 int i = 1; 676 675 677 676 while ( i<=n ) 678 677 { 679 if (size( @z[i] ) != 0) 680 681 682 678 if (size( @z[i] ) != 0) 679 { 680 break; 681 }; 683 682 i++; 684 683 }; 685 684 686 685 if ( i > n ) 687 686 { // all zeroes 688 687 return(list()); 689 688 }; 690 689 691 690 ideal id = @z[i]; 692 691 i++; 693 692 694 693 while ( i<= n ) 695 694 { 696 695 if( @z[i] != 0 ) 697 698 699 696 { 697 id=@z[i],id; 698 }; 700 699 i++; 701 700 }; … … 711 710 p = srt[1][i]; 712 711 if ( p == 0 ) 713 714 715 716 717 p = p* (1/leadcoef(p)); 712 { 713 i --; 714 continue; 715 }; 716 p = p* (1/leadcoef(p)); // normalize 718 717 result = list(p) + result; 719 718 }; 720 719 721 // 722 // 723 720 // "OUT SORT::"; 721 // result; 722 724 723 return ( result ); 725 724 }; … … 730 729 static proc zRefine ( list @z ) 731 730 " 732 733 Note: based on myCoeff 731 kill terms by leading monomials... 732 Note: based on myCoeff 734 733 " 735 734 { … … 746 745 int flag = 1; 747 746 748 while ( flag == 1 ) 747 while ( flag == 1 ) 749 748 { 750 749 flag = 0; … … 752 751 @z = zSort(@z); // sort out, < ... 753 752 754 if( size(@z) < 2 ) 755 756 757 753 if( size(@z) < 2 ) 754 { 755 return (@z); 756 }; 758 757 759 758 for ( @i = size(@z); @i > 0; @i -- ) // at 1st the biggest ... then smallest... 760 761 762 763 764 765 766 767 768 769 770 771 772 773 @f= leadmonom(@ff);774 775 776 777 778 779 780 781 @z[@j] = @gg - @ng * @ff; 782 783 }; 784 785 786 787 788 @ng = myCoeff(@gg, @f); 789 790 791 @z[@j] = @gg - @ng * @ff; 792 793 }; 794 795 796 759 { 760 761 @ff = @z[@i]; 762 763 if( size(@ff) == 0 ) 764 { 765 @z = delete ( @z , @i ); 766 @i --; 767 continue; 768 }; 769 770 @ff = @ff*(1/leadcoef(@ff)); 771 @z[@i] = @ff; 772 @f = leadmonom(@ff); 773 774 for ( @j = (@i-1); (@j>0); @j -- ) 775 { 776 @gg = @z[@j]; 777 @ng = myCoeff(@gg, @f); // leads? 778 if( @ng!=0 ) 779 { 780 @z[@j] = @gg - @ng * @ff; 781 flag = 1; 782 }; 783 }; 784 for ( @j = (@i+1); (@j<=size(@z)); @j ++ ) 785 { 786 @gg = @z[@j]; 787 @ng = myCoeff(@gg, @f); 788 if( @ng!=0 ) 789 { 790 @z[@j] = @gg - @ng * @ff; 791 flag = 1; 792 }; 793 }; 794 795 }; 797 796 }; 798 797 799 798 ECall("zRefine", "list"); 800 799 801 return 802 803 }; 804 805 806 /******************************************************/ 807 // procedures for building "bad leadmonomials" set 800 return ( @z ); 801 802 }; 803 804 805 /******************************************************/ 806 // procedures for building "bad leadmonomials" set 808 807 809 808 … … 811 810 static proc checkPolyUniq( list l, poly p ) 812 811 " 813 814 815 812 check whether p sits already in l, assume l to be size-sorted < 813 return: -1 if present 814 1 if we need to add 816 815 " 817 816 { … … 821 820 822 821 int s = size(p); 823 822 824 823 while( i<= n ) 825 { 824 { 826 825 if ( size(l[i]) >= s ) 827 828 829 830 831 i ++; 826 { 827 break; 828 }; 829 830 i ++; 832 831 }; 833 832 834 833 // now: size(l[i]) >= s 835 834 while( i<= n ) 836 { 835 { 837 836 if ( size(l[i]) == s ) 838 839 840 841 842 if ( l[i] == p ) 843 844 845 846 847 i ++; 837 { 838 break; 839 840 }; 841 if ( l[i] == p ) 842 { 843 ECall( "checkPolyUniq", -1 ); 844 return (-1); 845 }; 846 i ++; 848 847 }; 849 848 … … 856 855 static proc addPolyUniq( list l, poly p ) 857 856 " 858 857 add p into l uniquely, and keep l size-sorted < 859 858 " 860 859 { 861 860 BCall( "addPolyUniq", " { " + string(l) + " }, " + string(p) ); 862 861 863 862 int n = size(l); 864 863 … … 866 865 { 867 866 l = list(p); 868 867 869 868 ECall( "addPolyUniq", l ); 870 869 871 870 return (l); 872 871 }; 873 872 874 873 int s = size(p); 875 874 876 875 int i = 1; 877 876 while( i<= n ) 878 877 { 879 878 if( size(l[i]) > s ) 880 881 882 883 884 879 { 880 l = insert( l, p, i-1 ) ; 881 break; 882 }; 883 885 884 if( size(l[i]) == s ) 886 887 888 889 890 891 892 885 { 886 if ( l[i] == p ) 887 { 888 break; 889 }; 890 }; 891 893 892 i++; 894 893 }; 895 894 896 895 if( i > n ) 897 896 { 898 897 l = l + list(p); 899 898 }; 900 899 901 900 ECall( "addPolyUniq", l ); 902 901 return(l); … … 907 906 static proc mergePolysUniq( list a, list b ) 908 907 " 909 908 merge lists uniq 910 909 " 911 910 { 912 911 BCall( "mergePolysUniq", "{ " + string(a) + " }, { " + string(b) + "} " ); 913 912 914 913 for( int i = 1; i <= size(b); i ++ ) 915 914 { 916 915 a = addPolyUniq(a, b[i]); 917 916 }; 918 917 919 918 ECall( "mergePolysUniq", a ); 920 919 921 920 return (a); 922 921 }; … … 926 925 static proc sortPolysUniq( list a ) 927 926 " 928 927 sort list uniq 929 928 " 930 929 { 931 930 BCall( "sortPolysUniq", a ); 932 931 933 932 if( size(a) < 2 ) 934 933 { … … 936 935 return(a); 937 936 }; 938 937 939 938 list b = list(a[1]); 940 939 941 940 for( int i = 2; i <= size(a); i ++ ) 942 941 { 943 942 b = addPolyUniq(b, a[i]); 944 943 }; 945 944 946 945 ECall( "sortPolysUniq", b ); 947 946 948 947 return (b); 949 948 }; 950 949 951 950 /******************************************************/ 952 static proc addRecordUniq ( list leadD, list newD, intvec texp, poly tm, int kind, list prs ) 953 " 954 955 951 static proc addRecordUniq ( list leadD, list newD, intvec texp, poly tm, int kind, list prs ) 952 " 953 if kind = 0 => for PBW - no products 954 if kind = 1 => with products 956 955 " 957 956 { … … 962 961 963 962 prs = sortPolysUniq(prs); 964 963 965 964 // trick: 966 965 // check for presens of a monomial @tm in current index poly of @leads (=> in list @leads) 967 966 // if char = 0 then new_size > (if not present) or = (if already present) 968 // if char > 0 then new_size > (if not present) or =< (if already present) 967 // if char > 0 then new_size > (if not present) or =< (if already present) 969 968 // !!!!! 970 if( size(tm + leadD[2]) > size(leadD[2]) ) 969 if( size(tm + leadD[2]) > size(leadD[2]) ) 971 970 { 972 971 f_add = 1; 973 972 } else 974 973 { 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 }; 993 974 if ( kind != 0 ) 975 { 976 for ( i = 1; i<= size(leadD[1]); i++ ) 977 { 978 if ( leadD[1][i][2] == tm ) 979 { 980 for ( i = size(prs); i>0; i-- ) 981 { 982 f_add = checkPolyUniq( leadD[1][i][3], prs[i] ); 983 if( f_add == -1 ) 984 { 985 prs = delete(prs, i); 986 }; 987 }; 988 989 break; 990 }; 991 }; 992 }; 994 993 }; 995 994 … … 999 998 list newlist ; 1000 999 if ( kind != 0 ) 1001 1002 1003 1004 1005 1006 1000 { 1001 newlist = list ( list ( texp, tm, prs ) ); 1002 } else 1003 { 1004 newlist = list ( list ( texp, tm ) ); 1005 }; 1007 1006 1008 1007 1009 1008 if ( size(newD[1]) == 0 ) 1010 1011 newD[1] = newlist; 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1009 { 1010 newD[1] = newlist; 1011 newD[2] = tm; 1012 } else 1013 { 1014 1015 if( size(tm + newD[2]) > size(newD[2]) ) 1016 { 1017 newD[1] = newD[1] + newlist; 1018 newD[2] = newD[2] + tm; 1019 } else 1020 { 1021 if ( kind != 0 ) 1022 { 1023 for ( i = 1; i<= size(newD[1]); i++ ) 1024 { 1025 if ( newD[1][i][2] == tm ) 1026 { 1027 newD[1][i][3] = mergePolysUniq( newD[1][i][3], prs ); 1028 break; 1029 }; 1030 }; 1031 }; 1032 }; 1033 }; 1035 1034 }; 1036 1035 … … 1044 1043 { 1045 1044 BCall ("mergeRecordsUniq", "{old leads}, {new leads}, " + string(kind) ); 1046 1045 1047 1046 if( size(new[1]) > 0 ) 1048 1047 { 1049 1048 if ( size (old[1]) == 0 ) 1050 1051 1052 1053 1054 1055 { 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 }; 1073 1074 1075 1076 1077 1078 1079 1080 1049 { 1050 old = new; 1051 } else 1052 { 1053 if ( kind != 0 ) 1054 { 1055 int io; 1056 for ( int in = 1; in <= size( new[1] ); in ++ ) 1057 { 1058 if( size( new[1][in][2] + old[2] ) > size( old[2] ) ) 1059 { 1060 old[1] = old[1] + list(new[1][in]); 1061 old[2] = old[2] + new[1][in][2]; 1062 } else 1063 { 1064 for( io = 1; io <= size( old[1] ); io ++ ) 1065 { 1066 if( old[1][io][2] == new[1][in][2] ) 1067 { 1068 old[1][io][3] = mergePolysUniq( old[1][io][3], new[1][in][3] ); 1069 break; 1070 }; 1071 }; 1072 }; 1073 }; 1074 } else 1075 { 1076 old[1] = old[1] + new[1]; 1077 old[2] = old[2] + new[2]; 1078 }; 1079 }; 1081 1080 }; 1082 1081 … … 1096 1095 for( int @i = 0; @i <= @deg; @i ++ ) 1097 1096 { 1098 @l[index(@i)] 1099 // new items: 1100 // { 1101 // 1102 // 1097 @l[index(@i)] = list( list() , 0); 1098 // new items: 1099 // { 1100 // list of leads, - empty list 1101 // sum poly "index", - poly(0) 1103 1102 // } 1104 1103 }; … … 1109 1108 static proc zAddBad ( list @leads, list @newz, int @maxDeg, int kind ) 1110 1109 " 1111 input: 1112 @leads: graded by deg list of 1113 1114 { 1115 [1] - list of 1116 1117 { 1118 [1] - leadexp. 1119 1120 1121 1122 }, 1123 1124 1125 1126 1127 1128 1129 1130 1131 1110 input: 1111 @leads: graded by deg list of 1112 rec: 1113 { 1114 [1] - list of 1115 rec: 1116 { 1117 [1] - leadexp. 1118 [2] - leadmonom([1]) 1119 if kind != 0 (for zReduce) => 1120 [3] - !list! of all possible products which give this leadexp 1121 }, 1122 [2] - summ of all in [1] ('index' poly) 1123 } 1124 @newz: new elements for adding to @leads 1125 @maxDeg: maximal degree 1126 1127 if kind != 0 => keeps also list of all possible products which give leadexp of a record 1128 1129 return: 1130 updated @leads list 1132 1131 1133 1132 " … … 1136 1135 1137 1136 int @newSize = size(@newz); 1138 if ( @newSize < 1 ) 1137 if ( @newSize < 1 ) 1139 1138 { 1140 1139 return (@leads); … … 1144 1143 1145 1144 1146 poly 1145 poly @m, @tm, @ttm; 1147 1146 intvec @exp, @texp, @ttexp; 1148 1147 … … 1151 1150 1152 1151 poly @sum_old, @sum_new; 1153 1152 1154 1153 poly a, b, @temp; 1155 1154 … … 1162 1161 1163 1162 for ( @i = @newSize; @i > 0; @i -- ) 1164 {// for every new poly (@newz[@i]) do 1165 1166 @m = leadmonom( @newz[@i] ); 1163 {// for every new poly (@newz[@i]) do 1164 1165 @m = leadmonom( @newz[@i] ); 1167 1166 @deg = deg(@m); 1168 1167 @exp = leadexp(@m); … … 1172 1171 1173 1172 for( @mydeg = @deg; @mydeg <= @maxDeg; @mydeg = @mydeg + @deg ) 1174 1175 1176 if ( @mydeg > @deg ) 1177 1178 @texp= @texp + @exp;1179 @tm= LM ( @texp );1180 1181 1182 1183 1184 1185 1186 @texp= @exp;1187 @tm= @m;1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 /*!!*/ @newzz[index(@mydeg)] = 1201 /*!!*/addRecordUniq( @leads[index(@mydeg)], @newzz[index(@mydeg)], @texp, @tm, kind, list(pr) );1202 1203 1204 { // for every good "deg" 1205 1206 1207 1208 1209 1210 1211 @ttexp= (@leads[index(@dd)][1][@k][1]) + @texp;1212 @ttm= LM (@ttexp);1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 /*!!*/ @newzz[index(@newdeg)] = 1242 /*!!*/addRecordUniq( @leads[index(@newdeg)], @newzz[index(@newdeg)], @ttexp, @ttm, kind, prs );1243 1244 1245 1246 }; 1247 1248 1249 if ( @deg == 0 ) 1250 1251 1252 1253 1173 {// adding all possiblities for @newz[@i]^@j; 1174 1175 if ( @mydeg > @deg ) 1176 { 1177 @texp = @texp + @exp; 1178 @tm = LM ( @texp ); 1179 if ( kind != 0) 1180 { 1181 pr = QNF_poly( pr * @newz[@i] ); // degrees must be there!!! 1182 }; 1183 } else 1184 { 1185 @texp = @exp; 1186 @tm = @m; 1187 if ( kind != 0) 1188 { 1189 pr = @newz[@i]; 1190 }; 1191 }; 1192 1193 @temp = QNF_poly(@tm); 1194 if( @temp != @tm ) 1195 { 1196 break; 1197 }; 1198 1199 /*!!*/ @newzz[index(@mydeg)] = 1200 /*!!*/ addRecordUniq( @leads[index(@mydeg)], @newzz[index(@mydeg)], @texp, @tm, kind, list(pr) ); 1201 1202 for ( @dd = 1; (@dd <= @maxDeg) and ((@dd + @mydeg) <= @maxDeg ); @dd ++ ) 1203 { // for every good "deg" 1204 1205 @newdeg = @dd + @mydeg; // any deg should be additive!!! 1206 1207 for ( @k = size(@leads[index(@dd)][1]); @k > 0; @k -- ) 1208 { 1209 1210 @ttexp = (@leads[index(@dd)][1][@k][1]) + @texp; 1211 @ttm = LM (@ttexp); 1212 1213 if ( kind != 0 ) 1214 { 1215 prs = list(); 1216 1217 for( pri = 1; pri <= size(@leads[index(@dd)][1][@k][3]); pri++) 1218 { 1219 // to do products into list and add one list !!! 1220 a = QNF_poly( pr*@leads[index(@dd)][1][@k][3][pri]); 1221 b = QNF_poly( @leads[index(@dd)][1][@k][3][pri]*pr); 1222 1223 prs= prs + list(a); 1224 1225 if ( a!=b ) 1226 { 1227 prs= prs + list(b); 1228 }; 1229 }; 1230 1231 } else 1232 { 1233 prs = list(pr); 1234 }; 1235 1236 @temp = QNF_poly(@ttm); 1237 if( @temp == @ttm ) 1238 { 1239 1240 /*!!*/ @newzz[index(@newdeg)] = 1241 /*!!*/ addRecordUniq( @leads[index(@newdeg)], @newzz[index(@newdeg)], @ttexp, @ttm, kind, prs ); 1242 }; 1243 1244 1245 }; 1246 }; // for 1247 1248 if ( @deg == 0 ) 1249 { 1250 break; 1251 }; 1252 }; 1254 1253 1255 1254 for ( @mydeg = 0; @mydeg <= @maxDeg; @mydeg ++ ) 1256 1257 1258 1255 { // adding currently generated to result 1256 @leads[index(@mydeg)] = mergeRecordsUniq ( @leads[index(@mydeg)], @newzz[index(@mydeg)], kind ); 1257 }; 1259 1258 1260 1259 }; … … 1272 1271 static proc zReducePoly ( list leads, poly new, poly anfang ) 1273 1272 " 1274 1275 return: list of all possible reductions... 1273 reduce poly new wrt found leads, 1274 return: list of all possible reductions... 1276 1275 " 1277 1276 { … … 1284 1283 list LEADS; 1285 1284 1286 int i, n; 1285 int i, n; 1287 1286 list prs; 1288 1287 … … 1295 1294 1296 1295 if( size(LEADS[2] + lm ) <= size(LEADS[2]) ) 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 } else 1315 1316 1317 1318 1319 1320 1321 1322 { 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1296 { // need to reduce, since leacmonom already in LEADS 1297 1298 for ( i = 1; i <= size(LEADS[1]); i++ ) 1299 { 1300 if( LEADS[1][i][2] == lm ) 1301 { 1302 1303 lc = leadcoef( temp ); // no need be the unit 1304 1305 prs = LEADS[1][i][3]; // shouldbe generated by zAddBad with kind == 1 1306 n = size(prs) ; 1307 1308 if ( n == 1 ) 1309 { // no recursion 1310 1311 temp = leadcoef(prs[1]) * temp - lc * prs[1]; // leadmonom goes down 1312 1313 } else 1314 { // do recursion 1315 1316 list result = list(); 1317 poly newnew; 1318 int f_addrest = 0; 1319 1320 for( int pri = 1; pri <= n ; pri ++ ) 1321 { 1322 newnew = leadcoef(prs[pri]) * temp - lc * prs[pri]; // leadmonom goes down 1323 1324 if( size( newnew ) > 0 ) 1325 { 1326 result = result + zReducePoly(leads, newnew, rest); 1327 } else 1328 { 1329 f_addrest = 1; 1330 }; 1331 }; 1332 1333 if ( f_addrest == 1 ) 1334 { 1335 result = result + list(rest); 1336 }; 1337 return ( result ); 1338 1339 }; 1340 break; 1341 }; 1342 }; 1343 1344 } else 1345 { // no such leadmonom in leads 1346 1347 rest = rest + lead ( temp ); 1348 temp = temp - lead ( temp ); // leadcoeff goes down 1349 }; 1351 1350 }; 1352 1351 … … 1359 1358 static proc zCancel ( list @tt, list @leads ) 1360 1359 " 1361 1360 just kill entries of plane PBW base with leading monomials in @leads... 1362 1361 " 1363 1362 { … … 1372 1371 poly g, f; 1373 1372 1374 for ( @i = size(@tt); @i > 0 ; @i -- ) 1373 for ( @i = size(@tt); @i > 0 ; @i -- ) 1375 1374 // for all PBW entries: 1376 1375 { … … 1379 1378 1380 1379 if ( size(f + g) > size(f) ) // if g not in @leads (works only for monomials) 1381 1382 1383 1380 { 1381 result = list( @tt[@i] ) + result; 1382 }; 1384 1383 }; 1385 1384 … … 1394 1393 static proc zReduce( list @z ) 1395 1394 " 1396 1397 1395 reduce a set @z - base of Center as V.S. 1396 into a minimal set!! 1398 1397 " 1399 1398 { 1400 1399 BCall( "zReduce", @z ); 1401 1400 1402 1401 @z = zRefine ( @z ); 1403 1402 int n = size( @z ); … … 1408 1407 }; 1409 1408 1410 int d = maxDeg( @z ); 1409 int d = maxDeg( @z ); 1411 1410 1412 1411 if( d== -1 ) … … 1424 1423 1425 1424 poly p; 1426 1425 1427 1426 for ( int i = 1; i <= n ; i++ ) 1428 1427 {// in this order... from least to maximal... … … 1433 1432 1434 1433 f_add = 1; 1435 1434 1436 1435 for( j = 1; j <= size(@red); j++ ) 1437 1438 1439 1440 f_add = 0; 1441 1442 1443 1444 1436 { 1437 if ( @red[j] == 0 ) 1438 { 1439 f_add = 0; 1440 break; // nothing new.... 1441 }; 1442 }; 1443 1445 1444 @red = zRefine( @red ); // there will be no zeroes after ??? 1446 1445 1447 1446 if( size(@red) > 0 ) 1448 { 1449 leads = zAddBad( leads, @red, d, 1); 1450 1451 1447 { 1448 leads = zAddBad( leads, @red, d, 1); 1449 }; 1450 1452 1451 if ( f_add == 1 ) 1453 1454 1455 result = result + list(@red); // ??? which one to add? => trying to add all 1456 1457 }; 1458 1452 { 1453 // we got something new.... 1454 result = result + list(@red); // ??? which one to add? => trying to add all 1455 }; 1456 }; 1457 1459 1458 ECall( "zReduce", result ); 1460 1459 1461 1460 return (result); 1462 1461 }; … … 1476 1475 PBW[ index(0) ] = PBW part of degree 0: 1477 1476 record: 1478 [1] : 1 // var(0) ;-) 1479 1480 1477 [1] : 1 // var(0) ;-) 1478 [2] : 0 1479 [3] : 1 1481 1480 " 1482 1481 { 1483 1482 BCall( "PBW_init" ); 1484 return (list(list(1, 0, 1))); 1483 return (list(list(1, 0, 1))); 1485 1484 }; 1486 1485 … … 1489 1488 static proc PBW_sys(list VARS, poly p) 1490 1489 " 1491 calculate the array [1..NVARS] of records: 1492 record[i] = 1493 [1] = var(i)// i^{th} variable1494 [2] = p*[1]-[1]*p// [ p, var(i) ]1495 [3] = deg(var(i))// i^{th} variable's deg1496 1497 1490 calculate the array [1..NVARS] of records: 1491 record[i] = 1492 [1] = var(i) // i^{th} variable 1493 [2] = p*[1]-[1]*p // [ p, var(i) ] 1494 [3] = deg(var(i)) // i^{th} variable's deg 1495 1496 ?? need debug ?? 1498 1497 " 1499 1498 { … … 1501 1500 BCall( "PBW_sys" ); 1502 1501 1503 poly t; 1502 poly t; 1504 1503 for (int v = size(VARS); v>0; v -- ) 1505 1504 { 1506 t 1505 t = VARS[v]; 1507 1506 VARS[v] = list( t, QNF_poly( p*t - t*p ), deg(t) ) ; 1508 1507 }; 1509 1508 1510 1509 return (VARS); 1511 1510 }; … … 1514 1513 static proc PBW_done( list PBW ) 1515 1514 " 1516 collects all together, from graded lists into plane list. 1517 1518 Note: also the last vars... 1515 collects all together, from graded lists into plane list. 1516 1517 Note: also the last vars... 1519 1518 " 1520 1519 { … … 1541 1540 list result = list(); // PBW[ index(k) ] ought to be empty ?? 1542 1541 int N = size(sys); 1543 1542 1544 1543 for ( int i = 1; i <= N; i ++ ) // for all vars 1545 1544 { 1546 1545 kk = (k - sys[i][3]); // any deg should be additive function wrt multiplication 1547 1546 if ( kk >= 0 ) 1548 1549 1550 1551 1552 1553 1554 if ( temp[3] <= i ) 1555 1556 1557 1558 1559 1560 1561 1562 1563 1547 { 1548 nn = size( PBW[ index(kk) ] ); 1549 for ( ii = 1; ii <= nn; ii ++ ) 1550 { 1551 temp = PBW[ index(kk) ][ii]; 1552 1553 if ( temp[3] <= i ) 1554 { 1555 temp[2] = temp[2]*sys[i][1] + temp[1]*sys[i][2]; // recursive [,] 1556 temp[1] = temp[1]*sys[i][1]; 1557 temp[3] = i; 1558 1559 result = result + list ( temp ); 1560 }; 1561 }; 1562 }; 1564 1563 }; 1565 1564 … … 1567 1566 ECall( "PBW_next", "list result" ); 1568 1567 return (result); 1569 1568 1570 1569 }; 1571 1570 … … 1579 1578 1580 1579 PBW[index(0)] = PBW_init(); 1581 1580 1582 1581 for (int k = 1; k <= MaxDeg; k ++ ) 1583 { 1582 { 1584 1583 PBW[index(k)] = PBW_next( PBW, k, SYS ); 1585 1584 }; 1586 1585 1587 1586 return (PBW_done( PBW )); 1588 }; 1587 }; 1589 1588 1590 1589 … … 1593 1592 1594 1593 /******************************************************/ 1595 static proc FSS (list @given, poly @BASE_POLY) 1594 static proc FSS (list @given, poly @BASE_POLY) 1596 1595 " 1597 1596 Gauss with computation of kernel v.s basis … … 1603 1602 list @nums = list (); 1604 1603 intvec @ones; 1605 int @j, @k, 1604 int @j, @k, 1606 1605 @n, @v, 1607 1606 @a, @nn; 1608 1607 1609 1608 @n = size( @BASE_POLY ); 1610 1609 @v = size( @given ); 1611 1610 1612 1611 if ( (@v == 0) or (@n == 0) ) 1613 { 1612 { 1614 1613 return (@given); 1615 1614 }; … … 1637 1636 @w = leadexp(@BASE_POLY[@a]); 1638 1637 for( @k = @v; @k > 0; @k -- ) 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1638 { 1639 if( @w == LM[@k][1] ) 1640 { 1641 @t = LM[@k][2]; 1642 MD[@a, @k] = leadcoef( @t ); 1643 @t = @t - lead ( @t ); 1644 LM[@k][2] = @t; 1645 1646 LM[@k][1] = leadexp(@t); 1647 }; 1648 }; 1650 1649 1651 1650 }; … … 1656 1655 number @div; 1657 1656 // @nums = list(); 1658 1657 1659 1658 // Gauss 1660 1659 // print("Before Gauss, Matrix: "); 1661 1660 // print( MD ); 1662 1661 1663 1662 1664 1663 @x = 1; 1665 1664 @y = 1; … … 1668 1667 { 1669 1668 @min = leadcoef( MD[@y, @x] ); // curr diag. 1670 1671 if ( @min == 0 ) 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 @j = @k; 1683 1684 //@k ++;1685 1686 // continue; 1687 1688 1689 1690 1691 if ( @j == 0 ) 1692 { 1693 // das ist gut! // 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1669 1670 if ( @min == 0 ) 1671 // if zero on diag... 1672 { 1673 @j = 0; 1674 1675 // let's find the minimal 1676 for ( @k = @y+1; @k <= @n; @k ++ ) 1677 { 1678 @max = leadcoef( MD[ @k, @x ] ); 1679 if ( @max != 0 ) 1680 { 1681 @j = @k; 1682 @min = @max; 1683 // @k ++; 1684 break; // this pure for 1685 // continue; 1686 // for find min 1687 }; 1688 }; // for (@k) // found minimal 1689 1690 if ( @j == 0 ) 1691 { 1692 // das ist gut! // 1693 @nums = @nums + list ( list ( @x, @y ) ); 1694 @x ++; 1695 continue; // while 1696 } ; 1697 1698 for ( @k = @x ; @k <= @v ; @k ++ ) 1699 { 1700 @t = MD[ @j, @k ]; 1701 MD[ @j, @k ] = MD[ @y, @k ]; 1702 MD[ @y, @k ] = @t; 1703 }; 1704 1705 }; // if diag === zero. 1707 1706 @ones[@y] = @x; 1708 1709 if ( @min == 0 ) 1710 1711 //write_latex_str ( " ******************* ERROR ******************* " );1712 1713 1714 1715 1707 1708 if ( @min == 0 ) 1709 { 1710 // write_latex_str ( " ******************* ERROR ******************* " ); 1711 quit; 1712 }; 1713 1714 1716 1715 if ( @min != 1) // let's norm the row... to make the '1' ! 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 //@min = 1;1733 1734 1735 1716 { 1717 @min = 1 / @min; 1718 for ( @k = @x; @k <= @v; @k++ ) 1719 { 1720 @max = leadcoef( MD[@y, @k] ); 1721 1722 if ( @max == 0) 1723 { 1724 @k ++ ; 1725 continue; // for : norming the row... 1726 }; 1727 1728 MD[@y, @k] = @max * @min; // here must be Field ... 1729 }; 1730 1731 // @min = 1; 1732 1733 }; 1734 1736 1735 // here must be @min != 0; 1737 1736 for ( @k = 1; @k <= @n; @k++ ) 1738 1739 1740 1741 1742 1743 1744 continue; 1745 1746 1747 1748 1749 1750 }; 1751 1752 1753 1737 { 1738 @max = leadcoef( MD[@k, @x] ); 1739 1740 if ( ( @k == @y) || (@max == 0) ) 1741 { 1742 @k ++ ; 1743 continue; 1744 }; 1745 1746 for ( @j = @x; @j <= @v ; @j ++ ) 1747 { 1748 MD[ @k, @j ] = MD[ @k, @j ] - @max * MD[ @y, @j ]; 1749 }; 1750 1751 }; //killing 1752 1754 1753 @x ++; 1755 1754 @y ++; 1756 1755 }; //main while. 1757 1756 /******************************************************/ 1758 1757 1759 1758 // print("Gaussed Matrix: "); 1760 1759 // print( MD ); … … 1762 1761 // computation of kernel's basis 1763 1762 1764 if ( @x <= @v ) 1763 if ( @x <= @v ) 1765 1764 { 1766 1765 for ( @k = @x; @k <= @v ; @k ++ ) 1767 1768 @nums = @nums + list ( list ( @k, @n+1 ) ); 1769 1766 { 1767 @nums = @nums + list ( list ( @k, @n+1 ) ); 1768 } 1770 1769 } 1771 1770 1772 1771 // print("Nums: " ); 1773 1772 // print (@nums); 1774 1773 1775 1774 list result = list(); 1776 1775 1777 1776 // real calculations of the Base of a Ker as V.S. 1778 1777 1779 1778 for ( @k = 1; @k <= size(@nums) ; @k ++ ) 1780 1779 { 1781 @x = @nums[@k][1]; 1782 @j = @nums[@k][2]; 1783 1780 @x = @nums[@k][1]; 1781 @j = @nums[@k][2]; 1782 1784 1783 @t = @given[@x][1]; 1785 1784 1786 1785 for ( @y = 1; @y < @j ; @y ++ ) 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1786 // for every "@x" column 1787 { 1788 @max = leadcoef( MD[@y, @x] ); 1789 if ( (@max != 0) ) 1790 { 1791 @a = @ones[@y]; 1792 @t = @t - @max * @given[@a][1]; 1793 }; 1794 }; 1795 1797 1796 result[@k] = @t; 1798 1797 }; … … 1806 1805 { 1807 1806 BCall( "reduce_one_per_row" ); 1808 1807 1809 1808 int @k; 1810 1809 int @l = size (@given); 1811 1810 1812 1811 if( @l == 0 ) 1813 1812 { 1814 1813 return (@given); 1815 1814 }; 1816 1815 1817 1816 int @char = char(basering); 1818 1817 1819 1818 intvec @marks; 1820 1819 … … 1826 1825 list @unis = list (); 1827 1826 poly p; 1828 1827 1829 1828 for ( @k = @l; @k > 0; @k -- ) 1830 1829 { … … 1833 1832 1834 1833 if( p == 0 ) 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 }; 1846 1834 { 1835 @marks[@k] = 2; 1836 } else 1837 { 1838 @marks[@k] = 1; 1839 if ( @char == 0 ) 1840 { 1841 @t = @t + p; 1842 }; 1843 }; 1844 }; 1845 1847 1846 if ( @char != 0 ) 1848 1847 { … … 1850 1849 execute( "ring NewRingWithGoodField = (0), (" + varstr(save) + "), (" + ordstr(save) + "); "); 1851 1850 poly @t = 0; 1852 1851 1853 1852 if(! defined (@unis) ) 1854 1855 1856 1857 1853 { 1854 list @unis = imap( save, @unis ); 1855 }; 1856 1858 1857 for ( @k = @l; @k > 0; @k -- ) 1859 1860 1861 1862 1863 1864 1865 }; 1866 1858 { 1859 if( @marks[@k] == 1 ) 1860 { 1861 @t = @t + @unis[@k]; 1862 }; 1863 }; 1864 }; 1865 1867 1866 int @loop_size = size(@t); 1868 1867 poly @for_delete, @tt; 1869 1868 int @ll; 1870 1869 1871 1870 while( @loop_size > 0 ) 1872 1871 { 1873 1872 @for_delete = poly(0); 1874 @ll = size(@t); 1875 1873 @ll = size(@t); 1874 1876 1875 for ( @k = @ll; @k > 0; @k -- ) 1877 1878 1879 1880 1881 1882 1876 { 1877 if ( leadcoef(@t[@k]) == 1 ) 1878 { 1879 @for_delete = @for_delete + @t[@k]; 1880 }; 1881 }; 1883 1882 1884 1883 @loop_size = size( @for_delete ); 1885 1884 1886 1885 if ( @loop_size>0 ) 1887 1888 1889 { 1890 if ( @marks[@k] == 1) 1891 1892 1893 1894 if( size( @for_delete + @tt ) != ( size( @for_delete ) + size( @tt ) ) ) 1895 1896 1897 1898 1899 1900 }; 1901 }; 1902 }; 1903 1886 { 1887 for( @k = @l ; @k > 0 ; @k -- ) 1888 { 1889 if ( @marks[@k] == 1) 1890 { 1891 @tt = @unis[@k]; 1892 1893 if( size( @for_delete + @tt ) != ( size( @for_delete ) + size( @tt ) ) ) 1894 { 1895 @t = @t - @tt; 1896 @marks[@k] = 0; 1897 }; 1898 }; 1899 }; 1900 }; 1901 }; 1902 1904 1903 if ( @char != 0 ) 1905 1904 { … … 1909 1908 1910 1909 list @reduced = list(); 1911 1910 1912 1911 for ( @k = @l ; @k>0 ; @k --) 1913 1912 { 1914 1913 if (@marks[@k]==2) 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 }; 1925 1914 { 1915 @reduced = list ( @given[@k] ) + @reduced ; 1916 } else 1917 { 1918 if (@marks[@k]==1) 1919 { 1920 @reduced = @reduced + list ( @given[@k] ); 1921 }; 1922 }; 1923 }; 1924 1926 1925 ECall( "reduce_one_per_row", "structured list" ); 1927 1926 return (@reduced); … … 1954 1953 @tt = @AD_GIVEN[@number][2]; 1955 1954 if ( size (@tt) == 0) 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 if ( size( @t + @tt ) != ( @t_size + size(@tt) ) ) 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1955 { 1956 @AD_CALC = @AD_CALC + list ( @AD_GIVEN[@number][1] ); 1957 } else 1958 { 1959 @t = uni_poly( @tt ); 1960 @t_size = size(@t); 1961 1962 @GR_TEMP = list (); 1963 @GR_TEMP[1] = @t; 1964 @GR_TEMP[2] = list ( @AD_GIVEN[@number] ); 1965 1966 @loop_size = size(@GR); 1967 if ( @loop_size == 0 ) 1968 { 1969 @GR = list(@GR_TEMP); 1970 } else 1971 { 1972 for ( @k = @loop_size; @k > 0 ; @k -- ) 1973 { 1974 @tt = @GR[@k][1]; 1975 if ( size( @t + @tt ) != ( @t_size + size(@tt) ) ) 1976 // whether @tt and @i intersencts? ( will not work in char == 2 !!!) 1977 { 1978 1979 if ( char(basering) == 0 ) 1980 { 1981 @GR_TEMP[1] = @GR_TEMP[1] + @tt; 1982 } else 1983 { 1984 @GR_TEMP[1] = uni_poly( @GR_TEMP[1] + @tt ); 1985 }; 1986 1987 @GR_TEMP[2] = @GR_TEMP[2] + @GR[@k][2]; 1988 @GR = delete ( @GR, @k ); 1989 }; 1990 }; 1991 @GR = @GR + list(@GR_TEMP); 1992 }; 1993 }; 1995 1994 @number --; 1996 1995 }; // main while 1997 1996 1998 1997 list @res; 1999 1998 … … 2001 2000 { 2002 2001 if ( size (@GR[@k][2]) > 1 ) // ! zeroes in AD_CALC so here must be non zero 2003 2004 2005 2006 2007 2008 2009 2010 2011 }; 2002 { 2003 @res = FSS ( @GR[@k][2], uni_poly(@GR[@k][1])); 2004 2005 if ( size (@res) > 0 ) 2006 { 2007 @AD_CALC = @AD_CALC + @res; 2008 }; 2009 }; 2010 }; 2012 2011 2013 2012 ECall( "calc_base" ); … … 2031 2030 2032 2031 poly f, t; 2033 2034 if ( typeof(#[1]) == "int") 2032 2033 if ( typeof(#[1]) == "int") 2035 2034 { 2036 2035 int next = #[1]; … … 2038 2037 } else 2039 2038 { 2040 if ( typeof(#[1]) == "poly") 2041 2042 2043 2044 2045 2046 2047 2039 if ( typeof(#[1]) == "poly") 2040 { 2041 f = #[1]; 2042 } else 2043 { 2044 print("Error: cannot differentiate with '" + string(#)+"'"); 2045 return (); 2046 }; 2048 2047 }; 2049 2048 … … 2069 2068 list t = reduce_one_per_row( l, 0); // optimization (a1) 2070 2069 return( QNF_list ( ApplyAd( calc_base(t), # ), 2) ); // calculation of groupps (a2) + gauss. 2071 2070 2072 2071 }; 2073 2072 … … 2077 2076 static proc makeIdeal ( list l ) 2078 2077 " 2079 2078 return: ideal: where the generators are polynomials from list, without 1 and zeroes 2080 2079 " 2081 2080 { … … 2085 2084 { 2086 2085 if ( typeof( l[i] ) == "list" ) 2087 2088 2089 2090 2091 2092 2093 2086 { 2087 p = l[i][1]; // just take the 1st polynom... 2088 } else 2089 { 2090 p = l[i]; 2091 }; 2092 2094 2093 p = cleardenom( p* (1/content(p)) ); 2095 2094 if ( (p != 1) and (p != 0) ) 2096 2097 2098 2099 }; 2100 2095 { 2096 I = I, p; 2097 }; 2098 }; 2099 2101 2100 I = simplify ( I, 2 ); // no zeroes 2102 2101 2103 2102 return(I); 2104 2103 }; … … 2116 2115 t = var(k); 2117 2116 if ( QNF_poly(t * p - p * t) != 0 ) 2118 2119 if( toprint() ) 2120 2121 2122 2123 2124 2125 }; 2126 2127 if( toprint() ) 2117 { 2118 if( toprint() ) 2119 { 2120 "POLY: ", string (p), " is NOT in center"; 2121 }; 2122 return (0); 2123 }; 2124 }; 2125 2126 if( toprint() ) 2128 2127 { 2129 2128 "POLY: ", string (p), " is in center"; … … 2137 2136 for ( int @i = 1; @i <= size(l); @i++ ) 2138 2137 { 2139 if ( typeof(l[@i])=="poly" ) 2140 2141 2142 2143 2144 2145 2146 2147 2148 if ( (typeof(l[@i])=="list") or (typeof(l[@i])=="ideal") ) 2149 2150 2151 2152 2153 2154 2155 2138 if ( typeof(l[@i])=="poly" ) 2139 { 2140 if (! inCenter_poly(l[@i]) ) 2141 { 2142 return(0); 2143 }; 2144 2145 } else 2146 { 2147 if ( (typeof(l[@i])=="list") or (typeof(l[@i])=="ideal") ) 2148 { 2149 if (! inCenter_list(l[@i]) ) 2150 { 2151 return(0); 2152 }; 2153 }; 2154 }; 2156 2155 }; 2157 2156 return(1); … … 2166 2165 { 2167 2166 if ( QNF_poly(f * p - p * f) != 0 ) 2168 { 2169 if( toprint() ) 2170 2171 2172 2167 { 2168 if( toprint() ) 2169 { 2170 "POLY: ", string (p), " is NOT in centralizer(f)"; 2171 }; 2173 2172 return (0); 2174 2173 }; 2175 2176 if( toprint() ) 2174 2175 if( toprint() ) 2177 2176 { 2178 2177 "POLY: ", string (p), " is in centralizer(f)"; … … 2186 2185 for ( int @i = 1; @i <= size(l); @i++ ) 2187 2186 { 2188 if ( typeof(l[@i])=="poly" ) 2189 2190 2191 2192 2193 2194 2195 2196 2197 if ( (typeof(l[@i])=="list") or (typeof(l[@i])=="ideal") ) 2198 2199 2200 2201 2202 2203 2204 2187 if ( typeof(l[@i])=="poly" ) 2188 { 2189 if (! inCentralizer_poly(l[@i], f) ) 2190 { 2191 return(0); 2192 }; 2193 2194 } else 2195 { 2196 if ( (typeof(l[@i])=="list") or (typeof(l[@i])=="ideal") ) 2197 { 2198 if (! inCentralizer_list(l[@i], f) ) 2199 { 2200 return(0); 2201 }; 2202 }; 2203 }; 2205 2204 }; 2206 2205 return(1); … … 2220 2219 /* static */ proc center_min_iterative( int MaxDeg, list # ) 2221 2220 " 2222 2223 2221 computes the 'minimal' set of central elements (of deg <= MaxDeg) in iterative way 2222 Note: based on calc_k_base, zAddBad, zRefine, zCancel, PBW_* 2224 2223 " 2225 2224 { 2226 2225 BCall("center_min_iterative", MaxDeg, #); 2227 2226 2228 2227 int n = myInt(#); 2229 2228 int m = ( MaxDeg < 0 ); // no bound on Degree 2230 2229 2231 2230 int MinDeg = 6; // starting guess for MaxDeg 2232 2231 int Delta = 4; // increment of MaxDeg 2233 2232 2234 2233 if( m ) 2235 { 2234 { 2236 2235 // minimal guess 2237 MaxDeg = MinDeg; 2238 }; 2239 2236 MaxDeg = MinDeg; 2237 }; 2238 2240 2239 list @q; int @i; int N = nvars(basering); 2241 2240 … … 2250 2249 list SYS = PBW_sys( my_vars(), my_var(1) ); 2251 2250 2252 2253 list @z = list (); 2254 list @l = init_bads( MaxDeg ); 2255 2251 2252 list @z = list (); // center list 2253 list @l = init_bads( MaxDeg ); // verbotten leadexps... 2254 2256 2255 @q = PBW[ index(0) ]; 2257 2256 … … 2260 2259 { 2261 2260 for ( @i = 2; @i <= N; @i ++ ) 2262 2263 2264 2261 { 2262 @q = calc_k_base (@q, my_var(@i)); 2263 }; 2265 2264 2266 2265 @q = zRefine (calc_k_base(@q)); // new center! 2267 2266 2268 2267 2269 if ( size(@q) > 0 ) 2270 2271 2272 2273 2274 { 2275 break; // found all central elements 2276 2277 2268 if ( size(@q) > 0 ) 2269 { 2270 @z = @z + @q; // computed central elements 2271 2272 if( (n > 0) and (size(@z) > n) ) 2273 { 2274 break; // found all central elements 2275 }; 2276 }; 2278 2277 2279 2278 if( k == ( MaxDeg+1 ) ) 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 @l = init_bads( MaxDeg ); 2290 2291 2292 2293 2294 2295 if ( size(@q) > 0 ) 2296 2297 2298 2299 2300 2279 { 2280 if( (n == 0) and ( !m ) ) 2281 { 2282 break; // that's all 2283 }; 2284 2285 MaxDeg = MaxDeg + Delta; 2286 2287 // renew bad list 2288 @l = init_bads( MaxDeg ); 2289 @l = zAddBad( @l, @z, MaxDeg, 0 ); 2290 2291 } else 2292 { 2293 2294 if ( size(@q) > 0 ) 2295 { 2296 @l = zAddBad( @l, @q, MaxDeg, 0 ); // add all possible 'leadexps' ! 2297 }; 2298 2299 }; 2301 2300 2302 2301 PBW[index(k)] = PBW_next( PBW, k, SYS ); … … 2318 2317 static proc center_vectorspace( int MaxDeg ) 2319 2318 " 2320 2319 pure calculation of center as a finitely dimensional Vector Space (deg <= MaxDeg ) 2321 2320 " 2322 2321 { 2323 2322 my_var_init(); 2324 2323 2325 2324 int N = nvars( basering ); 2326 list P = PBW_base( MaxDeg, my_var(1) ); 2327 2325 list P = PBW_base( MaxDeg, my_var(1) ); 2326 2328 2327 for( int v = 2; v <= N; v++ ) 2329 2328 { … … 2332 2331 2333 2332 my_var_done(); 2334 2333 2335 2334 return( calc_k_base ( P ) ); 2336 2335 }; … … 2339 2338 /* static */ proc center_min_vectorspace( int MaxDeg ) 2340 2339 " 2341 computes the 'minimal' set of central elements (of deg <= MaxDeg) 2340 computes the 'minimal' set of central elements (of deg <= MaxDeg) 2342 2341 by reducing the set of it's generators as vector space 2343 2342 2344 2343 Note: based on center_vectorspace. 2345 2344 Note: reduction by zReduce. … … 2381 2380 computes the 'minimal' set of elements (of deg <= MaxDeg) generating centralizer of p in iterative way 2382 2381 Note: based on calc_k_base 2383 2382 2384 2383 !!! NEED DEBUG !!! 2385 2384 Note: no proof that it is really centralizer and moreover 'minimal' centralizer … … 2390 2389 int n = myInt(#); 2391 2390 int m = (MaxDeg < 0); 2392 2391 2393 2392 int MinDeg = 6; // starting guess for MaxDeg 2394 2393 int Delta = 4; // increment of MaxDeg 2395 2394 2396 2395 if( m ) 2397 2396 { … … 2411 2410 list @z = list (); // result list 2412 2411 list @l = init_bads( MaxDeg ); // verbotten loeadexps... 2413 2412 2414 2413 @q = PBW[ index(0) ]; 2415 2414 2416 2415 for (int k = 1; k <= ( MaxDeg+1 ); k ++ ) 2417 2416 { 2418 @q = zRefine( calc_k_base(@q), 1 ); 2419 2420 if ( size(@q) > 0 ) 2421 2422 2423 2424 2425 2426 2427 2428 2417 @q = zRefine( calc_k_base(@q), 1 ); 2418 2419 if ( size(@q) > 0 ) 2420 { 2421 @z = @z + @q; // computed desired elements 2422 2423 if( (n > 0) and (size(@z) > n) ) 2424 { 2425 break; // found needed elements 2426 }; 2427 }; 2429 2428 2430 2429 if( k == ( MaxDeg+1 ) ) 2431 2432 2433 2434 2435 }; 2436 2437 2438 2439 2440 @l = init_bads( MaxDeg ); 2441 2442 2443 2444 2445 2446 if ( size(@q) > 0 ) 2447 2448 2449 2450 2451 2452 2430 { 2431 if( (n == 0) or ( !m ) ) 2432 { 2433 break; // that's all 2434 }; 2435 2436 MaxDeg = MaxDeg + Delta; 2437 2438 // renew bad list 2439 @l = init_bads( MaxDeg ); 2440 @l = zAddBad( @l, @z, MaxDeg, 0 ); 2441 2442 } else 2443 { 2444 2445 if ( size(@q) > 0 ) 2446 { 2447 @l = zAddBad( @l, @q, MaxDeg, 0 ); // add all possible 'leadexps' ! 2448 }; 2449 2450 }; 2451 2453 2452 PBW[index(k)] = PBW_next( PBW, k, SYS ); 2454 2453 PBW_PLAIN = PBW_PLAIN + zCancel( PBW[index(k-1)] , @l ); … … 2475 2474 QNF_init(); 2476 2475 def res; 2477 2476 2478 2477 if ( typeof(a) == "poly" ) 2479 2478 { … … 2481 2480 } else 2482 2481 { 2483 2484 2485 2486 } else 2487 2488 2489 2482 if ( (typeof(a)=="list") or (typeof(a)=="ideal") ) 2483 { 2484 res = inCenter_list(a); 2485 } else 2486 { 2487 res = a; 2488 }; 2490 2489 }; 2491 2490 2492 2491 QNF_done(); 2493 2492 return (res); … … 2513 2512 2514 2513 2515 /******************************************************************************/ 2514 /******************************************************************************/ 2516 2515 proc inCentralizer( def a, poly f ) 2517 2516 "USAGE: inCentralizer(a, f); a poly/list/ideal, f poly … … 2524 2523 if ( typeof(a) == "poly" ) 2525 2524 { 2526 res = inCentralizer_poly(a, f); 2525 res = inCentralizer_poly(a, f); 2527 2526 } else 2528 2527 { 2529 2530 2531 res = inCentralizer_list(a, f); 2532 2533 2534 2535 2528 if ( (typeof(a)=="list") or (typeof(a)=="ideal") ) 2529 { 2530 res = inCentralizer_list(a, f); 2531 } else 2532 { 2533 res = a; 2534 }; 2536 2535 }; 2537 2536 … … 2583 2582 print( "Error: wrong arguments." ); 2584 2583 return(); 2585 2584 2586 2585 } 2587 2586 example … … 2595 2594 ideal Z = center(2); // find all central elements of degree <= 2 2596 2595 Z; 2597 inCenter(Z); 2596 inCenter(Z); 2598 2597 ideal ZZ = center(-1, 1 ); // find the first non trivial central element 2599 2598 ZZ; ""; … … 2614 2613 EXAMPLE: example centralizer; shows an example" 2615 2614 { 2616 2615 2617 2616 if( myInt(#) > 0 ) 2618 2617 { 2619 2618 return( centralizer_min_iterative( p, MaxDeg, # ) ); 2620 2619 }; 2621 2620 2622 2621 if( MaxDeg >= 0 ) 2623 2622 { … … 2625 2624 return( centralizer_min_vectorspace( p, MaxDeg ) ); 2626 2625 }; 2627 2626 2628 2627 print( "Error: wrong arguments." ); 2629 2628 return(); … … 2642 2641 ideal c = centralizer(f, 2); // find all elements of degree <= 2 which lies in centralizer of f 2643 2642 c; 2644 inCentralizer(c, f); 2643 inCentralizer(c, f); 2645 2644 ideal cc = centralizer(f, -1, 2 ); // find at least first two non trivial elements of the centralizer of f 2646 2645 cc; 2647 inCentralizer(cc, f); 2646 inCentralizer(cc, f); 2648 2647 poly g = z^2-2*z; // any polynomial 2649 2648 g; ""; 2650 2649 c = centralizer(g, 2); // find all elements of degree <= 2 which lies in centralizer of g 2651 2650 c; ""; 2652 inCentralizer(c, g); 2651 inCentralizer(c, g); 2653 2652 cc = centralizer(g, -1, 2 ); // find at least first two non trivial elements of the centralizer of g 2654 2653 cc; ""; 2655 inCentralizer(cc, g); 2656 }; 2654 inCentralizer(cc, g); 2655 }; -
Singular/LIB/classify.lib
re6fb531 r3c4dcc 1 1 // KK,GMG last modified: 17.12.00 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version = "$Id: classify.lib,v 1. 49 2001-08-27 14:47:48 SingularExp $";3 version = "$Id: classify.lib,v 1.50 2005-05-06 14:38:10 hannes Exp $"; 4 4 category="Singularities"; 5 5 info=" … … 1646 1646 debug_log(6,"Koeffizient von x(" + string(RFlg[i]) + ")^2 ist:", a); 1647 1647 if( (a != 0) || (i==n) ) 1648 1648 { 1649 1649 debug_log(6, "BREAK!!!!!!!!!!!!!!"); 1650 1650 break; … … 1654 1654 B = maxideal(1); 1655 1655 for( k=1; k<=n ; k=k+1) 1656 1656 { 1657 1657 if(k==RFlg[j]) { B[rvar(x(k))] = x(k) + x(RFlg[i]); } 1658 1658 } … … 1672 1672 string(P)); 1673 1673 if(P != 0) 1674 1674 { 1675 1675 debug_log(6, "1 Koeffizient von x("+string(RFlg[i])+") ist: ", 1676 1676 string(P)); … … 1688 1688 P = Coeff(fc, x(RFlg[i]), x(RFlg[i])); 1689 1689 if( P != 0) 1690 1690 { 1691 1691 fi = fc; 1692 1692 continue; -
Singular/LIB/control.lib
re6fb531 r3c4dcc 1 version="$Id: control.lib,v 1.3 0 2005-05-06 09:41:58 SingularExp $";1 version="$Id: control.lib,v 1.31 2005-05-06 14:38:12 hannes Exp $"; 2 2 category="System and Control Theory"; 3 3 info=" … … 35 35 "; 36 36 37 LIB "homolog.lib"; 37 LIB "homolog.lib"; 38 38 LIB "poly.lib"; 39 39 LIB "primdec.lib"; … … 74 74 RETURN: no return value 75 75 PURPOSE: procedure for (well-) formatted output of modules, matrices, lists of modules, matrices; shows everything even if entries are long 76 NOTE: in case of other types( not 'module', 'matrix', 'list') works just as standard 'print' procedure 76 NOTE: in case of other types( not 'module', 'matrix', 'list') works just as standard 'print' procedure 77 77 EXAMPLE: example view; shows an example 78 78 "{ … … 88 88 int max; 89 89 string s; 90 90 91 91 for(i=1;i<=@C;i++) 92 { 93 max=0; 94 92 { 93 max=0; 94 95 95 for(j=1;j<=@R;j++) 96 96 { … … 103 103 MaxLength[i] = max; 104 104 }; 105 105 106 106 for(i=1;i<=@R;i++) 107 107 { … … 111 111 s=s+string(M[i,j])+space( MaxLength[j]-size( string( M[i,j] ) ) ) +","; 112 112 }; 113 113 114 114 s=s+string(M[i,j])+space( MaxLength[j]-size( string( M[i,j] ) ) ); 115 115 … … 121 121 }; 122 122 123 return(); 123 return(); 124 124 }; 125 125 126 126 if(typeof(M)=="list") 127 127 { … … 132 132 view(M[i]); 133 133 print(""); 134 }; 134 }; 135 135 136 136 return(); … … 152 152 RETURN: module 153 153 EXAMPLE: example RightKernel; shows an example 154 "{ 154 "{ 155 155 return(modulo(M,std(0))); 156 156 } … … 215 215 } 216 216 example 217 { 217 { 218 218 "EXAMPLE:";echo =2; 219 219 // a trivial example: … … 221 221 matrix M[2][1] = 1,x2z; 222 222 print(M); 223 print( LeftInverse(M) ); 223 print( LeftInverse(M) ); 224 224 kill r; 225 225 // derived from the example TwoPendula: … … 252 252 matrix M[1][2] = 1,x2+z; 253 253 print(M); 254 print( RightInverse(M) ); 254 print( RightInverse(M) ); 255 255 kill r; 256 256 // derived from the TwoPendula example: … … 307 307 }; 308 308 //------------------------------------------------------------------------ 309 static proc control_output(int i, int NVars, module R, module Ext_1, list Gen) 310 "USAGE: control_output(i, NVars, R, Ext_1), 309 static proc control_output(int i, int NVars, module R, module Ext_1, list Gen) 310 "USAGE: control_output(i, NVars, R, Ext_1), 311 311 PURPOSE: where 312 312 @* i is integer (number of first nonzero Ext or a number of variables in a basering + 1 in case that all the Exts are zero), 313 @* 314 @* 315 @* Ext_1: module, the first Ext(its cokernel representation)313 @* NVars: integer, number of variables in a base ring, 314 @* R: module R (cokernel representation), 315 @* Ext_1: module, the first Ext(its cokernel representation) 316 316 RETURN: list with all the contollability properties of the system which is to be returned in 'control' procedure 317 317 NOTE: this procedure is used in 'control' procedure … … 323 323 string Gen_mes = "Parameter constellations which might lead to a non-controllable system:"; 324 324 325 module RK = RightKernel(R); 325 module RK = RightKernel(R); 326 326 int d=dim_Our(std(transpose(R))); 327 327 328 328 if (i==1) 329 { 330 return( 329 { 330 return( 331 331 list ( Fn, 332 333 334 RK,335 336 337 338 339 340 341 342 343 ) 332 i, 333 "not controllable , image representation for controllable part:", 334 RK, 335 "kernel representation for controllable part:", 336 LeftKernel( RK ), 337 "obstruction to controllability", 338 Ext_1, 339 "annihilator of torsion module (of obstruction to controllability)", 340 Ann_Our(Ext_1), 341 DofS, 342 d 343 ) 344 344 ); 345 345 }; 346 346 347 347 if(i>NVars) 348 { 348 { 349 349 return( list( Fn, 350 -1, 350 -1, 351 351 "strongly controllable(flat), image representation:", 352 353 354 355 356 357 358 Gen) 352 RK, 353 "left inverse to image representation:", 354 LeftInverse(RK), 355 DofS, 356 d, 357 Gen_mes, 358 Gen) 359 359 ); 360 360 }; 361 361 362 362 // 363 363 //now i<=NVars 364 364 // 365 365 366 366 if( (i==2) ) 367 367 { 368 368 return( list( Fn, 369 i, 369 i, 370 370 "controllable, not reflexive, image representation:", 371 371 RK, 372 372 DofS, 373 373 d, 374 375 Gen) 376 ); 374 Gen_mes, 375 Gen) 376 ); 377 377 }; 378 378 379 379 if( (i>=3) ) 380 380 { 381 381 return( list ( Fn, 382 i, 382 i, 383 383 "reflexive, not strongly controllable, image representation:", 384 385 386 387 388 Gen) 384 RK, 385 DofS, 386 d, 387 Gen_mes, 388 Gen) 389 389 ); 390 }; 391 }; 390 }; 391 }; 392 392 //------------------------------------------------------------------------- 393 393 … … 400 400 { 401 401 int i; 402 int NVars=nvars(basering); 402 int NVars=nvars(basering); 403 403 // TODO: NVars to be replaced with the global hom. dimension of basering!!! 404 404 int ExtIsZero; … … 406 406 module R_std=std(R); 407 407 module Ext_1 = std(Ext_Our(1,R_std)); 408 408 409 409 ExtIsZero=is_zero_Our(Ext_1); 410 410 i=1; … … 421 421 } 422 422 example 423 {"EXAMPLE:";echo = 2; 423 {"EXAMPLE:";echo = 2; 424 424 // a WindTunnel example 425 425 ring A = (0,a, omega, zeta, k),(D1, delta),dp; … … 444 444 { 445 445 return ("control2 cannot be applied, since R does not have full row rank"); 446 } 446 } 447 447 intvec v=Opt_Our(); 448 448 module R_std=std(R); … … 457 457 } 458 458 example 459 {"EXAMPLE:";echo = 2; 459 {"EXAMPLE:";echo = 2; 460 460 //a WindTunnel example 461 461 ring A = (0,a, omega, zeta, k),(D1, delta),dp; … … 489 489 [-D(2),D(1),0]; 490 490 R=transpose(R); 491 colrank(R); 492 }; 493 491 colrank(R); 492 }; 493 494 494 //------------------------------------------------------------------------ 495 static proc autonom_output( int i, int NVars, module RC, int R_rank ) 495 static proc autonom_output( int i, int NVars, module RC, int R_rank ) 496 496 "USAGE: proc autonom_output(i, NVars, RC, R_rank) 497 i: integer, number of first nonzero Ext or 498 499 NVars: integer, number of variables in a base ring 500 501 497 i: integer, number of first nonzero Ext or 498 just number of variables in a base ring + 1 in case that all the Exts are zero 499 NVars: integer, number of variables in a base ring 500 RC: module, kernel-representation of controllable part of the system 501 R_rank: integer, column rank of the representation matrix 502 502 PURPOSE: compute all the autonomy properties of the system which is to be returned in 'autonom' procedure 503 RETURN: list 503 RETURN: list 504 504 NOTE: this procedure is used in 'autonom' procedure 505 505 " … … 509 509 string Fn = "number of first nonzero Ext:"; 510 510 if(i==0) 511 { 511 { 512 512 return( list( Fn, 513 513 i, 514 514 "not autonomous", 515 516 517 518 519 520 d ) 521 515 "kernel representation for controllable part", 516 RC, 517 "column rank of the matrix", 518 R_rank, 519 DofS, 520 d ) 521 ); 522 522 }; 523 523 524 524 if( i>NVars ) 525 { 525 { 526 526 return( list( Fn, 527 527 -1, 528 528 "trivial", 529 530 d ) 529 DofS, 530 d ) 531 531 ); 532 532 }; 533 533 534 534 // 535 535 //now i<=NVars 536 536 // 537 538 537 538 539 539 if( i==1 ) 540 540 // in case that NVars==1 there is no sense to consider the notion 541 // of strongly autonomous behavior, because it does not imply 541 // of strongly autonomous behavior, because it does not imply 542 542 // that system is overdetermined in this case 543 543 { 544 544 return( list ( Fn, 545 i, 545 i, 546 546 "autonomous, not overdetermined", 547 548 d ) 549 ); 547 DofS, 548 d ) 549 ); 550 550 }; 551 551 552 552 if( i==NVars ) 553 { 553 { 554 554 return( list( Fn, 555 555 i, 556 556 "strongly autonomous(fin. dimensional),in particular overdetermined", 557 558 d) 559 557 DofS, 558 d) 559 ); 560 560 }; 561 561 562 562 if( i<NVars ) 563 563 { … … 565 565 i, 566 566 "overdetermined, not strongly autonomous", 567 DofS, 568 d) 567 DofS, 568 d) 569 569 ); 570 570 }; 571 }; 571 }; 572 572 //-------------------------------------------------------------------------- 573 573 proc autonom2(module R) … … 578 578 EXAMPLE: example autonom2; shows an example 579 579 " 580 { 580 { 581 581 int d; 582 582 int NVars = nvars(basering); … … 584 584 module RC; //for computation of controllable part if if exists 585 585 int R_rank = ncols(R); 586 d = dim_Our( std(RT) ); //this is the dimension of the system 586 d = dim_Our( std(RT) ); //this is the dimension of the system 587 587 int i = NVars-d; //First non-zero Ext 588 588 if( d==0 ) … … 599 599 module R= [s1,-s2], 600 600 [s2, s1], 601 602 [s4, s3]; 601 [s3,-s4], 602 [s4, s3]; 603 603 R=transpose(R); 604 604 view( R ); 605 605 view( autonom2(R) ); 606 }; 606 }; 607 607 //---------------------------------------------------------- 608 608 proc autonom(module R) … … 618 618 module RC; 619 619 int R_rank=ncols(R); 620 ExtIsZero=is_zero_Our(Ext_Our(0,RT)); 620 ExtIsZero=is_zero_Our(Ext_Our(0,RT)); 621 621 int i=0; 622 622 while( (ExtIsZero)&&(i<=NVars) ) … … 638 638 module R= [s1,-s2], 639 639 [s2, s1], 640 641 [s4, s3]; 640 [s3,-s4], 641 [s4, s3]; 642 642 R=transpose(R); 643 643 view( R ); 644 644 view( autonom(R) ); 645 }; 645 }; 646 646 647 647 … … 650 650 "USAGE: genericity(M), M is a matrix/module 651 651 PURPOSE: determine parametric expressions which have been assumed to be non-zero in the process of computing the Groebner basis 652 RETURN: list (of strings) 653 NOTE: we strongly recommend to switch on the redSB and redTail options; 652 RETURN: list (of strings) 653 NOTE: we strongly recommend to switch on the redSB and redTail options; 654 654 @* the procedure is effective with the lift procedure for modules with parameters 655 655 EXAMPLE: example genericity; shows an example … … 672 672 "EXAMPLE:"; echo = 2; 673 673 ring r=(0,m1,m2,M,g,L1,L2),Dt,dp; 674 module RR = 675 [m1*L1*Dt^2, m2*L2*Dt^2, -1, (M+m1+m2)*Dt^2], 674 module RR = 675 [m1*L1*Dt^2, m2*L2*Dt^2, -1, (M+m1+m2)*Dt^2], 676 676 [m1*L1^2*Dt^2-m1*L1*g, 0, 0, m1*L1*Dt^2], 677 677 [0, m2*L2^2*Dt^2-m2*L2*g, 0, m2*L2*Dt^2]; … … 730 730 cl++; 731 731 p = p - lead(p); // for the next cycle 732 } 732 } 733 733 if ( p!= 0) 734 734 { … … 782 782 for (j=1; j<=size(F);j++) 783 783 { 784 785 786 787 788 789 784 q = F[j]-lead(F[j]); 785 if (q!=0) 786 { 787 @L[cl] = F[j]; 788 cl++; 789 } 790 790 } 791 791 } … … 814 814 { 815 815 p = I[i]; 816 while (p !=0) 817 { 818 Den = Den, denominator(leadcoef(p)); 819 p = p-lead(p); 820 } 821 } 822 Den = simplify(Den,2+4); 816 while (p !=0) 817 { 818 Den = Den, denominator(leadcoef(p)); 819 p = p-lead(p); 820 } 821 } 822 Den = simplify(Den,2+4); 823 823 string newvars = parstr(basering); 824 824 def save = basering; … … 830 830 int s1 = size(Den); 831 831 for (i=1; i<=s1; i++) 832 { 832 { 833 833 if (Den[i] !=1) 834 { 835 F= F, factorize(Den[i],1); 836 } 837 } 838 F = simplify(F, 2+4+8); 834 { 835 F= F, factorize(Den[i],1); 836 } 837 } 838 F = simplify(F, 2+4+8); 839 839 ideal @L = F; 840 840 list SL; … … 871 871 "USAGE: canonize(L), L a list 872 872 PURPOSE: modules in the list are canonized by computing their reduced minimal (= unique up to constant factor w.r.t. the given ordering) Groebner bases 873 RETURN: list 873 RETURN: list 874 874 ASSUME: L is the output of control/autonomy procedures 875 875 EXAMPLE: example canonize; shows an example … … 896 896 "EXAMPLE:"; echo = 2; 897 897 ring r=(0,m1,m2,M,g,L),Dt,dp; 898 module RR = 899 [m1*L*Dt^2, m2*L*Dt^2, -1, (M+m1+m2)*Dt^2], 898 module RR = 899 [m1*L*Dt^2, m2*L*Dt^2, -1, (M+m1+m2)*Dt^2], 900 900 [m1*L^2*Dt^2-m1*L*g, 0, 0, m1*L*Dt^2], 901 901 [0, m2*L^2*Dt^2-m2*L*g, 0, m2*L*Dt^2]; … … 914 914 { 915 915 if(v[j]==i) 916 917 918 919 916 { 917 b=1; 918 return (b); 919 } 920 920 } 921 921 return (b); … … 923 923 //----------------------------------------------------------------- 924 924 proc iostruct(module R) 925 "USAGE: iostruct( R ); R a module 925 "USAGE: iostruct( R ); R a module 926 926 RETURN: list L with entries: string s, intvec v, module P and module Q 927 927 PURPOSE: if R is the kernel-representation-matrix of some system, then we output a input-ouput representation Py=Qu of the system, the components that have been chosen as outputs(intvec v) and a comment s … … 941 941 module Q; 942 942 int n=0; 943 943 944 944 while(b==1) //sort v through bubblesort 945 945 { 946 946 b=0; 947 947 for(i=1;i<NRows;i++) 948 949 950 951 952 953 954 955 956 957 } 958 P=R[v]; //generate P 948 { 949 if(v[i]>v[i+1]) 950 { 951 temp=v[i]; 952 v[i]=v[i+1]; 953 v[i+1]=temp; 954 b=1; 955 } 956 } 957 } 958 P=R[v]; //generate P 959 959 for(i=1;i<=NCols;i++) //generate Q 960 960 { 961 961 if(elementof(i,v)==1) 962 963 964 965 962 { 963 i++; 964 continue; 965 } 966 966 Q=Q,R[i]; 967 967 } … … 975 975 ring r = (0, K1, K2, Te, Kp, Kc),(Dt, delta), (c,dp); 976 976 module RR; 977 RR = 977 RR = 978 978 [Dt, -K1, 0, 0, 0, 0, 0, 0, 0], 979 979 [0, Dt+K2/Te, 0, 0, 0, 0, -Kp/Te*delta, -Kc/Te*delta, -Kc/Te*delta], … … 984 984 module R = transpose(RR); 985 985 view(iostruct(R)); 986 }; 986 }; 987 987 988 988 //--------------------------------------------------------------- 989 static proc smdeg(matrix N) 990 "USAGE: smdeg( N ); N a matrix 989 static proc smdeg(matrix N) 990 "USAGE: smdeg( N ); N a matrix 991 991 RETURN: intvec 992 992 PURPOSE: returns an intvec of length 2 with the index of an element of N with smallest degree … … 999 999 int i,j; // counter 1000 1000 1001 if (N==0) 1001 if (N==0) 1002 1002 { 1003 1003 v = 1,1; 1004 1004 return(v); 1005 } 1006 1007 for (i=1; i<=n; i++) 1005 } 1006 1007 for (i=1; i<=n; i++) 1008 1008 // hier wird ein Element ausgewaehlt(!=0) und mit dessen Grad gestartet 1009 1009 { … … 1012 1012 if( deg(N[i,j])!=-1 ) 1013 1013 { 1014 1015 1014 d=deg(N[i,j]); 1015 break; 1016 1016 } 1017 1017 } … … 1019 1019 { 1020 1020 break; 1021 } 1021 } 1022 1022 } 1023 1023 for(i=1; i<=n; i++) … … 1028 1028 if ( (d_temp < d) && (N[i,j]!=0) ) 1029 1029 { 1030 1030 d=d_temp; 1031 1031 } 1032 1032 } … … 1038 1038 if ( (deg(N[i,j]) == d) && (N[i,j]!=0) ) 1039 1039 { 1040 1041 1040 v = i,j; 1041 return(v); 1042 1042 } 1043 1043 } … … 1076 1076 J = p,q; // J = N[k-1,k-1],N[k,k]; //J is of type ideal 1077 1077 L[1] = liftstd(J,T); //T is of type matrix 1078 if(J[1]==p) //this is just for the case the SINGULAR swaps the 1078 if(J[1]==p) //this is just for the case the SINGULAR swaps the 1079 1079 // two elements due to ordering 1080 { 1081 L[2] = T[1,1]; 1082 L[3] = T[2,1]; 1080 { 1081 L[2] = T[1,1]; 1082 L[3] = T[2,1]; 1083 1083 } 1084 1084 else 1085 { 1086 L[2] = T[2,1]; 1087 L[3] = T[1,1]; 1085 { 1086 L[2] = T[2,1]; 1087 L[3] = T[1,1]; 1088 1088 } 1089 1089 } 1090 1090 else 1091 1091 { 1092 L=extgcd(p,q); 1093 // L=extgcd(N[k-1,k-1],N[k,k]); 1092 L=extgcd(p,q); 1093 // L=extgcd(N[k-1,k-1],N[k,k]); 1094 1094 //one can use this line if extgcd-bug is fixed 1095 1095 } … … 1100 1100 PURPOSE: normalizes N and divides the columns of Q through the leading coefficients of the columns of N 1101 1101 RETURN: normalized matrix N and altered Q(according to the scheme mentioned in purpose). If number of columns of N and Q do not coincide, N and Q are returned unchanged 1102 NOTE: number of columns of N and Q must coincide. 1102 NOTE: number of columns of N and Q must coincide. 1103 1103 " 1104 1104 { … … 1106 1106 { 1107 1107 return (N,Q); 1108 } 1108 } 1109 1109 module M = module(N); 1110 1110 module S = module(Q); … … 1123 1123 Q = matrix(S); 1124 1124 return (N,Q); 1125 } 1126 1125 } 1126 1127 1127 //--------------------------------------------------------------- 1128 1128 proc smith( module M ) … … 1130 1130 PURPOSE: computes the Smith form of a matrix 1131 1131 RETURN: a list of length 4 with the following entries: 1132 @* [1]: The Smith-Form S of M, 1133 @* [2]: the rank of M, 1132 @* [1]: The Smith-Form S of M, 1133 @* [2]: the rank of M, 1134 1134 @* [3]: a unimodular matrix U, 1135 @* [4]: a unimodular matrix V, 1136 such that U*M*V=S. An warning is returned when no Smith Form exists. 1135 @* [4]: a unimodular matrix V, 1136 such that U*M*V=S. An warning is returned when no Smith Form exists. 1137 1137 NOTE: The Smith form only exists over PIDs (principal ideal domains). Use global ordering for computations! 1138 1138 " … … 1157 1157 matrix mu[1][m]; //to save leadcoefficients 1158 1158 int ii; //counter 1159 1160 while ((k!=n) && (k!=m) ) 1159 1160 while ((k!=n) && (k!=m) ) 1161 1161 { 1162 1162 k++; … … 1165 1165 while(k<=m ) //inner while-loop for row-operations 1166 1166 { 1167 1168 { 1169 1170 1171 1172 1173 1167 if( (n>m) && (k < n) && (k<m)) 1168 { 1169 if( simplify((ideal(submat(N,k+1..n,k+1..m))),2)== 0) 1170 { 1171 return(N,k-1,P,Q); 1172 } 1173 } 1174 1174 i,j = smdeg(submat(N,k..n,k..m)); //choose smallest degree in the remaining submatrix 1175 1175 i=i+(k-1); //indices adjusted to the whole matrix 1176 1177 1176 j=j+(k-1); 1177 if(i!=k) //take the element with smallest degree in the first position 1178 1178 { 1179 1179 N=permrow(N,i,k); … … 1193 1193 for(ii=k+1;ii<=n;ii++) 1194 1194 { 1195 lambda[1,ii]=leadcoef(N[ii,k])/tmp; 1195 lambda[1,ii]=leadcoef(N[ii,k])/tmp; 1196 1196 f[1,ii]=deg(N[ii,k])-deg_temp; 1197 1197 } 1198 1198 for(ii=k+1;ii<=n;ii++) 1199 1199 { 1200 N = addrow(N,k,-lambda[1,ii]*var(1)^f[1,ii],ii); 1200 N = addrow(N,k,-lambda[1,ii]*var(1)^f[1,ii],ii); 1201 1201 P = addrow(P,k,-lambda[1,ii]*var(1)^f[1,ii],ii); 1202 1203 1202 N,Q=normalize_Our(N,Q); 1203 } 1204 1204 } 1205 1205 if (k>n) 1206 1206 { 1207 1207 break; 1208 1208 } 1209 1209 if(NoNon0Pol(transpose(N)[k])==1) … … 1213 1213 tmp=leadcoef(N[k,k]); 1214 1214 deg_temp=ord(N[k,k]); //ord outputs the leading degree of N[k][k] 1215 1215 1216 1216 for(ii=k+1;ii<=m;ii++) 1217 1217 { 1218 mu[1,ii]=leadcoef(N[k,ii])/tmp; 1218 mu[1,ii]=leadcoef(N[k,ii])/tmp; 1219 1219 g[1,ii]=deg(N[k,ii])-deg_temp; 1220 1220 } … … 1223 1223 N=addcol(N,k,-mu[1,ii]*var(1)^g[1,ii],ii); 1224 1224 Q=addcol(Q,k,-mu[1,ii]*var(1)^g[1,ii],ii); 1225 1225 N,Q=normalize_Our(N,Q); 1226 1226 } 1227 1227 } 1228 1228 if( (k!=1) && (k<n) && (k<m) ) 1229 1229 { 1230 L = extgcd_Our(N[k-1,k-1],N[k,k]); 1230 L = extgcd_Our(N[k-1,k-1],N[k,k]); 1231 1231 if ( N[k-1,k-1]!=L[1] ) //means that N[k-1,k-1] is not a divisor of N[k,k] 1232 1232 { 1233 1234 1235 N,Q=normalize_Our(N,Q); 1236 1233 N=addrow(N,k-1,L[2],k); 1234 P=addrow(P,k-1,L[2],k); 1235 N,Q=normalize_Our(N,Q); 1236 1237 1237 N=addcol(N,k,-L[3],k-1); 1238 1239 1240 1238 Q=addcol(Q,k,-L[3],k-1); 1239 N,Q=normalize_Our(N,Q); 1240 k=k-2; 1241 1241 } 1242 1242 } 1243 } 1243 } 1244 1244 if( (k<=n) && (k<=m) ) 1245 1245 { … … 1276 1276 static proc list_tex(L, string name,link l,int nr_loop) 1277 1277 "USAGE: list_tex(L,name,l), where L is a list, name a string, l a link 1278 1278 writes the content of list L in a tex-file 'name' 1279 1279 RETURN: nothing 1280 1280 " … … 1284 1284 texobj(name,L); 1285 1285 } 1286 if(size(L)==0) 1286 if(size(L)==0) 1287 1287 { 1288 1288 } … … 1294 1294 while(1) 1295 1295 { 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1296 if(typeof(L[i])=="string") //Fehler hier fuer normalen output->nur wenn string in liste dann verbatim 1297 { 1298 t=L[i]; 1299 if(nr_loop==1) 1300 { 1301 write(l,"\\begin\{center\}"); 1302 write(l,"\\begin\{verbatim\}"); 1303 } 1304 write(l,t); 1305 if(nr_loop==0) 1306 { 1307 write(l,"\\par"); 1308 } 1309 if(nr_loop==1) 1310 { 1311 write(l,"\\end\{verbatim\}"); 1312 write(l,"\\end\{center\}"); 1313 } 1314 break; 1315 } 1316 if(typeof(L[i])=="module") 1317 { 1318 texobj(name,matrix(L[i])); 1319 break; 1320 } 1321 if(typeof(L[i])=="list") 1322 { 1323 list_tex(L[i],name,l,1); 1324 break; 1325 } 1326 write(l,"\\begin\{center\}"); 1327 texobj(name,L[i]); 1328 write(l,"\\end\{center\}"); 1329 write(l,"\\par"); 1330 break; 1331 1331 } 1332 1332 } … … 1341 1341 "USAGE: verbatim_tex(s,l), where s is a string and l a link 1342 1342 PURPOSE: writes the content of s in verbatim-environment in the file 1343 1343 specified by link 1344 1344 RETURN: nothing 1345 1345 " … … 1405 1405 @* To use ab example, one has to do the following. Suppose one calls the ring, where the example will be activated, A. Then, by executing 1406 1406 @* @code{def A = ControlExample(\"Antenna\");} and @code{setring A;}, 1407 @* A will become a basering from the example \"Antenna\" with 1407 @* A will become a basering from the example \"Antenna\" with 1408 1408 the predefined system module R (transposed). 1409 After that one can just execute @code{control(R);} respectively 1409 After that one can just execute @code{control(R);} respectively 1410 1410 @code{autonom(R);} to perform the control resp. autonomy analysis of R. 1411 1411 EXAMPLE: example ControlExample; shows an example … … 1469 1469 R=transpose(R); 1470 1470 export R; 1471 return(@r); 1471 return(@r); 1472 1472 }; 1473 1473 //---------------------------------------------------------- … … 1477 1477 module R= [s1,-s2], 1478 1478 [s2, s1], 1479 1480 [s4, s3]; 1479 [s3,-s4], 1480 [s4, s3]; 1481 1481 R=transpose(R); 1482 1482 export R; 1483 return(@r); 1484 }; 1483 return(@r); 1484 }; 1485 1485 //---------------------------------------------------------- 1486 1486 static proc exZerz1() 1487 { 1487 { 1488 1488 ring @r=0,(d1,d2),dp; 1489 1489 module R=[d1^2-d2], … … 1491 1491 R=transpose(R); 1492 1492 export R; 1493 return(@r); 1494 }; 1493 return(@r); 1494 }; 1495 1495 //---------------------------------------------------------- 1496 1496 //control … … 1501 1501 module R=[0,-s3,s2], 1502 1502 [s3,0,-s1]; 1503 R=transpose(R); 1503 R=transpose(R); 1504 1504 export R; 1505 1505 return(@r); … … 1507 1507 //---------------------------------------------------------- 1508 1508 static proc exControl2() 1509 { 1509 { 1510 1510 ring @r=0,(s1,s2,s3),dp; 1511 1511 module R=[0,-s3,s2], 1512 1512 [s3,0,-s1], 1513 1513 [-s2,s1,0]; 1514 R=transpose(R); 1514 R=transpose(R); 1515 1515 export R; 1516 return(@r); 1516 return(@r); 1517 1517 }; 1518 1518 //---------------------------------------------------------- … … 1530 1530 R=transpose(R); 1531 1531 export R; 1532 return(@r); 1532 return(@r); 1533 1533 }; 1534 1534 … … 1540 1540 module R = 1541 1541 [D(2)^2+D(3)^2-D(4)^2, D(1)^2, D(1)^2, -D(1)^2, -2*D(1)*D(2), 0, 0, -2*D(1)*D(3), 0, 2*D(1)*D(4)], 1542 [D(2)^2, D(1)^2+D(3)^2-D(4)^2, D(2)^2, -D(2)^2, -2*D(1)*D(2), -2*D(2)*D(3), 0, 0, 2*D(2)*D(4), 0], 1542 [D(2)^2, D(1)^2+D(3)^2-D(4)^2, D(2)^2, -D(2)^2, -2*D(1)*D(2), -2*D(2)*D(3), 0, 0, 2*D(2)*D(4), 0], 1543 1543 [D(3)^2, D(3)^2, D(1)^2+D(2)^2-D(4)^2, -D(3)^2, 0, -2*D(2)*D(3), 2*D(3)*D(4), -2*D(1)*D(3), 0, 0], 1544 1544 [D(4)^2, D(4)^2, D(4)^2, D(1)^2+D(2)^2+D(3)^2, 0, 0, -2*D(3)*D(4), 0, -2*D(2)*D(4), -2*D(1)*D(4)], … … 1547 1547 [D(3)*D(4), D(3)*D(4), 0, 0, 0, -D(2)*D(4), D(1)^2+D(2)^2, -D(1)*D(4), -D(2)*D(3), -D(1)*D(3)], 1548 1548 [0, D(1)*D(3), 0, -D(1)*D(3), -D(2)*D(3), -D(1)*D(2), D(1)*D(4), D(2)^2-D(4)^2, 0, D(3)*D(4)], 1549 [D(2)*D(4), 0, D(2)*D(4), 0, -D(1)*D(4), -D(3)*D(4), -D(2)*D(3), 0, D(1)^2+D(3)^2, -D(1)*D(2)], 1549 [D(2)*D(4), 0, D(2)*D(4), 0, -D(1)*D(4), -D(3)*D(4), -D(2)*D(3), 0, D(1)^2+D(3)^2, -D(1)*D(2)], 1550 1550 [0, D(1)*D(4), D(1)*D(4), 0, -D(2)*D(4), 0, -D(1)*D(3), -D(3)*D(4), -D(1)*D(2), D(2)^2+D(3)^2]; 1551 1551 1552 1552 R=transpose(R); 1553 1553 export R; 1554 return(@r); 1554 return(@r); 1555 1555 }; 1556 1556 … … 1561 1561 module R; 1562 1562 R = [D1, -D1*delta, -1], [2*D1*delta, -D1-D1*delta^2, 0]; 1563 1563 1564 1564 R=transpose(R); 1565 1565 export R; 1566 return(@r); 1566 return(@r); 1567 1567 }; 1568 1568 1569 1569 //---------------------------------------------------------- 1570 1570 static proc exTwoPendula() 1571 { 1571 { 1572 1572 ring @r=(0,m1,m2,M,g,L1,L2),Dt,dp; 1573 module R = [m1*L1*Dt^2, m2*L2*Dt^2, -1, (M+m1+m2)*Dt^2], 1573 module R = [m1*L1*Dt^2, m2*L2*Dt^2, -1, (M+m1+m2)*Dt^2], 1574 1574 [m1*L1^2*Dt^2-m1*L1*g, 0, 0, m1*L1*Dt^2], 1575 1575 [0, m2*L2^2*Dt^2-m2*L2*g, 0, m2*L2*Dt^2]; … … 1577 1577 R=transpose(R); 1578 1578 export R; 1579 return(@r); 1579 return(@r); 1580 1580 }; 1581 1581 //---------------------------------------------------------- 1582 1582 static proc exWindTunnel() 1583 { 1583 { 1584 1584 ring @r = (0,a, omega, zeta, k),(D1, delta),dp; 1585 1585 module R = [D1+a, -k*a*delta, 0, 0], … … 1589 1589 R=transpose(R); 1590 1590 export R; 1591 return(@r); 1591 return(@r); 1592 1592 }; 1593 1593 … … 1596 1596 proc declare(string NameOfRing, string Variables, list #) 1597 1597 "USAGE: declare(NameOfRing, Variables,[Parameters, Ordering]); where 1598 @* NameOfRing is string with name of ring, 1598 @* NameOfRing is string with name of ring, 1599 1599 @* Variables is a string with names of variables separated by commas (e.g. \"x,y,z\"), 1600 @* 1601 @* 1600 @* Parameters is string of parameters in the ring separated by commas (e.g. \"a,b,c\"), 1601 @* Ordering is string with name of ordering (by default, the ordering (dp,C) is used). 1602 1602 PURPOSE: define the ring easily 1603 1603 RETURN: no return value 1604 EXAMPLE: example declare; shows an example 1604 EXAMPLE: example declare; shows an example 1605 1605 " 1606 1606 { … … 1616 1616 } 1617 1617 else 1618 { 1618 { 1619 1619 if( (size(#[1])!=0)&&(#[1]!=" ") ) 1620 1620 { … … 1623 1623 else 1624 1624 { 1625 execute( "ring " + NameOfRing + "=0,("+Variables+"),("+#[2]+");" ); 1625 execute( "ring " + NameOfRing + "=0,("+Variables+"),("+#[2]+");" ); 1626 1626 }; 1627 1627 }; … … 1658 1658 // maybe reasonable to add this in declare 1659 1659 // 1660 // print("Please enter your representation matrix in the following form: 1660 // print("Please enter your representation matrix in the following form: 1661 1661 // module R=[1st row],[2nd row],..."); 1662 1662 // print("Type the command: R=transpose(R)"); -
Singular/LIB/deform.lib
re6fb531 r3c4dcc 1 // $Id: deform.lib,v 1.3 4 2005-04-28 15:12:24 SingularExp $1 // $Id: deform.lib,v 1.35 2005-05-06 14:38:14 hannes Exp $ 2 2 // author: Bernd Martin email: martin@math.tu-cottbus.de 3 3 //(bm, last modified 4/98) 4 4 /////////////////////////////////////////////////////////////////////////////// 5 version="$Id: deform.lib,v 1.3 4 2005-04-28 15:12:24 SingularExp $";5 version="$Id: deform.lib,v 1.35 2005-05-06 14:38:14 hannes Exp $"; 6 6 category="Singularities"; 7 7 info=" … … 28 28 RETURN: list L of 4 rings: 29 29 L[1] extending the basering Po by new variables given by 30 \"A,B,..\" (deformation parameters); the new variables precede 30 \"A,B,..\" (deformation parameters); the new variables precede 31 31 the old ones, the ordering is the product of \"ls\" and \"ord(Po)\" @* 32 32 L[2] = L[1]/Fo extending Qo=Po/Fo, @* … … 40 40 If d is defined (!=0), it computes up to degree d. 41 41 @*If 'any' is defined and any[1] is no string, interactive version. 42 @*Otherwise 'any' is interpreted as a list of predefined strings: 42 @*Otherwise 'any' is interpreted as a list of predefined strings: 43 43 \"my\",\"param\",\"order\",\"out\": @* 44 (\"my\" internal prefix, \"param\" is a letter (e.g. \"A\") for the 45 name of the first parameter or (e.g. \"A(\") for index parameter 46 variables, \"order\" ordering string for ring extension), \"out\" name 47 of output file). 44 (\"my\" internal prefix, \"param\" is a letter (e.g. \"A\") for the 45 name of the first parameter or (e.g. \"A(\") for index parameter 46 variables, \"order\" ordering string for ring extension), \"out\" name 47 of output file). 48 48 NOTE: printlevel < 0 no additional output, 49 49 printlevel >=0,1,2,.. informs you, what is going on; … … 291 291 list L=versal(Fo); 292 292 L; 293 def Px=L[1]; 293 def Px=L[1]; 294 294 setring Px; 295 295 // ___ Equations of miniversal base space ___: … … 305 305 RETURN: list L of 4 rings: 306 306 L[1] extending the basering Po by new variables given by 307 \"A,B,..\" (deformation parameters); the new variables precede 307 \"A,B,..\" (deformation parameters); the new variables precede 308 308 the old ones, the ordering is the product of \"ls\" and \"ord(Po)\" @* 309 309 L[2] = L[1]/Io extending Qo, @* … … 313 313 @*Js = giving the versal base space (obstructions), 314 314 @*Fs = giving the versal family of Mo, 315 @*Rs = giving the lifting of syzygies Lo=syz(Mo). 315 @*Rs = giving the lifting of syzygies Lo=syz(Mo). 316 316 If d is defined (!=0), it computes up to degree d. 317 317 @*If 'any' is defined and any[1] is no string, interactive version. 318 @*Otherwise 'any' is interpreted as a list of predefined strings: 318 @*Otherwise 'any' is interpreted as a list of predefined strings: 319 319 \"my\",\"param\",\"order\",\"out\": @* 320 (\"my\" internal prefix, \"param\" is a letter (e.g. \"A\") for the 321 name of the first parameter or (e.g. \"A(\") for index parameter 322 variables, \"order\" ordering string for ring extension), \"out\" name 323 of output file). 320 (\"my\" internal prefix, \"param\" is a letter (e.g. \"A\") for the 321 name of the first parameter or (e.g. \"A(\") for index parameter 322 variables, \"order\" ordering string for ring extension), \"out\" name 323 of output file). 324 324 NOTE: printlevel < 0 no additional output, 325 325 printlevel >=0,1,2,.. informs you, what is going on, … … 662 662 def my_Px=extendring(e1,my_var,my_ord); 663 663 setring my_Px; 664 ideal Io = imap(Po,Io); 664 ideal Io = imap(Po,Io); 665 665 attrib(Io,"isSB",1); 666 666 qring my_Qx = Io; … … 841 841 t1=size(vvvv); 842 842 // ========================================================== 843 843 844 844 int l,l1; 845 845 for (l=1;l<=t1;l=l+1) … … 927 927 if (size(tv)>1) 928 928 { k = tv[2]; 929 tv = tv[2..size(tv)]; 929 tv = tv[2..size(tv)]; 930 930 tv = tv -k; 931 931 if (tv==0) { @nv = @nv+string(-k)+",";} -
Singular/LIB/digimult.lib
re6fb531 r3c4dcc 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: digimult.lib,v 1. 1 2005-05-04 15:41:12 brickenExp $";2 version="$Id: digimult.lib,v 1.2 2005-05-06 14:38:17 hannes Exp $"; 3 3 category="Logic"; 4 4 info=" … … 7 7 8 8 OVERVIEW: 9 9 Various algorithms for verifiying digital circuits, including SAT-Solvers 10 10 11 11 PROCEDURES: … … 40 40 return(poly_cancel_mod_number(f-l,n)); 41 41 } 42 42 43 43 return(l+poly_cancel_mod_number(f-l,n)); 44 44 } … … 74 74 for(j=1;j<=size(l);j++){ 75 75 if(i!=j){ 76 summand=summand*(var(1)-l[j][1]); 77 76 summand=summand*(var(1)-l[j][1]); 78 77 } 79 78 } … … 163 162 j=simplify(j,2); 164 163 j=simplify(j,8); 165 164 166 165 poly v=var(var_order[1]); 167 166 var_order=delete(var_order,1); … … 177 176 return(simple_gps(j0,var_order, step)); 178 177 } 179 178 180 179 } -
Singular/LIB/equising.lib
re6fb531 r3c4dcc 1 version="$Id: equising.lib,v 1.1 1 2005-04-25 10:13:06 SingularExp $";1 version="$Id: equising.lib,v 1.12 2005-05-06 14:38:17 hannes Exp $"; 2 2 category="Singularities"; 3 3 info=" 4 4 LIBRARY: equising.lib Equisingularity Stratum of a Family of Plane Curves 5 AUTHOR: Christoph Lossen, lossen@mathematik.uni-kl.de 5 AUTHOR: Christoph Lossen, lossen@mathematik.uni-kl.de 6 6 Andrea Mindnich, mindnich@mathematik.uni-kl.de 7 7 8 8 MAIN PROCEDURES: 9 9 tau_es(f); codim of mu-const stratum in semi-universal def. base 10 esIdeal(f); (Wahl's) equisingularity ideal of f 10 esIdeal(f); (Wahl's) equisingularity ideal of f 11 11 esStratum(F[,m,L]); equisingularity stratum of a family F 12 12 isEquising(F[,m,L]); tests if a given deformation is equisingular … … 55 55 static proc m_Jet(poly F,int m); 56 56 { 57 intvec w=xyVector(); 58 poly Fd=jet(F,m,w); 57 intvec w=xyVector(); 58 poly Fd=jet(F,m,w); 59 59 return(Fd); 60 60 } … … 63 63 //////////////////////////////////////////////////////////////////////////////// 64 64 // computes the 4 control matrices (input is multsequence(L)) 65 proc control_Matrix(list M); 65 proc control_Matrix(list M); 66 66 "USAGE: control_Matrix(L); L list 67 67 ASSUME: L is the output of multsequence(hnexpansion(f)). 68 68 RETURN: list M of 4 intmat's: 69 69 @format 70 M[1] contains the multiplicities at the respective infinitely near points 71 p[i,j] (i=step of blowup+1, j=branch) -- if branches j=k,...,k+m pass 72 through the same p[i,j] then the multiplicity is stored in M[1][k,j], 73 while M[1][k+1]=...=M[1][k+m]=0. 74 M[2] contains the number of branches meeting at p[i,j] (again, the information 75 is stored according to the above rule) 76 M[3] contains the information about the splitting of M[1][i,j] with respect to 77 different tangents of branches at p[i,j] (information is stored only for 78 minimal j>=k corresponding to a new tangent direction). 79 The entries are the sum of multiplicities of all branches with the 70 M[1] contains the multiplicities at the respective infinitely near points 71 p[i,j] (i=step of blowup+1, j=branch) -- if branches j=k,...,k+m pass 72 through the same p[i,j] then the multiplicity is stored in M[1][k,j], 73 while M[1][k+1]=...=M[1][k+m]=0. 74 M[2] contains the number of branches meeting at p[i,j] (again, the information 75 is stored according to the above rule) 76 M[3] contains the information about the splitting of M[1][i,j] with respect to 77 different tangents of branches at p[i,j] (information is stored only for 78 minimal j>=k corresponding to a new tangent direction). 79 The entries are the sum of multiplicities of all branches with the 80 80 respective tangent. 81 M[4] contains the maximal sum of higher multiplicities for a branch passing 82 through p[i,j] ( = degree Bound for blowing up) 81 M[4] contains the maximal sum of higher multiplicities for a branch passing 82 through p[i,j] ( = degree Bound for blowing up) 83 83 @end format 84 NOTE: the branches are ordered in such a way that only consecutive branches 84 NOTE: the branches are ordered in such a way that only consecutive branches 85 85 can meet at an infinitely near point. @* 86 the final rows of the matrices M[1],...,M[3] is (1,1,1,...,1), and 87 correspond to infinitely near points such that the strict transforms 88 of the branches are smooth and intersect the exceptional divisor 86 the final rows of the matrices M[1],...,M[3] is (1,1,1,...,1), and 87 correspond to infinitely near points such that the strict transforms 88 of the branches are smooth and intersect the exceptional divisor 89 89 transversally. 90 90 SEE ALSO: multsequence … … 96 96 dummy=0; 97 97 for (j=1;j<=ncols(M[2]);j++) 98 { 98 { 99 99 dummy=dummy+M[1][nrows(M[1])-1,j]-M[1][nrows(M[1]),j]; 100 100 } … … 103 103 intmat U[nrows(M[1])+dummy][ncols(M[1])]; 104 104 intmat maxDeg[nrows(M[1])+dummy][ncols(M[1])]; 105 105 106 106 for (i=1;i<=nrows(M[2]);i++) 107 107 { … … 110 110 { 111 111 for (k=dummy;k<dummy+M[2][i,j];k++) 112 { 113 T[i,dummy]=T[i,dummy]+1; 114 S[i,dummy]=S[i,dummy]+M[1][i,k]; 112 { 113 T[i,dummy]=T[i,dummy]+1; 114 S[i,dummy]=S[i,dummy]+M[1][i,k]; 115 115 if (i>1) 116 116 { … … 127 127 { 128 128 for (j=1;j<=ncols(M[2]);j++) 129 { 130 S[i,j]=1; 131 T[i,j]=1; 129 { 130 S[i,j]=1; 131 T[i,j]=1; 132 132 U[i,j]=1; 133 133 } 134 134 } 135 135 136 136 // Computing the degree Bounds to be stored in M[4]: 137 137 for (i=1;i<=nrows(S);i++) … … 141 141 { 142 142 for (k=dummy;k<dummy+T[i,j];k++) 143 { 143 { 144 144 maxDeg[i,k]=S[i,dummy]; // multiplicity at i-th blowup 145 145 } … … 147 147 } 148 148 } 149 // adding up multiplicities 150 for (i=nrows(S);i>=2;i--) 149 // adding up multiplicities 150 for (i=nrows(S);i>=2;i--) 151 151 { 152 152 for (j=1;j<=ncols(S);j++) … … 155 155 } 156 156 } 157 157 158 158 list L=S,T,U,maxDeg; 159 159 return(L); … … 165 165 // returns list: 1) tangent directions 166 166 // 2) swapping information (x <--> y) 167 static proc inf_Tangents(list L,int s); // L aus hnexpansion, 167 static proc inf_Tangents(list L,int s); // L aus hnexpansion, 168 168 { 169 169 int nv=nvars(basering); … … 178 178 V[k]=L[k][3]; // switch: 0 --> tangent 2nd parameter 179 179 // 1 --> tangent 1st parameter 180 e=0; 180 e=0; 181 181 M=L[k][1]; 182 182 counter=1; 183 183 B[counter,k]=M[1,1]; 184 184 185 185 for (i=1;i<=nrows(M);i++) 186 186 { … … 193 193 { 194 194 B[counter,k]=M[i,j]; 195 j=ncols(M)+1; // goto new row of HNmatrix... 195 j=ncols(M)+1; // goto new row of HNmatrix... 196 196 if (counter<>s) 197 { 197 { 198 198 if (counter+1<=nrows(Mult)) 199 199 { … … 206 206 } 207 207 } 208 else 208 else 209 209 { 210 210 B[counter,k]=0; 211 j=ncols(M)+1; // goto new row of HNmatrix... 211 j=ncols(M)+1; // goto new row of HNmatrix... 212 212 } 213 213 } … … 215 215 { 216 216 if (e<=0) 217 { 217 { 218 218 B[counter,k]=M[i,j]; 219 219 } … … 231 231 } 232 232 } 233 234 if (counter==s) // given number of points determined 233 234 if (counter==s) // given number of points determined 235 235 { 236 j=ncols(M)+1; 236 j=ncols(M)+1; 237 237 i=nrows(M)+1; 238 238 // leave procedure … … 247 247 //////////////////////////////////////////////////////////////////////////////// 248 248 // compute "good" upper bound for needed number of help variables 249 // 249 // 250 250 static proc Determine_no_b(intmat U,matrix B) 251 251 // U is assumed to be 3rd output of control_Matrix … … 265 265 } 266 266 } 267 267 268 268 } 269 269 } … … 273 273 274 274 //////////////////////////////////////////////////////////////////////////////// 275 // compute number of infinitely near free points corresponding to non-zero 275 // compute number of infinitely near free points corresponding to non-zero 276 276 // entries in control_Matrix[1] (except first row) 277 // 277 // 278 278 static proc no_freePoints(intmat Mult,matrix B) 279 279 // Mult is assumed to be 1st output of control_Matrix … … 330 330 331 331 /////////////////////////////////////////////////////////////////////////////// 332 // 332 // 333 333 // DEFINES: A new basering, "myRing", 334 334 // with new names for the parameters and variables. … … 337 337 // The ring ordering is ordStr. 338 338 // NOTE: This proc uses 'execute'. 339 static proc createMyRing_new(poly p_F, string ordStr, 340 string minPolyStr, int no_b) 339 static proc createMyRing_new(poly p_F, string ordStr, 340 string minPolyStr, int no_b) 341 341 { 342 342 def r_old = basering; … … 393 393 export p_F,mIdeal; 394 394 395 // Extension by no_b auxiliary variables 395 // Extension by no_b auxiliary variables 396 396 if (no_b>0) 397 397 { … … 401 401 helpStr = "ring myRing =" 402 402 + string(chara)+ ", (b(1..no_b), t(1..nDefParams), x, y)," 403 + ordStr +";"; 403 + ordStr +";"; 404 404 execute(helpStr); 405 405 } … … 419 419 420 420 helpStr = "minpoly =" + minPolyStr + ";"; 421 execute (helpStr); 421 execute (helpStr); 422 422 } 423 423 else // no minpoly given 424 { 424 { 425 425 ordStr = "(dp(" + string(no_b) + ")," + ordStr + ")"; 426 426 helpStr = "ring myRing = … … 441 441 } 442 442 ideal qIdeal = imap(myRing1, qIdeal); 443 443 444 444 if(qIdeal != 0) 445 445 { … … 455 455 kill myRing1; 456 456 } 457 else 458 { 457 else 458 { 459 459 if(qIdeal != 0) 460 460 { … … 471 471 def myRing=myRing1; 472 472 } 473 kill myRing1; 474 } 475 473 kill myRing1; 474 } 475 476 476 setring r_old; 477 477 return(myRing); … … 479 479 480 480 //////////////////////////////////////////////////////////////////////////////// 481 // returns list of coef, leadmonomial 481 // returns list of coef, leadmonomial 482 482 // 483 483 static proc determine_coef (poly Fm) … … 532 532 kill myRing1; 533 533 def M=coef(Fm,xy); 534 534 535 535 for (i=1; i<=ncols(M); i++) 536 536 { … … 578 578 579 579 //////////////////////////////////////////////////////////////////////////////// 580 static proc make_ring_small(ideal J) 581 // returns varstr for new ring, the map and the number of vars 580 static proc make_ring_small(ideal J) 581 // returns varstr for new ring, the map and the number of vars 582 582 { 583 583 attrib(J,"isSB",1); 584 int counter=0; 584 int counter=0; 585 585 ideal newmap; 586 586 string newvar=""; … … 590 590 { 591 591 newmap[i]=var(i); 592 592 593 593 if (newvar=="") 594 594 { 595 595 newvar=newvar+string(var(i)); 596 counter=counter+1; 596 counter=counter+1; 597 597 } 598 598 else 599 599 { 600 600 newvar=newvar+","+string(var(i)); 601 counter=counter+1; 602 } 603 } 604 else 601 counter=counter+1; 602 } 603 } 604 else 605 605 { 606 606 newmap[i]=0; 607 } 607 } 608 608 } 609 609 list L=newvar,newmap,counter; … … 626 626 int auxVar=1; 627 627 int nVars; 628 628 629 629 intvec upper_bound, upper_bound_old, fertig, soll; 630 630 list blowup_string; … … 643 643 { 644 644 option(set,ov); 645 return(1); 645 return(1); 646 646 } 647 647 else … … 658 658 def artin_bd=#[1]; // compute modulo maxideal(artin_bd) 659 659 if (artin_bd <= 1) 660 { 660 { 661 661 print("Do you really want to compute over Basering/maxideal(" 662 662 +string(artin_bd)+") ?"); … … 665 665 { 666 666 option(set,ov); 667 return(1); 667 return(1); 668 668 } 669 669 else … … 674 674 } 675 675 if (size(#)>1) 676 { 676 { 677 677 if (typeof(#[2])=="list") 678 678 { 679 679 def @L=#[2]; // is assumed to be the Hamburger-Noether matrix 680 680 } 681 } 681 } 682 682 } 683 683 else … … 710 710 poly f=phi(p_F); 711 711 712 // Heuristics: if x,y are transversal parameters then computation of HNE 713 // can be much faster when exchanging variables...! 712 // Heuristics: if x,y are transversal parameters then computation of HNE 713 // can be much faster when exchanging variables...! 714 714 if (2*size(coeffs(f,x))<size(coeffs(f,y))) 715 715 { … … 717 717 f=swapXY(f); 718 718 } 719 719 720 720 int error=checkPoly(f); 721 721 if (error) … … 726 726 print("Return value (=0) has no meaning!"); 727 727 option(set,ov); 728 return(0); 728 return(0); 729 729 } 730 730 else 731 { 731 { 732 732 option(set,ov); 733 733 return(list( ideal(0),error)); 734 734 } 735 735 } 736 736 737 737 dbprint(i_print,"// "); 738 738 dbprint(i_print,"// Compute HN expansion"); … … 740 740 i=printlevel; 741 741 printlevel=printlevel-5; 742 list LLL=hnexpansion(f); 742 list LLL=hnexpansion(f); 743 743 744 744 if (size(LLL)==0) { // empty list returned by hnexpansion 745 745 setring old_ring; 746 print(i_print,"Unable to compute HN expansion !"); 746 print(i_print,"Unable to compute HN expansion !"); 747 747 if (typ==1) //isEquising 748 748 { 749 749 print("Return value (=0) has no meaning!"); 750 750 option(set,ov); 751 return(0); 751 return(0); 752 752 } 753 753 else … … 762 762 { 763 763 if (typeof(LLL[1])=="ring") { 764 def HNering = LLL[1]; 765 setring HNering; 764 def HNering = LLL[1]; 765 setring HNering; 766 766 def @L=stripHNE(hne); 767 767 } … … 776 776 def HNEring=basering; 777 777 list M=multsequence(@L); 778 M=control_Matrix(M); // this returns the 4 control matrices 778 M=control_Matrix(M); // this returns the 4 control matrices 779 779 def maxDeg=M[4]; 780 780 … … 792 792 793 793 // Determine maximal number of needed auxiliary parameters (free tangents): 794 no_b=Determine_no_b(M[3],B); 794 no_b=Determine_no_b(M[3],B); 795 795 796 796 // test whether HNexpansion needed field extension.... … … 817 817 number_of_branches=ncols(M[1]); 818 818 for (i=1;i<=number_of_branches;i++) 819 { 819 { 820 820 poly F(i); 821 ideal bl_Map(i); 821 ideal bl_Map(i); 822 822 } 823 823 upper_bound[number_of_branches]=0; … … 829 829 // Hole: B = matrix of blowup points 830 830 if (ring_is_changed==0) { matrix B=hole(B); } 831 else { matrix B=imap(HNEring,B); } 831 else { matrix B=imap(HNEring,B); } 832 832 m=M[1][blowup,branch]; // multiplicity at 0 833 833 834 834 // now, we start by checking equimultiplicity along trivial section 835 835 poly Fm=m_Jet(p_F,m-1); …