Changeset e1f372 in git
- Timestamp:
- Sep 7, 2010, 7:37:52 PM (13 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 3b614ecf39de68c3a807a600dd27a5329966b5cd
- Parents:
- e128fda56ac773be45f4a851d82371ff728c25a9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/tropical.lib
re128fd re1f372 8 8 @* Thomas Markwig, email: keilen@mathematik.uni-kl.de 9 9 10 WARNING: 10 WARNING: 11 11 - tropicalLifting will only work with LINUX and if in addition gfan is installed. 12 @*- drawTropicalCurve and drawTropicalNewtonSubdivision will only display the 13 @* tropical curve with LINUX and if in addition latex and kghostview 12 @*- drawTropicalCurve and drawTropicalNewtonSubdivision will only display the 13 @* tropical curve with LINUX and if in addition latex and kghostview 14 14 @* are installed. 15 @*- For tropicalLifting in the definition of the basering the parameter t 15 @*- For tropicalLifting in the definition of the basering the parameter t 16 16 @* from the Puiseux series field C{{t}} must be defined as a variable, 17 17 @* while for all other procedures it must be defined as a parameter. 18 18 19 19 THEORY: 20 Fix some base field K and a bunch of lattice points v0,...,vm in the integer 21 lattice Z^n, then this defines a toric variety as the closure of (K*)^n in 22 the projective space P^m, where the torus is embedded via the map sending a 20 Fix some base field K and a bunch of lattice points v0,...,vm in the integer 21 lattice Z^n, then this defines a toric variety as the closure of (K*)^n in 22 the projective space P^m, where the torus is embedded via the map sending a 23 23 point x in (K*)^n to the point (x^v0,...,x^vm). 24 The generic hyperplane sections are just the images of the hypersurfaces 24 The generic hyperplane sections are just the images of the hypersurfaces 25 25 in (K*)^n defined by the polynomials f=a0*x^v0+...+am*x^vm=0. Some properties 26 of these hypersurfaces can be studied via tropicalisation. 27 28 For this we suppose that K=C{{t}} is the field of Puiseux series over the 26 of these hypersurfaces can be studied via tropicalisation. 27 28 For this we suppose that K=C{{t}} is the field of Puiseux series over the 29 29 field of complex numbers (or any other field with a valuation into the real 30 numbers). One associates to the hypersurface given by f=a0*x^v0+...+am*x^vm 30 numbers). One associates to the hypersurface given by f=a0*x^v0+...+am*x^vm 31 31 the tropical hypersurface defined by the tropicalisation 32 trop(f)=min{val(a0)+<v0,x>,...,val(am)+<vm,x>}. 32 trop(f)=min{val(a0)+<v0,x>,...,val(am)+<vm,x>}. 33 33 Here, <v,x> denotes the standard scalar product of the integer vector v in Z^n 34 34 with the vector x=(x1,...,xn) of variables, so that trop(f) is a piecewise 35 linear function on R^n. The corner locus of this function (i.e. the points 36 at which the minimum is attained a least twice) is the tropical hypersurface 37 defined by trop(f). 38 The theorem of Newton-Kapranov states that this tropical hypersurface is 39 the same as if one computes pointwise the valuation of the hypersurface 40 given by f. The analogue holds true if one replaces one equation f by an 41 ideal I. A constructive proof of the theorem is given by an adapted 42 version of the Newton-Puiseux algorithm. The hard part is to find a point 43 in the variety over C{{t}} which corresponds to a given point in the 35 linear function on R^n. The corner locus of this function (i.e. the points 36 at which the minimum is attained a least twice) is the tropical hypersurface 37 defined by trop(f). 38 The theorem of Newton-Kapranov states that this tropical hypersurface is 39 the same as if one computes pointwise the valuation of the hypersurface 40 given by f. The analogue holds true if one replaces one equation f by an 41 ideal I. A constructive proof of the theorem is given by an adapted 42 version of the Newton-Puiseux algorithm. The hard part is to find a point 43 in the variety over C{{t}} which corresponds to a given point in the 44 44 tropical variety. 45 45 46 It is the purpose of this library to provide basic means to deal with 47 tropical varieties. Of course we cannot represent the field of Puiseux 48 series over C in its full strength, however, in order to compute interesting 49 examples it will be sufficient to replace the complex numbers C by the 50 rational numbers Q and to replace Puiseux series in t by rational functions 51 in t, i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. 46 It is the purpose of this library to provide basic means to deal with 47 tropical varieties. Of course we cannot represent the field of Puiseux 48 series over C in its full strength, however, in order to compute interesting 49 examples it will be sufficient to replace the complex numbers C by the 50 rational numbers Q and to replace Puiseux series in t by rational functions 51 in t, i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. 52 52 Note, that this in particular forbids rational exponents for the t's. 53 53 54 54 Moreover, in @sc{Singular} no negative exponents of monomials are allowed, so 55 that the integer vectors vi will have to have non-negative entries. 56 Shifting all exponents by a fixed integer vector does not change the 57 tropicalisation nor does it change the toric variety. Thus this does not 55 that the integer vectors vi will have to have non-negative entries. 56 Shifting all exponents by a fixed integer vector does not change the 57 tropicalisation nor does it change the toric variety. Thus this does not 58 58 cause any restriction. 59 If, however, for some reason you prefer to work with general vi, then you 60 have to pass right away to the tropicalisation of the equations, whereever 59 If, however, for some reason you prefer to work with general vi, then you 60 have to pass right away to the tropicalisation of the equations, whereever 61 61 this is allowed -- these are linear polynomials where the constant coefficient 62 corresponds to the valuation of the original coefficient and where 63 the non-constant coefficient correspond to the exponents of the monomials, 64 thus they may be rational numbers respectively negative numbers: 62 corresponds to the valuation of the original coefficient and where 63 the non-constant coefficient correspond to the exponents of the monomials, 64 thus they may be rational numbers respectively negative numbers: 65 65 e.g. if f=t^{1/2}*x^{-2}*y^3+2t*x*y+4 then trop(f)=min{1/2-2x+3y,1+x+y,0}. 66 66 67 67 The main tools provided in this library are as follows: 68 @* - tropicalLifting implements the constructive proof of the Theorem of 69 Newton-Kapranov and constructs a point in the variety 70 over C{{t}} corresponding to a given point in the 71 corresponding tropical variety associated to an 72 ideal I; the generators of I have to be in the 73 polynomial ring Q[t,x1,...,xn] considered as a 74 subring of C{{t}}[x1,...,xn]; a solution will be 75 constructed up to given order; note that several 68 @* - tropicalLifting implements the constructive proof of the Theorem of 69 Newton-Kapranov and constructs a point in the variety 70 over C{{t}} corresponding to a given point in the 71 corresponding tropical variety associated to an 72 ideal I; the generators of I have to be in the 73 polynomial ring Q[t,x1,...,xn] considered as a 74 subring of C{{t}}[x1,...,xn]; a solution will be 75 constructed up to given order; note that several 76 76 field extensions of Q might be necessary throughout 77 77 the intermediate computations; the procedures use 78 78 the external program gfan 79 @* - drawTropicalCurve visualises a tropical plane curve either given by a 80 polynomial in Q(t)[x,y] or by a list of linear 81 polynomials of the form ax+by+c with a,b in Z and c 79 @* - puiseuxExpansion computes a Newton-Puiseux expansion of a plane curve 80 singularity 81 @* - drawTropicalCurve visualises a tropical plane curve either given by a 82 polynomial in Q(t)[x,y] or by a list of linear 83 polynomials of the form ax+by+c with a,b in Z and c 82 84 in Q; latex must be installed on your computer 83 @* - tropicalJInvariant computes the tropical j-invaiant of a tropical 85 @* - tropicalJInvariant computes the tropical j-invaiant of a tropical 84 86 elliptic curve 85 87 @* - jInvariant computes the j-invariant of an elliptic curve 86 @* - weierstrassForm computes the Weierstrass form of an elliptic curve 88 @* - weierstrassForm computes the Weierstrass form of an elliptic curve 87 89 88 90 PROCEDURES FOR TROPICAL LIFTING: 89 tropicalLifting() computes a point in the tropical variety 91 tropicalLifting() computes a point in the tropical variety 90 92 displayTropicalLifting() displays the output of tropicalLifting 93 puiseuxExpansion() computes a Newton-Puiseux expansion in the plane 94 displayPuiseuxExpansion() displays the output of puiseuxExpansion 91 95 92 96 PROCEDURES FOR DRAWING TROPICAL CURVES: … … 107 111 tInitialIdeal() computes the tInitial ideal of an ideal in Q[t,x_1,...,x_n] 108 112 initialForm() computes the initial form of poly in Q[x_1,...,x_n] 109 initialIdeal() computes the initial ideal of an ideal in Q[x_1,...,x_n] 113 initialIdeal() computes the initial ideal of an ideal in Q[x_1,...,x_n] 110 114 111 115 PROCEDURES FOR LATEX CONVERSION: … … 115 119 texDrawBasic() embeds output of texDrawTropical in a texdraw environment 116 120 texDrawTropical() computes the texdraw commands for a tropical curve 117 texDrawNewtonSubdivision() computes texdraw commands for a Newton subdivision 121 texDrawNewtonSubdivision() computes texdraw commands for a Newton subdivision 118 122 texDrawTriangulation() computes texdraw commands for a triangulation 119 123 … … 121 125 radicalMemberShip() checks radical membership 122 126 tInitialFormPar() computes the t-initial form of poly in Q(t)[x_1,...,x_n] 123 tInitialFormParMax() same as tInitialFormPar, but uses maximum 127 tInitialFormParMax() same as tInitialFormPar, but uses maximum 124 128 solveTInitialFormPar() displays approximated solution of a 0-dim ideal 125 129 detropicalise() computes the detropicalisation of a linear form 126 130 tDetropicalise() computes the detropicalisation of a linear form 127 dualConic() computes the dual of an affine plane conic 131 dualConic() computes the dual of an affine plane conic 128 132 parameterSubstitute() substitutes in the polynomial the parameter t by t^N 129 133 tropicalSubst() makes certain substitutions in a tropical polynomial … … 156 160 /// - eliminatecomponents 157 161 /// - findzerosAndBasictransform 158 /// - ordermaximalideals 162 /// - ordermaximalideals 159 163 /// - verticesTropicalCurve 160 164 /// - bunchOfLines … … 202 206 LIB "primdec.lib"; 203 207 LIB "absfact.lib"; 208 LIB "hnoether.lib"; 204 209 ////////////////////////////////////////////////////////////////////////////// 205 210 206 211 /////////////////////////////////////////////////////////////////////////////// 207 /// Procedures concerned with tropical parametrisation 212 /// Procedures concerned with tropical parametrisation 208 213 /////////////////////////////////////////////////////////////////////////////// 209 214 210 215 proc tropicalLifting (ideal i,intvec w,int ordnung,list #) 211 216 "USAGE: tropicalLifting(i,w,ord[,opt]); i ideal, w intvec, ord int, opt string 212 ASSUME: - i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) 213 and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, 214 and ord is the order up to which a point in V(i) over Q{{t}} 215 lying over (w_1/w_0,...,w_n/w_0) shall be computed; 217 ASSUME: - i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) 218 and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, 219 and ord is the order up to which a point in V(i) over Q{{t}} 220 lying over (w_1/w_0,...,w_n/w_0) shall be computed; 216 221 w_0 may NOT be ZERO 217 @* - the basering should not have any parameters on its own 218 and it should have a global monomial ordering, 222 @* - the basering should not have any parameters on its own 223 and it should have a global monomial ordering, 219 224 e.g. ring r=0,(t,x(1..n)),dp; 220 @* - the first variable of the basering will be treated as the 225 @* - the first variable of the basering will be treated as the 221 226 parameter t in the Puiseux series field 222 @* - the optional parameter opt should be one or more strings among 227 @* - the optional parameter opt should be one or more strings among 223 228 the following: 224 229 @* 'isZeroDimensional' : the dimension i is zero (not to be checked); 225 @* 'isPrime' : the ideal is prime over Q(t)[x_1,...,x_n] 230 @* 'isPrime' : the ideal is prime over Q(t)[x_1,...,x_n] 226 231 (not to be checked); 227 @* 'isInTrop' : (w_1/w_0,...,w_n/w_0) is in the tropical 232 @* 'isInTrop' : (w_1/w_0,...,w_n/w_0) is in the tropical 228 233 variety (not to be checked); 229 @* 'oldGfan' : uses gfan version 0.2.1 or less 230 @* 'findAll' : find all solutions of a zero-dimensional 234 @* 'oldGfan' : uses gfan version 0.2.1 or less 235 @* 'findAll' : find all solutions of a zero-dimensional 231 236 ideal over (w_1/w_0,...,w_n/w_0) 232 237 @* 'noAbs' : do NOT use absolute primary decomposition 233 @* 'noResubst' : avoids the computation of the resubstitution 238 @* 'puiseux' : n=1 and i is generated by one equation 239 @* 'noResubst' : avoids the computation of the resubstitution 234 240 RETURN: IF THE OPTION 'findAll' WAS NOT SET THEN: 235 241 @* list, containing one lifting of the given point (w_1/w_0,...,w_n/w_0) 236 in the tropical variety of i to a point in V(i) over Puiseux 242 in the tropical variety of i to a point in V(i) over Puiseux 237 243 series field up to the first ord terms; more precisely: 238 244 @* IF THE OPTION 'noAbs' WAS NOT SET, THEN: … … 249 255 @* IF THE OPITON 'findAll' WAS SET, THEN: 250 256 @* list, containing ALL liftings of the given point ((w_1/w_0,...,w_n/w_0) 251 in the tropical variety of i to a point in V(i) over Puiseux 252 series field up to the first ord terms, if the ideal is 257 in the tropical variety of i to a point in V(i) over Puiseux 258 series field up to the first ord terms, if the ideal is 253 259 zero-dimensional over Q{{t}}; 254 more precisely, each entry of the list is a list l as computed 260 more precisely, each entry of the list is a list l as computed 255 261 if 'findAll' was NOT set 256 262 @* WE NOW DESCRIBE THE LIST ENTRIES IF 'findAll' WAS NOT SET: 257 @* - the ring l[1] contains an ideal LIFT, which contains 263 @* - the ring l[1] contains an ideal LIFT, which contains 258 264 a point in V(i) lying over w up to the first ord terms; 259 @* - and if the integer l[2] is N then t has to be replaced by t^1/N 265 @* - and if the integer l[2] is N then t has to be replaced by t^1/N 260 266 in the lift, or alternatively replace t by t^N in the defining ideal 261 @* - if the k+1st entry of l[3] is non-zero, then the kth component of 262 LIFT has to be multiplied t^(-l[3][k]/l[3][1]) AFTER substituting t 267 @* - if the k+1st entry of l[3] is non-zero, then the kth component of 268 LIFT has to be multiplied t^(-l[3][k]/l[3][1]) AFTER substituting t 263 269 by t^1/N 264 @* - unless the option 'noResubst' was set, the kth entry of list l[4] 270 @* - unless the option 'noResubst' was set, the kth entry of list l[4] 265 271 is a string which represents the kth generator of 266 the ideal i where the coordinates have been replaced by the result 272 the ideal i where the coordinates have been replaced by the result 267 273 of the lift; 268 the t-order of the kth entry should in principle be larger than the 274 the t-order of the kth entry should in principle be larger than the 269 275 t-degree of LIFT 270 @* - if the option 'noAbs' was set, then the string in l[5] defines 271 a maximal ideal in the field Q[X(1),...,X(k)], where X(1),...,X(k) 276 @* - if the option 'noAbs' was set, then the string in l[5] defines 277 a maximal ideal in the field Q[X(1),...,X(k)], where X(1),...,X(k) 272 278 are the parameters of the ring in l[1]; 273 the basefield of the ring in l[1] should be considered modulo this 279 the basefield of the ring in l[1] should be considered modulo this 274 280 ideal 275 REMARK: - it is best to use the procedure displayTropicalLifting to 281 REMARK: - it is best to use the procedure displayTropicalLifting to 276 282 display the result 277 283 @* - the option 'findAll' cannot be used if 'noAbs' is set 278 284 @* - if the parameter 'findAll' is set AND the ideal i is zero-dimensional 279 in Q{{t}}[x_1,...,x_n] then ALL points in V(i) lying over w are 285 in Q{{t}}[x_1,...,x_n] then ALL points in V(i) lying over w are 280 286 computed up to order ord; if the ideal is not-zero dimenisonal, then 281 287 only the points in the ideal after cutting down to dimension zero 282 288 will be computed 283 289 @* - the procedure requires that the program GFAN is installed on your 284 computer; if you have GFAN version less than 0.3.0 then you must 290 computer; if you have GFAN version less than 0.3.0 then you must 285 291 use the optional parameter 'oldGfan' 286 292 @* - the procedure requires the @sc{Singular} procedure absPrimdecGTZ to be 287 293 present in the package primdec.lib, unless the option 'noAbs' is set; 288 but even if absPrimdecGTZ is present it might be necessary to set 289 the option 'noAbs' in order to avoid the costly absolute primary 290 decomposition; the side effect is that the field extension which is 294 but even if absPrimdecGTZ is present it might be necessary to set 295 the option 'noAbs' in order to avoid the costly absolute primary 296 decomposition; the side effect is that the field extension which is 291 297 computed throughout the recursion might need more than one 292 298 parameter to be described 293 299 @* - since Q is infinite, the procedure finishes with probability one 294 @* - you can call the procedure with Z/pZ as base field instead of Q, 300 @* - you can call the procedure with Z/pZ as base field instead of Q, 295 301 but there are some problems you should be aware of: 296 @* + the Puiseux series field over the algebraic closure of Z/pZ is 297 NOT algebraicall closed, and thus there may not exist a point in 298 V(i) over the Puiseux series field with the desired valuation; 302 @* + the Puiseux series field over the algebraic closure of Z/pZ is 303 NOT algebraicall closed, and thus there may not exist a point in 304 V(i) over the Puiseux series field with the desired valuation; 299 305 so there is no chance that the procedure produced a sensible output 300 - e.g. if i=tx^p-tx-1 301 @* + if the dimension of i over Z/pZ(t) is not zero the process of 302 reduction to zero might not work if the characteristic is small 306 - e.g. if i=tx^p-tx-1 307 @* + if the dimension of i over Z/pZ(t) is not zero the process of 308 reduction to zero might not work if the characteristic is small 303 309 and you are unlucky 304 @* + the option 'noAbs' has to be used since absolute primary 310 @* + the option 'noAbs' has to be used since absolute primary 305 311 decomposition in @sc{Singular} only works in characteristic zero 306 @* - the basefield should either be Q or Z/pZ for some prime p; 307 field extensions will be computed if necessary; if you need 308 parameters or field extensions from the beginning they should 309 rather be simulated as variables possibly adding their relations to 312 @* - the basefield should either be Q or Z/pZ for some prime p; 313 field extensions will be computed if necessary; if you need 314 parameters or field extensions from the beginning they should 315 rather be simulated as variables possibly adding their relations to 310 316 the ideal; the weights for the additional variables should be zero 311 317 EXAMPLE: example tropicalLifting; shows an example" … … 331 337 int j,k,l,jj,kk; // index variables 332 338 // work through the optionional parameters 333 int isprime,iszerodim,isintrop,gfanold,findall,noabs,nogfan,noresubst ;339 int isprime,iszerodim,isintrop,gfanold,findall,noabs,nogfan,noresubst,puiseux; 334 340 for (j=1;j<=size(#);j++) 335 341 { … … 358 364 noabs=1; 359 365 } 360 // this option is not documented -- it prevents the execution of gfan and 361 // just asks for wneu to be inserted -- it can be used to check problems 362 // with the precedure without calling gfan, if wneu is know from previous 366 if (#[j]=="puiseux") 367 { 368 int puiseuxgood=0; 369 // test, if the option puiseux makes sense, i.e. we are considering a plane curve 370 if ((size(i)==1) and (nvars(basering)==2)) 371 { 372 puiseuxgood=1; 373 } 374 // the case, where the base field has a parameter and a minimal polynomial is 375 // treated by an additional variable (which should be the last variable) 376 // and an ideal containing the minimal polynomial as first entry 377 if ((size(i)==2) and (nvars(basering)==3)) 378 { 379 // check if the first entry is the minimal polynomial 380 poly mpcheck=i[1]; 381 if (substitute(mpcheck,var(1),0,var(2),0)==mpcheck) 382 { 383 puiseuxgood=1; 384 } 385 kill mpcheck; 386 } 387 if (puiseuxgood==0) 388 { 389 ERROR("The option puiseux is not allowed for this ring. See: help tropicalLifting; for more information"); 390 } 391 puiseux=1; 392 nogfan=1; // if puiseux is set, then gfan should not be used 393 } 394 // this option is not documented -- it prevents the execution of gfan and 395 // just asks for wneu to be inserted -- it can be used to check problems 396 // with the precedure without calling gfan, if wneu is know from previous 363 397 // computations 364 398 if (#[j]=="noGfan") … … 371 405 } 372 406 } 373 // if the basering has characteristic not equal to zero, 407 // if the basering has characteristic not equal to zero, 374 408 // then absolute factorisation 375 409 // is not available, and thus we need the option noAbs … … 385 419 { 386 420 Error("The first coordinate of your input w must be NON-ZERO, since it is a DENOMINATOR!"); 387 } 421 } 388 422 // if w_0<0, then replace w by -w, so that the "denominator" w_0 is positive 389 423 if (w[1]<0) … … 392 426 } 393 427 intvec prew=w; // stores w for later reference 394 // for our computations, w[1] represents the weight of t and this 428 // for our computations, w[1] represents the weight of t and this 395 429 // should be -w_0 !!! 396 430 w[1]=-w[1]; … … 402 436 w[1]=-1; 403 437 } 404 // if some entry of w is positive, we have to make a transformation, 438 // if some entry of w is positive, we have to make a transformation, 405 439 // which moves it to something non-positive 406 440 for (j=2;j<=nvars(basering);j++) … … 428 462 { 429 463 variablen=variablen+var(j); 430 } 464 } 431 465 map GRUNDPHI=BASERING,t,variablen; 432 466 ideal i=GRUNDPHI(i); 433 // compute the initial ideal of i and test if w is in the tropical 434 // variety of i 467 // compute the initial ideal of i and test if w is in the tropical 468 // variety of i 435 469 // - the last entry 1 only means that t is the last variable in the ring 436 470 ideal ini=tInitialIdeal(i,w,1); 437 471 if (isintrop==0) // test if w is in trop(i) only if isInTrop has not been set 438 { 472 { 439 473 poly product=1; 440 474 for (j=1;j<=nvars(basering)-1;j++) … … 454 488 int dd=dim(i); 455 489 setring GRUNDRING; 456 // if the dimension is not zero, we cut the ideal down to dimension zero 490 // if the dimension is not zero, we cut the ideal down to dimension zero 457 491 // and compute the 458 492 // t-initial ideal of the new ideal at the same time 459 493 if(dd!=0) 460 494 { 461 // the procedurce cutdown computes a new ring, in which there lives a 495 // the procedurce cutdown computes a new ring, in which there lives a 462 496 // zero-dimensional 463 // ideal which has been computed by cutting down the input with 497 // ideal which has been computed by cutting down the input with 464 498 // generic linear forms 465 // of the type x_i1-p_1,...,x_id-p_d for some polynomials 466 // p_1,...,p_d not depending 467 // on the variables x_i1,...,x_id; that way we have reduced 499 // of the type x_i1-p_1,...,x_id-p_d for some polynomials 500 // p_1,...,p_d not depending 501 // on the variables x_i1,...,x_id; that way we have reduced 468 502 // the number of variables by dd !!! 469 // the new zero-dimensional ideal is called i, its t-initial 503 // the new zero-dimensional ideal is called i, its t-initial 470 504 // ideal (with respect to 471 // the new w=CUTDOWN[2]) is ini, and finally there is a list 472 // repl in the ring 505 // the new w=CUTDOWN[2]) is ini, and finally there is a list 506 // repl in the ring 473 507 // which contains at the polynomial p_j at position i_j and 474 508 //a zero otherwise; … … 493 527 list liftrings; // will contain the final result 494 528 // if the procedure is called without 'findAll' then it may happen, that no 495 // proper solution is found when dd>0; in that case we have 529 // proper solution is found when dd>0; in that case we have 496 530 // to start all over again; 497 531 // this is controlled by the while-loop … … 501 535 if (noabs==1) // do not use absolute primary decomposition 502 536 { 503 list TP=list(tropicalparametriseNoabs(i,w,ordnung,gfanold,nogfan, ini));537 list TP=list(tropicalparametriseNoabs(i,w,ordnung,gfanold,nogfan,puiseux,ini)); 504 538 } 505 539 else // use absolute primary decomposition 506 540 { 507 list TP=tropicalparametrise(i,w,ordnung,gfanold,findall,nogfan, ini);541 list TP=tropicalparametrise(i,w,ordnung,gfanold,findall,nogfan,puiseux,ini); 508 542 } 509 543 // compute the liftrings by resubstitution 510 544 kk=1; // counts the liftrings 511 int isgood; // test in the non-zerodimensional case 545 int isgood; // test in the non-zerodimensional case 512 546 // if the result has the correct valuation 513 547 for (jj=1;jj<=size(TP);jj++) 514 548 { 515 // the list TP contains as a first entry the ring over which the 516 // tropical parametrisation 549 // the list TP contains as a first entry the ring over which the 550 // tropical parametrisation 517 551 // of the (possibly cutdown ideal) i lives 518 552 def LIFTRING=TP[jj][1]; 519 // if the dimension of i originally was not zero, 553 // if the dimension of i originally was not zero, 520 554 // then we have to fill in the missing 521 555 // parts of the parametrisation 522 556 if (dd!=0) 523 557 { 524 // we need a ring where the parameters X_1,...,X_k 558 // we need a ring where the parameters X_1,...,X_k 525 559 // from LIFTRING are present, 526 560 // and where also the variables of CUTDOWNRING live 527 561 execute("ring REPLACEMENTRING=("+charstr(LIFTRING)+"),("+varstr(CUTDOWNRING)+"),dp;"); 528 list repl=imap(CUTDOWNRING,repl); // get the replacement rules 562 list repl=imap(CUTDOWNRING,repl); // get the replacement rules 529 563 // from CUTDOWNRING 530 ideal PARA=imap(LIFTRING,PARA); // get the zero-dim. parametrisatio 564 ideal PARA=imap(LIFTRING,PARA); // get the zero-dim. parametrisatio 531 565 // from LIFTRING 532 566 // compute the lift of the solution of the original ideal i … … 534 568 k=1; 535 569 // the lift has as many components as GRUNDRING has variables!=t 536 for (j=1;j<=nvars(GRUNDRING)-1;j++) 570 for (j=1;j<=nvars(GRUNDRING)-1;j++) 537 571 { 538 572 // if repl[j]=0, then the corresponding variable was not eliminated 539 if (repl[j]==0) 573 if (repl[j]==0) 540 574 { 541 LIFT[j]=PARA[k]; // thus the lift has been 575 LIFT[j]=PARA[k]; // thus the lift has been 542 576 // computed by tropicalparametrise 543 577 k++; // k checks how many entries of PARA have already been used … … 545 579 else // if repl[j]!=0, repl[j] contains replacement rule for the lift 546 580 { 547 LIFT[j]=repl[j]; // we still have to replace the vars 581 LIFT[j]=repl[j]; // we still have to replace the vars 548 582 // in repl[j] by the corresp. entries of PARA 549 583 // replace all variables!=t (from CUTDOWNRING) 550 for (l=1;l<=nvars(CUTDOWNRING)-1;l++) 584 for (l=1;l<=nvars(CUTDOWNRING)-1;l++) 551 585 { 552 586 // substitute the kth variable by PARA[k] 553 LIFT[j]=subst(LIFT[j],var(l),PARA[l]); 587 LIFT[j]=subst(LIFT[j],var(l),PARA[l]); 554 588 } 555 589 } 556 590 } 557 591 setring LIFTRING; 558 ideal LIFT=imap(REPLACEMENTRING,LIFT); 559 // test now if the LIFT has the correct valuation !!! 560 // note: it may happen, that when resubstituting PARA into 592 ideal LIFT=imap(REPLACEMENTRING,LIFT); 593 // test now if the LIFT has the correct valuation !!! 594 // note: it may happen, that when resubstituting PARA into 561 595 // the replacement rules 562 // there occured some unexpected cancellation; 596 // there occured some unexpected cancellation; 563 597 // we only know that for SOME 564 // solution of the zero-dimensional reduction NO 565 // canellation will occur, 566 // but for others this may very well happen; 598 // solution of the zero-dimensional reduction NO 599 // canellation will occur, 600 // but for others this may very well happen; 567 601 // this in particular means that 568 // we possibly MUST compute all zero-dimensional 602 // we possibly MUST compute all zero-dimensional 569 603 // solutions when cutting down! 570 604 intvec testw=precutdownw[1]; … … 590 624 kill PARA; 591 625 // only if LIFT has the right valuation we have to do something 592 if (isgood==1) 593 { 594 // it remains to reverse the original substitutions, 626 if (isgood==1) 627 { 628 // it remains to reverse the original substitutions, 595 629 // where appropriate !!! 596 // if some entry of the original w was positive, 630 // if some entry of the original w was positive, 597 631 // we replace the corresponding 598 632 // variable x_i by t^-w[i]*x_i, so we must now replace … … 611 645 */ 612 646 // if LIFTRING contains a parameter @a, change it to a 613 if ((noabs==0) and (defined(@a)==-1)) 647 if ((noabs==0) and (defined(@a)==-1)) 614 648 { 615 // pass first to a ring where a and @a 649 // pass first to a ring where a and @a 616 650 // are variables in order to use maps 617 651 poly mp=minpoly; … … 622 656 // replace @a by a in minpoly and in LIFT 623 657 map phi=INTERRING,t,a,a; 624 mp=phi(mp); 658 mp=phi(mp); 625 659 LIFT=phi(LIFT); 626 660 // pass now to a ring whithout @a and with a as parameter … … 629 663 ideal LIFT=imap(INTERRING,LIFT); 630 664 kill INTERRING; 631 } 665 } 632 666 // then export LIFT 633 export(LIFT); 667 export(LIFT); 634 668 // test the result by resubstitution 635 setring GRUNDRING; 669 setring GRUNDRING; 636 670 list resubst; 637 671 if (noresubst==0) … … 642 676 } 643 677 else 644 { 678 { 645 679 resubst=tropicalliftingresubstitute(substitute(i,t,t^(TP[jj][2])),list(LIFTRING),N*TP[jj][2]); 646 680 } 647 681 } 648 682 setring BASERING; 649 // Finally, if t has been replaced by t^N, then we have to change the 683 // Finally, if t has been replaced by t^N, then we have to change the 650 684 // third entry of TP by multiplying by N. 651 685 if (noabs==1) … … 663 697 kill LIFTRING; 664 698 } 665 // if dd!=0 and the procedure was called without the 699 // if dd!=0 and the procedure was called without the 666 700 // option findAll, then it might very well 667 // be the case that no solution is found, since 701 // be the case that no solution is found, since 668 702 // only one solution for the zero-dimensional 669 // reduction was computed and this one might have 703 // reduction was computed and this one might have 670 704 // had cancellations when resubstituting; 671 705 // if so we have to restart the process with the option findAll … … 675 709 "The procedure will be restarted with the option 'findAll'."; 676 710 "Go on by hitting RETURN!"; 677 findall=1; 711 findall=1; 678 712 noabs=0; 679 713 setring CUTDOWNRING; … … 681 715 "i";i; 682 716 "ini";tInitialIdeal(i,w,1); 683 717 684 718 /* 685 719 setring GRUNDRING; … … 699 733 } 700 734 } 701 // if internally the option findall was set, then return 735 // if internally the option findall was set, then return 702 736 // only the first solution 703 737 if (defined(hadproblems)!=0) … … 708 742 if (voice+printlevel>=2) 709 743 { 710 744 711 745 "The procedure has created a list of lists. The jth entry of this list 712 746 contains a ring, an integer and an intvec. 713 747 In this ring lives an ideal representing the wanted lifting, 714 748 if the integer is N then in the parametrisation t has to be replaced by t^1/N, 715 and if the ith component of the intvec is w[i] then the ith component in LIFT 749 and if the ith component of the intvec is w[i] then the ith component in LIFT 716 750 should be multiplied by t^-w[i]/N in order to get the parametrisation. 717 751 718 752 Suppose your list has the name L, then you can access the 1st ring via: 719 753 "; 720 754 if (findall==1) 721 755 { 722 "def LIFTRing=L[1][1]; setring LIFTRing; LIFT; 756 "def LIFTRing=L[1][1]; setring LIFTRing; LIFT; 723 757 "; 724 758 } 725 759 else 726 760 { 727 "def LIFTRing=L[1]; setring LIFTRing; LIFT; 761 "def LIFTRing=L[1]; setring LIFTRing; LIFT; 728 762 "; 729 } 763 } 730 764 } 731 765 if (findall==1) // if all solutions have been computed, return a list of lists … … 752 786 def LIFTRing=LIST[1]; 753 787 setring LIFTRing; 754 // LIFT contains the first 4 terms of a point in the variety of i 788 // LIFT contains the first 4 terms of a point in the variety of i 755 789 // over the Puiseux series field C{{t}} whose order is -w[1]/w[0]=1 756 790 LIFT; … … 780 814 // NOTE: since the last component of v is positive, the lifting 781 815 // must start with a negative power of t, which in Singular 782 // is not allowed for a variable. 816 // is not allowed for a variable. 783 817 def LIFTRing3=LIST[1]; 784 818 setring LIFTRing3; … … 835 869 string Kstring="Z/"+string(char(LIFTRing))+"Z"; 836 870 } 837 // this means that tropicalLifting was called with 871 // this means that tropicalLifting was called with 838 872 // absolute primary decomposition 839 if (size(troplift)==4) 840 { 873 if (size(troplift)==4) 874 { 841 875 setring LIFTRing; 842 876 "The lifting of the point in the tropical variety lives in the ring"; 843 877 if ((size(LIFTpar)==0) and (N==1)) 844 878 { 845 Kstring+"[[t]]"; 879 Kstring+"[[t]]"; 846 880 } 847 881 if ((size(LIFTpar)==0) and (N!=1)) 848 882 { 849 Kstring+"[[t^(1/"+string(N)+")]]"; 883 Kstring+"[[t^(1/"+string(N)+")]]"; 850 884 } 851 885 if ((size(LIFTpar)!=0) and (N!=1)) 852 { 853 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]"; 886 { 887 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]"; 854 888 } 855 889 if ((size(LIFTpar)!=0) and (N==1)) 856 { 857 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]"; 890 { 891 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]"; 858 892 } 859 893 } … … 872 906 } 873 907 if ((size(LIFTpar)!=0) and (N!=1)) 874 { 875 Kstring+"["+LIFTpar+"]/M[[t^(1/"+string(N)+")]]"; 908 { 909 Kstring+"["+LIFTpar+"]/M[[t^(1/"+string(N)+")]]"; 876 910 "where M is the maximal ideal"; 877 911 "M=<"+m+">"; 878 912 } 879 913 if ((size(LIFTpar)!=0) and (N==1)) 880 { 881 Kstring+"["+LIFTpar+"]/M[[t]]"; 914 { 915 Kstring+"["+LIFTpar+"]/M[[t]]"; 882 916 "where M is the maximal ideal"; 883 917 "M=<"+m+">"; 884 } 918 } 885 919 } 886 920 ""; … … 909 943 } 910 944 } 911 } 945 } 912 946 } 913 947 example … … 921 955 } 922 956 957 proc puiseuxExpansion (poly f,int n,list #) 958 "USAGE: puiseuxExpansion(f,n,#); f poly, n int, # list 959 ASSUME: f is a polynomial in two variables and the base field is either 960 the field of rational numbers or a finite extension thereof; 961 monomial ordering is assumed to be local; 962 the optional parameter # can be the string 'subst' 963 RETURN: list, where each entry of the list l describes the Newton-Puiseux 964 @* parametrisations of one branch of the plane curve singularity 965 @* at the origin defined by f; only the first n terms of each 966 @* parametetrisation are computed 967 @* l[i][1] = is a ring 968 @* l[i][2] = int 969 @* l[i][3] = list 970 @* 971 @* WE NOW DESCRIBE THE LIST ENTRIES l[i] IN MORE DETAIL: 972 @* - the ring l[i][1] contains an ideal LIFT and the Newton-Puiseux 973 parametrisation of the branch is given by x=t^N and y=LIFT[1], 974 where N=l[i][2] 975 @* - if the base field had a parameter and a minimal polynomial, then 976 the new base field will have a parameter and a new minimal polynomial, 977 and LIFT[2] describes how the old parameter can be computed from the new one 978 @* - if the option subst was set l[i][3] contains the polynomial where 979 y has been substituted by y(t^{1/N}) 980 REMARK: - it is best to use the procedure displayPuiseuxExpansion to 981 display the result 982 @* - the procedure requires the @sc{Singular} procedure absPrimdecGTZ to be 983 present in the package primdec.lib 984 EXAMPLE: example puiseuxExpansion; shows an example" 985 { 986 if (char(basering)!=0) 987 { 988 ERROR("In positive characteristic a Puiseux expansion will not in general exist!"); 989 } 990 if ((npars(basering)>1) or ((npars(basering)==1) and (minpoly==0))) 991 { 992 ERROR("The procedure is not implemented for this base field!"); 993 } 994 if (nvars(basering)!=2) 995 { 996 ERROR("The base ring should depend on exactly two variables."); 997 } 998 // if the ordering is not local, change to a local ordering 999 if ((1<var(1)) or (1<var(2))) 1000 { 1001 def GLOBALRING=basering; 1002 execute("ring LOCALRING=("+charstr(basering)+"),("+varstr(basering)+"),ds;"); 1003 poly f=imap(GLOBALRING,f); 1004 } 1005 // check if a substitution is necessary 1006 int noResubst; 1007 if (size(#)>1) 1008 { 1009 if (#[1]=="subst") 1010 { 1011 noResubst=0; 1012 } 1013 } 1014 // compute the Newton polygon 1015 int jj,zw; 1016 intvec w; 1017 int ggteiler; 1018 list NewtP=newtonpoly(f); 1019 list tls; 1020 list pexp; 1021 // if the base field has a minimal polynomial change the base ring and the ideal 1022 if (minpoly!=0) 1023 { 1024 poly mp=minpoly; 1025 def OLDRING=basering; 1026 execute("ring NEWRING=0,("+varstr(basering)+","+parstr(basering)+"),ds;"); 1027 ideal I=imap(OLDRING,mp),imap(OLDRING,f); 1028 } 1029 else 1030 { 1031 ideal I=f; 1032 } 1033 // for each facet of the Newton polygon compute the corresponding parametrisations 1034 // using tropicalLifting with the option "puiseux" which avoids gfan 1035 for (jj=1;jj<=size(NewtP)-1;jj++) 1036 { 1037 w=NewtP[jj]-NewtP[jj+1]; 1038 ggteiler=gcd(w[1],w[2]); 1039 zw=w[1]/ggteiler; 1040 w[1]=w[2]/ggteiler; 1041 w[2]=zw; 1042 // if we have introduced a third variable for the parameter, then w needs a third component 1043 if (nvars(basering)==3) 1044 { 1045 w[3]=0; 1046 } 1047 if (noResubst==0) 1048 { 1049 tls=tropicalLifting(I,w,n,"findAll","puiseux"); 1050 } 1051 else 1052 { 1053 tls=tropicalLifting(I,w,n,"findAll","puiseux","noResubst"); 1054 } 1055 pexp=pexp+tls; 1056 } 1057 // kill rings that are no longer needed 1058 if (defined(NEWRING)) 1059 { 1060 setring OLDRING; 1061 kill NEWRING; 1062 } 1063 if (defined(GLOBALRING)) 1064 { 1065 setring GLOBALRING; 1066 kill LOCALRING; 1067 } 1068 // remove the third entry in the list of parametrisations since we know 1069 // that none of the exponents in the parametrisation will be negative 1070 for (jj=1;jj<=size(pexp);jj++) 1071 { 1072 pexp[jj]=delete(pexp[jj],3); 1073 } 1074 return(pexp); 1075 } 1076 example 1077 { 1078 "EXAMPLE:"; 1079 echo=2; 1080 ring r=0,(x,y),ds; 1081 poly f=x2-y4+x5y7; 1082 puiseuxExpansion(puiseuxExpansion(f,3)); 1083 } 1084 1085 proc displayPuiseuxExpansion (list puiseux,list #) 1086 "USAGE: displayPuiseuxExpansion(puiseux[,#]); puiseux list, # list 1087 ASSUME: puiseux is the output of puiseuxExpansion; the optional parameter 1088 # can be the string 'subst' 1089 RETURN: none 1090 NOTE: - the procedure displays the output of the procedure puiseuxExpansion 1091 @* - if the optional parameter 'subst' is given, then the expansion is 1092 substituted into the polynomial and the result is displayed 1093 @* - if the base field had a parameter and a minimal polynomial, then the 1094 new base field will have a parameter and a minimal polynomial; 1095 var(2) is the old parameter and it is displayed how the old parameter 1096 can be computed from the new one 1097 EXAMPLE: example displayPuiseuxExpansion; shows an example" 1098 { 1099 int j; 1100 // if the procedure has to display more than one expansion 1101 if (typeof(puiseux[1])=="list") 1102 { 1103 for (j=1;j<=size(puiseux);j++) 1104 { 1105 "============================="; 1106 string(j)+". Expansion:"; 1107 ""; 1108 displayPuiseuxExpansion(puiseux[j],#); 1109 ""; 1110 } 1111 } 1112 // if the procedure has to display only one expansion 1113 else 1114 { 1115 list variablen; 1116 for (j=2;j<=nvars(basering);j++) 1117 { 1118 variablen[j-1]=string(var(j)); 1119 } 1120 def LIFTRing=puiseux[1]; 1121 int N=puiseux[2]; 1122 string LIFTpar=parstr(LIFTRing); 1123 string Kstring="Q"; 1124 setring LIFTRing; 1125 "The Puiseux expansion lives in the ring"; 1126 if ((size(LIFTpar)==0) and (N==1)) 1127 { 1128 Kstring+"[[t]]"; 1129 } 1130 if ((size(LIFTpar)==0) and (N!=1)) 1131 { 1132 Kstring+"[[t^(1/"+string(N)+")]]"; 1133 } 1134 if ((size(LIFTpar)!=0) and (N!=1)) 1135 { 1136 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]"; 1137 } 1138 if ((size(LIFTpar)!=0) and (N==1)) 1139 { 1140 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]"; 1141 } 1142 ""; 1143 "The expansion has the form:"; 1144 for (j=1;j<=size(LIFT);j++) 1145 { 1146 if (ncols(LIFT)==size(variablen)) 1147 { 1148 variablen[j]+"="+displaypoly(LIFT[j],N,0,1); 1149 } 1150 else 1151 { 1152 "var("+string(j)+")="+displaypoly(LIFT[j],N,0,1); 1153 } 1154 } 1155 if (size(#)>0) 1156 { 1157 if (#[1]=="subst") 1158 { 1159 ""; 1160 "Substituting the expansion into the polynomial gives:"; 1161 "f="+puiseux[3][size(puiseux[3])]; 1162 } 1163 } 1164 } 1165 } 1166 example 1167 { 1168 "EXAMPLE:"; 1169 echo=2; 1170 ring r=0,(x,y),ds; 1171 poly f=x2-y4+x5y7; 1172 displayPuiseuxExpansion(puiseuxExpansion(f,3)); 1173 } 923 1174 924 1175 /////////////////////////////////////////////////////////////////////////////// 925 /// Procedures concerned with drawing a tropical curve or a Newton subdivision 1176 /// Procedures concerned with drawing a tropical curve or a Newton subdivision 926 1177 /////////////////////////////////////////////////////////////////////////////// 927 1178 928 1179 proc tropicalCurve (def tp,list #) 929 1180 "USAGE: tropicalCurve(tp[,#]); tp list, # optional list 930 ASSUME: tp is list of linear polynomials of the form ax+by+c 931 with integers a, b and a rational number c representing 1181 ASSUME: tp is list of linear polynomials of the form ax+by+c 1182 with integers a, b and a rational number c representing 932 1183 a tropical Laurent polynomial defining a tropical plane curve; 933 alternatively tp can be a polynomial in Q(t)[x,y] defining a 934 tropical plane curve via the valuation map; 935 the basering must have a global monomial ordering, 1184 alternatively tp can be a polynomial in Q(t)[x,y] defining a 1185 tropical plane curve via the valuation map; 1186 the basering must have a global monomial ordering, 936 1187 two variables and up to one parameter! 937 RETURN: list, each entry i=1,...,size(l)-1 corresponds to a vertex 1188 RETURN: list, each entry i=1,...,size(l)-1 corresponds to a vertex 938 1189 in the tropical plane curve defined by tp 939 1190 l[i][1] = x-coordinate of the ith vertex 940 1191 l[i][2] = y-coordinate of the ith vertex 941 l[i][3] = intmat, if j is an entry in the first row 1192 l[i][3] = intmat, if j is an entry in the first row 942 1193 of intmat then the ith vertex of 943 the tropical curve is connected to the 1194 the tropical curve is connected to the 944 1195 jth vertex with multiplicity given 945 1196 by the corresponding entry in the second row 946 l[i][4] = list of lists, the first entry of a list is 947 a primitive integer vector defining the direction 948 of an unbounded edge emerging from the ith vertex 949 of the graph, the corresponding second entry in 1197 l[i][4] = list of lists, the first entry of a list is 1198 a primitive integer vector defining the direction 1199 of an unbounded edge emerging from the ith vertex 1200 of the graph, the corresponding second entry in 950 1201 the list is the multiplicity of the unbounded edge 951 l[i][5] = a polynomial whose monomials mark the vertices 1202 l[i][5] = a polynomial whose monomials mark the vertices 952 1203 in the Newton polygon corresponding to the entries 953 in tp which take the common minimum at the ith 954 vertex -- if some coefficient a or b of the 955 linear polynomials in the input was negative, 1204 in tp which take the common minimum at the ith 1205 vertex -- if some coefficient a or b of the 1206 linear polynomials in the input was negative, 956 1207 then each monomial has to be shifted by 957 1208 the values in l[size(l)][3] 958 l[size(l)][1] = list, the entries describe the boundary 1209 l[size(l)][1] = list, the entries describe the boundary 959 1210 points of the Newton subdivision 960 l[size(l)][2] = list, the entries are pairs of integer 1211 l[size(l)][2] = list, the entries are pairs of integer 961 1212 vectors defining an interior 962 1213 edge of the Newton subdivision 963 l[size(l)][3] = intvec, the monmials occuring in l[i][5] 964 have to be shifted by this vector 965 in order to represent marked 1214 l[size(l)][3] = intvec, the monmials occuring in l[i][5] 1215 have to be shifted by this vector 1216 in order to represent marked 966 1217 vertices in the Newton polygon 967 NOTE: here the tropical polynomial is supposed to be the MINIMUM 968 of the linear forms in tp, unless the optional input #[1] 1218 NOTE: here the tropical polynomial is supposed to be the MINIMUM 1219 of the linear forms in tp, unless the optional input #[1] 969 1220 is the string 'max' 970 1221 EXAMPLE: example tropicalCurve; shows an example" … … 979 1230 ERROR("The basering should have a global monomial ordering, e.g. ring r=(0,t),(x,y),dp;"); 980 1231 } 981 // if you insert a single polynomial instead of an ideal 1232 // if you insert a single polynomial instead of an ideal 982 1233 // representing a tropicalised polynomial, 983 // then we compute first the tropicalisation of this polynomial 1234 // then we compute first the tropicalisation of this polynomial 984 1235 // -- this feature is not documented in the above help string 985 1236 if (typeof(tp)=="poly") 986 1237 { 987 // exclude the case that the basering has not precisely 1238 // exclude the case that the basering has not precisely 988 1239 // one parameter and two indeterminates 989 1240 if ((npars(basering)!=1) or (nvars(basering)!=2)) 990 1241 { 991 ERROR("The basering should have precisely one parameter and two indeterminates!"); 1242 ERROR("The basering should have precisely one parameter and two indeterminates!"); 992 1243 } 993 1244 poly f=tp; … … 998 1249 if (nvars(basering) != 2) 999 1250 { 1000 ERROR("The basering should have precisely two indeterminates!"); 1001 } 1002 // -1) Exclude the pathological case that the defining 1251 ERROR("The basering should have precisely two indeterminates!"); 1252 } 1253 // -1) Exclude the pathological case that the defining 1003 1254 // tropical polynomial has only one term, 1004 1255 // so that the tropical variety is not defined. … … 1008 1259 intmat M[2][1]=0,0; 1009 1260 return(list(list(0,0,M,list(),detropicalise(tp[1])),list(list(leadexp(detropicalise(tp[1]))),list()))); 1010 } 1011 // 0) If the input was a list of linear polynomials, 1261 } 1262 // 0) If the input was a list of linear polynomials, 1012 1263 // then some coefficient of x or y can be negative, 1013 // i.e. the input corresponds to the tropical curve 1264 // i.e. the input corresponds to the tropical curve 1014 1265 // of a Laurent polynomial. In that case we should 1015 // add some ax+by, so that all coefficients are positive. 1266 // add some ax+by, so that all coefficients are positive. 1016 1267 // This does not change the tropical curve. 1017 // however, we have to save (a,b), since the Newton 1268 // however, we have to save (a,b), since the Newton 1018 1269 // polygone has to be shifted by (-a,-b). 1019 1270 poly aa,bb; // koeffizienten … … 1027 1278 { 1028 1279 bb=koeffizienten(tp[i],2); 1029 } 1280 } 1030 1281 } 1031 1282 if ((aa!=0) or (bb!=0)) … … 1036 1287 } 1037 1288 } 1038 // 1) compute the vertices of the tropical curve 1289 // 1) compute the vertices of the tropical curve 1039 1290 // defined by tp and the Newton subdivision 1040 1291 list vtp=verticesTropicalCurve(tp,#); 1041 // if vtp is empty, then the Newton polygone is just 1292 // if vtp is empty, then the Newton polygone is just 1042 1293 // a line segment and constitutes a bunch of lines 1043 1294 // which can be computed by bunchOfLines … … 1046 1297 return(bunchOfLines(tp)); 1047 1298 } 1048 // 2) store all vertices belonging to the ith part of the 1299 // 2) store all vertices belonging to the ith part of the 1049 1300 // Newton subdivision in the list vtp[i] as 4th entry, 1050 1301 // and store those, which are not corners of the ith subdivision polygon 1051 1302 // in vtp[i][6] 1052 poly nwt; 1303 poly nwt; 1053 1304 list boundaryNSD; // stores the boundary of a Newton subdivision 1054 intmat zwsp[2][1]; // used for intermediate storage 1305 intmat zwsp[2][1]; // used for intermediate storage 1055 1306 for (i=1;i<=size(vtp);i++) 1056 1307 { 1057 1308 k=1; 1058 nwt=vtp[i][3]; // the polynomial representing the 1309 nwt=vtp[i][3]; // the polynomial representing the 1059 1310 // ith part of the Newton subdivision 1060 // store the vertices of the ith part of the 1311 // store the vertices of the ith part of the 1061 1312 // Newton subdivision in the list newton 1062 list newton; 1313 list newton; 1063 1314 while (nwt!=0) 1064 1315 { … … 1067 1318 k++; 1068 1319 } 1069 boundaryNSD=findOrientedBoundary(newton);// a list of the vertices 1070 // of the Newton subdivision 1071 // as integer vectors (only those 1072 // on the boundary, and oriented 1320 boundaryNSD=findOrientedBoundary(newton);// a list of the vertices 1321 // of the Newton subdivision 1322 // as integer vectors (only those 1323 // on the boundary, and oriented 1073 1324 // clockwise) 1074 1325 vtp[i][4]=boundaryNSD[1]; 1075 1326 vtp[i][5]=boundaryNSD[2]; 1076 vtp[i][6]=zwsp; // the entries of the first row will denote to which 1077 // vertex the ith one is connected 1078 // and the entries of the second row will denote 1327 vtp[i][6]=zwsp; // the entries of the first row will denote to which 1328 // vertex the ith one is connected 1329 // and the entries of the second row will denote 1079 1330 //with which multiplicity 1080 1331 kill newton; // we kill the superflous list 1081 1332 } 1082 // 3) Next we build for each part of the Newton 1333 // 3) Next we build for each part of the Newton 1083 1334 // subdivision the list of all pairs of vertices on the 1084 1335 // boundary, which are involved, including those which are not corners … … 1097 1348 kill ipairs; 1098 1349 } 1099 // 4) Check for all pairs of verticies in the Newton diagram if they 1350 // 4) Check for all pairs of verticies in the Newton diagram if they 1100 1351 // occur in two different parts of the Newton subdivision 1101 int deleted; // if a pair occurs in two NSD, it can be removed 1352 int deleted; // if a pair occurs in two NSD, it can be removed 1102 1353 // from both - deleted is then set to 1 1103 list inneredges; // contains the list of all pairs contained in two NSD 1354 list inneredges; // contains the list of all pairs contained in two NSD 1104 1355 // - these are inner the edges of NSD 1105 1356 int ggt; 1106 1357 d=1; // counts the inner edges 1107 1358 for (i=1;i<=size(pairs)-1;i++) 1108 { 1359 { 1109 1360 for (j=i+1;j<=size(pairs);j++) 1110 1361 { … … 1113 1364 deleted=0; 1114 1365 for (l=size(pairs[j]);l>=1 and deleted==0;l--) 1115 { 1366 { 1116 1367 if (((pairs[i][k][1]==pairs[j][l][1]) and (pairs[i][k][2]==pairs[j][l][2])) or ((pairs[i][k][1]==pairs[j][l][2]) and (pairs[i][k][2]==pairs[j][l][1]))) 1117 1368 { … … 1119 1370 d++; 1120 1371 ggt=abs(gcd(pairs[i][k][1][1]-pairs[i][k][2][1],pairs[i][k][1][2]-pairs[i][k][2][2])); 1121 zwsp=j,ggt; // and it is recorded that the ith and jth 1372 zwsp=j,ggt; // and it is recorded that the ith and jth 1122 1373 // vertex should be connected with mult ggt 1123 1374 vtp[i][6]=intmatconcat(vtp[i][6],zwsp); 1124 1375 zwsp=i,ggt; 1125 1376 vtp[j][6]=intmatconcat(vtp[j][6],zwsp); 1126 pairs[i]=delete(pairs[i],k); // finally the pair is deleted 1377 pairs[i]=delete(pairs[i],k); // finally the pair is deleted 1127 1378 // from both sets of pairs 1128 1379 pairs[j]=delete(pairs[j],l); … … 1164 1415 } 1165 1416 } 1166 // 6.3) Order the vertices such that passing from one to the next we 1417 // 6.3) Order the vertices such that passing from one to the next we 1167 1418 // travel along the boundary of the Newton polytope clock wise. 1168 1419 boundaryNSD=findOrientedBoundary(vertices); 1169 1420 list orderedvertices=boundaryNSD[1]; 1170 1421 // 7) Find the unbounded edges emerging from a vertex in the tropical curve. 1171 // For this we check the remaining pairs for the ith NSD. 1422 // For this we check the remaining pairs for the ith NSD. 1172 1423 // Each pair is ordered according 1173 // to the order in which the vertices occur in orderedvertices. 1424 // to the order in which the vertices occur in orderedvertices. 1174 1425 // The direction of the 1175 // unbounded edge is then the outward pointing primitive normal 1426 // unbounded edge is then the outward pointing primitive normal 1176 1427 // vector to the vector 1177 1428 // pointing from the first vertex in a pair to the second one. … … 1183 1434 for (i=1;i<=size(pairs);i++) 1184 1435 { 1185 list ubedges; // stores the unbounded edges 1436 list ubedges; // stores the unbounded edges 1186 1437 k=1; // counts the unbounded edges 1187 1438 for (j=1;j<=size(pairs[i]);j++) 1188 1439 { 1189 1440 // computes the position of the vertices in the 1190 pos1=positionInList(orderedvertices,pairs[i][j][1]); 1441 pos1=positionInList(orderedvertices,pairs[i][j][1]); 1191 1442 // pair in the list orderedvertices 1192 pos2=positionInList(orderedvertices,pairs[i][j][2]); 1443 pos2=positionInList(orderedvertices,pairs[i][j][2]); 1193 1444 if (((pos1>pos2) and !((pos1==size(orderedvertices)) and (pos2==1))) or ((pos2==size(orderedvertices)) and (pos1==1))) // reorders them if necessary 1194 1445 { … … 1198 1449 } 1199 1450 // the vector pointing from vertex 1 in the pair to vertex2 1200 normalvector=pairs[i][j][2]-pairs[i][j][1]; 1451 normalvector=pairs[i][j][2]-pairs[i][j][1]; 1201 1452 ggt=gcd(normalvector[1],normalvector[2]); // the gcd of the entries 1202 1453 zw=normalvector[2]; // create the outward pointing normal vector … … 1230 1481 kill ubedges; 1231 1482 } 1232 // 8) Store the computed information for the ith part 1483 // 8) Store the computed information for the ith part 1233 1484 // of the NSD in the list graph[i]. 1234 1485 list graph,gr; … … 1236 1487 { 1237 1488 // the first coordinate of the ith vertex of the tropical curve 1238 gr[1]=vtp[i][1]; 1489 gr[1]=vtp[i][1]; 1239 1490 // the second coordinate of the ith vertex of the tropical curve 1240 gr[2]=vtp[i][2]; 1491 gr[2]=vtp[i][2]; 1241 1492 // to which vertices is the ith vertex of the tropical curve connected 1242 gr[3]=vtp[i][6]; 1243 // the directions unbounded edges emerging from the ith 1493 gr[3]=vtp[i][6]; 1494 // the directions unbounded edges emerging from the ith 1244 1495 // vertex of the trop. curve 1245 gr[4]=vtp[i][7]; 1246 // the vertices of the boundary of the ith part of the NSD 1247 gr[5]=vtp[i][3]; 1496 gr[4]=vtp[i][7]; 1497 // the vertices of the boundary of the ith part of the NSD 1498 gr[5]=vtp[i][3]; 1248 1499 graph[i]=gr; 1249 1500 } … … 1264 1515 } 1265 1516 } 1266 // 10) Finally store the boundary vertices and 1517 // 10) Finally store the boundary vertices and 1267 1518 // the inner edges as last entry in the list graph. 1268 1519 // This represents the NSD. … … 1281 1532 // the coordinates of the first vertex are graph[1][1],graph[1][2]; 1282 1533 graph[1][1],graph[1][2]; 1283 // the first vertex is connected to the vertices 1534 // the first vertex is connected to the vertices 1284 1535 // graph[1][3][1,1..ncols(graph[1][3])] 1285 1536 intmat M=graph[1][3]; 1286 1537 M[1,1..ncols(graph[1][3])]; 1287 // the weights of the edges to these vertices are 1538 // the weights of the edges to these vertices are 1288 1539 // graph[1][3][2,1..ncols(graph[1][3])] 1289 1540 M[2,1..ncols(graph[1][3])]; 1290 1541 // from the first vertex emerge size(graph[1][4]) unbounded edges 1291 1542 size(graph[1][4]); 1292 // the primitive integral direction vector of the first unbounded edge 1543 // the primitive integral direction vector of the first unbounded edge 1293 1544 // of the first vertex 1294 1545 graph[1][4][1][1]; 1295 1546 // the weight of the first unbounded edge of the first vertex 1296 1547 graph[1][4][1][2]; 1297 // the monomials which are part of the Newton subdivision of the first vertex 1548 // the monomials which are part of the Newton subdivision of the first vertex 1298 1549 graph[1][5]; 1299 // connecting the points in graph[size(graph)][1] we get 1550 // connecting the points in graph[size(graph)][1] we get 1300 1551 // the boundary of the Newton polytope 1301 1552 graph[size(graph)][1]; 1302 // an entry in graph[size(graph)][2] is a pair of points 1553 // an entry in graph[size(graph)][2] is a pair of points 1303 1554 // in the Newton polytope bounding an inner edge 1304 1555 graph[size(graph)][2][1]; … … 1309 1560 proc drawTropicalCurve (def f,list #) 1310 1561 "USAGE: drawTropicalCurve(f[,#]); f poly or list, # optional list 1311 ASSUME: f is list of linear polynomials of the form ax+by+c with 1312 integers a, b and a rational number c representing a tropical 1562 ASSUME: f is list of linear polynomials of the form ax+by+c with 1563 integers a, b and a rational number c representing a tropical 1313 1564 Laurent polynomial defining a tropical plane curve; 1314 alternatively f can be a polynomial in Q(t)[x,y] defining 1315 a tropical plane curve via the valuation map; 1316 the basering must have a global monomial ordering, two 1565 alternatively f can be a polynomial in Q(t)[x,y] defining 1566 a tropical plane curve via the valuation map; 1567 the basering must have a global monomial ordering, two 1317 1568 variables and up to one parameter! 1318 1569 RETURN: NONE 1319 NOTE: - the procedure creates the files /tmp/tropicalcurveNUMBER.tex and 1320 /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four 1321 digit integer; 1570 NOTE: - the procedure creates the files /tmp/tropicalcurveNUMBER.tex and 1571 /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four 1572 digit integer; 1322 1573 moreover it displays the tropical curve via kghostview; 1323 if you wish to remove all these files from /tmp, 1574 if you wish to remove all these files from /tmp, 1324 1575 call the procedure cleanTmp 1325 1576 @* - edges with multiplicity greater than one carry this multiplicity 1326 1577 @* - if # is empty, then the tropical curve is computed w.r.t. minimum, 1327 if #[1] is the string 'max', then it is computed w.r.t. maximum 1328 @* - if the last optional argument is 'onlytexfile' then only the 1329 latex file is produced; this option should be used if kghostview 1578 if #[1] is the string 'max', then it is computed w.r.t. maximum 1579 @* - if the last optional argument is 'onlytexfile' then only the 1580 latex file is produced; this option should be used if kghostview 1330 1581 is not installed on your system 1331 @* - note that lattice points in the Newton subdivision which are 1332 black correspond to markings of the marked subdivision, 1582 @* - note that lattice points in the Newton subdivision which are 1583 black correspond to markings of the marked subdivision, 1333 1584 while lattice points in grey are not marked 1334 1585 EXAMPLE: example drawTropicalCurve shows an example" … … 1348 1599 if (typeof(f)=="poly") 1349 1600 { 1350 // exclude the case that the basering has not precisely 1601 // exclude the case that the basering has not precisely 1351 1602 // one parameter and two indeterminates 1352 1603 if ((npars(basering)!=1) or (nvars(basering)!=2)) 1353 1604 { 1354 ERROR("The basering should have precisely one parameter and two indeterminates!"); 1605 ERROR("The basering should have precisely one parameter and two indeterminates!"); 1355 1606 } 1356 1607 // if the characteristic of the base field is not 0 then replace the base field … … 1371 1622 texf="\\mbox{\\tt The defining equation was not handed over!}"; 1372 1623 list graph=f; 1373 } 1624 } 1374 1625 else 1375 1626 { // write the tropical polynomial defined by f 1376 1627 if (size(#)==0) 1377 { 1628 { 1378 1629 texf="\\min\\{"; 1379 1630 } … … 1384 1635 for (j=1;j<=size(f);j++) 1385 1636 { 1386 texf=texf+texPolynomial(f[j]); 1637 texf=texf+texPolynomial(f[j]); 1387 1638 if (j<size(f)) 1388 1639 { … … 1393 1644 texf=texf+"\\}"; 1394 1645 } 1395 } 1646 } 1396 1647 list graph=tropicalCurve(f,#); // the graph of the tropical polynomial f 1397 1648 } … … 1411 1662 \\addtolength{\\topmargin}{-\\headheight} 1412 1663 \\addtolength{\\topmargin}{-\\topskip} 1413 \\setlength{\\textheight}{267mm} 1664 \\setlength{\\textheight}{267mm} 1414 1665 \\addtolength{\\textheight}{\\topskip} 1415 1666 \\addtolength{\\textheight}{-\\footskip} 1416 1667 \\addtolength{\\textheight}{-30pt} 1417 \\setlength{\\oddsidemargin}{-1in} 1668 \\setlength{\\oddsidemargin}{-1in} 1418 1669 \\addtolength{\\oddsidemargin}{20mm} 1419 1670 \\setlength{\\evensidemargin}{\\oddsidemargin} 1420 \\setlength{\\textwidth}{170mm} 1671 \\setlength{\\textwidth}{170mm} 1421 1672 1422 1673 \\begin{document} 1423 1674 \\parindent0cm 1424 1675 \\begin{center} 1425 \\large\\bf The Tropicalisation of 1676 \\large\\bf The Tropicalisation of 1426 1677 1427 1678 \\bigskip … … 1449 1700 1450 1701 \\begin{center} 1451 "+texDrawNewtonSubdivision(graph,#)+" 1702 "+texDrawNewtonSubdivision(graph,#)+" 1452 1703 \\end{center} 1453 1704 \\end{document}"; … … 1456 1707 int rdnum=random(1000,9999); 1457 1708 write(":w /tmp/tropicalcurve"+string(rdnum)+".tex",TEXBILD); 1458 system("sh","cd /tmp; latex /tmp/tropicalcurve"+string(rdnum)+".tex; dvips /tmp/tropicalcurve"+string(rdnum)+".dvi -o; /bin/rm tropicalcurve"+string(rdnum)+".log; /bin/rm tropicalcurve"+string(rdnum)+".aux; /bin/rm tropicalcurve"+string(rdnum)+".ps?; /bin/rm tropicalcurve"+string(rdnum)+".dvi; kghostview tropicalcurve"+string(rdnum)+".ps &"); 1709 system("sh","cd /tmp; latex /tmp/tropicalcurve"+string(rdnum)+".tex; dvips /tmp/tropicalcurve"+string(rdnum)+".dvi -o; /bin/rm tropicalcurve"+string(rdnum)+".log; /bin/rm tropicalcurve"+string(rdnum)+".aux; /bin/rm tropicalcurve"+string(rdnum)+".ps?; /bin/rm tropicalcurve"+string(rdnum)+".dvi; kghostview tropicalcurve"+string(rdnum)+".ps &"); 1459 1710 } 1460 1711 else … … 1483 1734 proc drawNewtonSubdivision (def f,list #) 1484 1735 "USAGE: drawTropicalCurve(f[,#]); f poly, # optional list 1485 ASSUME: f is list of linear polynomials of the form ax+by+c with integers 1486 a, b and a rational number c representing a tropical Laurent 1736 ASSUME: f is list of linear polynomials of the form ax+by+c with integers 1737 a, b and a rational number c representing a tropical Laurent 1487 1738 polynomial defining a tropical plane curve; 1488 alternatively f can be a polynomial in Q(t)[x,y] defining a tropical 1489 plane curve via the valuation map; 1490 the basering must have a global monomial ordering, two variables 1739 alternatively f can be a polynomial in Q(t)[x,y] defining a tropical 1740 plane curve via the valuation map; 1741 the basering must have a global monomial ordering, two variables 1491 1742 and up to one parameter! 1492 1743 RETURN: NONE 1493 NOTE: - the procedure creates the files /tmp/newtonsubdivisionNUMBER.tex, 1494 and /tmp/newtonsubdivisionNUMBER.ps, where NUMBER is a random 1495 four digit integer; 1744 NOTE: - the procedure creates the files /tmp/newtonsubdivisionNUMBER.tex, 1745 and /tmp/newtonsubdivisionNUMBER.ps, where NUMBER is a random 1746 four digit integer; 1496 1747 moreover it desplays the tropical curve defined by f via kghostview; 1497 if you wish to remove all these files from /tmp, call the procedure 1748 if you wish to remove all these files from /tmp, call the procedure 1498 1749 cleanTmp; 1499 @* if # is empty, then the tropical curve is computed w.r.t. minimum, 1500 if #[1] is the string 'max', then it is computed w.r.t. maximum 1501 @* - note that lattice points in the Newton subdivision which are black 1502 correspond to markings of the marked subdivision, while lattice 1750 @* if # is empty, then the tropical curve is computed w.r.t. minimum, 1751 if #[1] is the string 'max', then it is computed w.r.t. maximum 1752 @* - note that lattice points in the Newton subdivision which are black 1753 correspond to markings of the marked subdivision, while lattice 1503 1754 points in grey are not marked 1504 1755 EXAMPLE: example drawNewtonSubdivision; shows an example" … … 1514 1765 { // write the tropical polynomial defined by f 1515 1766 if (size(#)==0) 1516 { 1767 { 1517 1768 texf="\\min\\{"; 1518 1769 } … … 1523 1774 for (j=1;j<=size(f);j++) 1524 1775 { 1525 texf=texf+texPolynomial(f[j]); 1776 texf=texf+texPolynomial(f[j]); 1526 1777 if (j<size(f)) 1527 1778 { … … 1532 1783 texf=texf+"\\}"; 1533 1784 } 1534 } 1785 } 1535 1786 list graph=tropicalCurve(f,#); // the graph of the tropical polynomial f 1536 1787 } … … 1540 1791 \\parindent0cm 1541 1792 \\begin{center} 1542 \\large\\bf The Newtonsubdivison of 1793 \\large\\bf The Newtonsubdivison of 1543 1794 \\begin{displaymath} 1544 1795 f="+texf+" … … 1548 1799 1549 1800 \\begin{center} 1550 "+texDrawNewtonSubdivision(graph)+ 1801 "+texDrawNewtonSubdivision(graph)+ 1551 1802 " \\end{center} 1552 1803 … … 1554 1805 int rdnum=random(1000,9999); 1555 1806 write(":w /tmp/newtonsubdivision"+string(rdnum)+".tex",TEXBILD); 1556 system("sh","cd /tmp; latex /tmp/newtonsubdivision"+string(rdnum)+".tex; dvips /tmp/newtonsubdivision"+string(rdnum)+".dvi -o; /bin/rm newtonsubdivision"+string(rdnum)+".log; /bin/rm newtonsubdivision"+string(rdnum)+".aux; /bin/rm newtonsubdivision"+string(rdnum)+".ps?; /bin/rm newtonsubdivision"+string(rdnum)+".dvi; kghostview newtonsubdivision"+string(rdnum)+".ps &"); 1807 system("sh","cd /tmp; latex /tmp/newtonsubdivision"+string(rdnum)+".tex; dvips /tmp/newtonsubdivision"+string(rdnum)+".dvi -o; /bin/rm newtonsubdivision"+string(rdnum)+".log; /bin/rm newtonsubdivision"+string(rdnum)+".aux; /bin/rm newtonsubdivision"+string(rdnum)+".ps?; /bin/rm newtonsubdivision"+string(rdnum)+".dvi; kghostview newtonsubdivision"+string(rdnum)+".ps &"); 1557 1808 // return(TEXBILD); 1558 1809 } … … 1579 1830 proc tropicalJInvariant (def f,list #) 1580 1831 "USAGE: tropicalJInvariant(f[,#]); f poly or list, # optional list 1581 ASSUME: f is list of linear polynomials of the form ax+by+c with integers 1582 a, b and a rational number c representing a tropical Laurent 1832 ASSUME: f is list of linear polynomials of the form ax+by+c with integers 1833 a, b and a rational number c representing a tropical Laurent 1583 1834 polynomial defining a tropical plane curve; 1584 alternatively f can be a polynomial in Q(t)[x,y] defining a 1585 tropical plane curve via the valuation map; 1586 @* the basering must have a global monomial ordering, two variables 1835 alternatively f can be a polynomial in Q(t)[x,y] defining a 1836 tropical plane curve via the valuation map; 1837 @* the basering must have a global monomial ordering, two variables 1587 1838 and up to one parameter! 1588 RETURN: number, if the graph underlying the tropical curve has precisely 1589 one loop then its weighted lattice length is returned, 1839 RETURN: number, if the graph underlying the tropical curve has precisely 1840 one loop then its weighted lattice length is returned, 1590 1841 otherwise the result will be -1 1591 NOTE: - if the tropical curve is elliptic and its embedded graph has 1592 precisely one loop, then the weigthed lattice length of 1842 NOTE: - if the tropical curve is elliptic and its embedded graph has 1843 precisely one loop, then the weigthed lattice length of 1593 1844 the loop is its tropical j-invariant 1594 @* - the procedure checks if the embedded graph of the tropical 1595 curve has genus one, but it does NOT check if the loop can 1596 be resolved, so that the curve is not a proper tropical 1597 elliptic curve 1598 @* - if the embedded graph of a tropical elliptic curve has more 1599 than one loop, then all but one can be resolved, but this is 1600 not observed by this procedure, so it will not compute 1845 @* - the procedure checks if the embedded graph of the tropical 1846 curve has genus one, but it does NOT check if the loop can 1847 be resolved, so that the curve is not a proper tropical 1848 elliptic curve 1849 @* - if the embedded graph of a tropical elliptic curve has more 1850 than one loop, then all but one can be resolved, but this is 1851 not observed by this procedure, so it will not compute 1601 1852 the j-invariant 1602 1853 @* - if # is empty, then the tropical curve is computed w.r.t. minimum, 1603 if #[1] is the string 'max', then it is computed w.r.t. maximum 1604 @* - the tropicalJInvariant of a plane tropical cubic is the 1605 'cycle length' of the cubic as introduced in the paper: 1606 Eric Katz, Hannah Markwig, Thomas Markwig: The j-invariant 1854 if #[1] is the string 'max', then it is computed w.r.t. maximum 1855 @* - the tropicalJInvariant of a plane tropical cubic is the 1856 'cycle length' of the cubic as introduced in the paper: 1857 Eric Katz, Hannah Markwig, Thomas Markwig: The j-invariant 1607 1858 of a cubic tropical plane curve. 1608 1859 EXAMPLE: example tropicalJInvariant; shows an example" … … 1618 1869 { 1619 1870 if (typeof(f[1])=="list") 1620 { 1871 { 1621 1872 list graph=f; 1622 1873 } … … 1630 1881 { 1631 1882 ERROR("This is no valid input."); 1632 } 1883 } 1633 1884 } 1634 1885 } … … 1647 1898 genus=-genus/2; // we have counted each bounded edge twice 1648 1899 genus=genus+size(graph); // the genus is 1-#bounded_edges+#vertices 1649 // 3) if the embedded graph has not genus one, 1900 // 3) if the embedded graph has not genus one, 1650 1901 // we cannot compute the j-invariant 1651 1902 if(genus!=1) … … 1659 1910 else 1660 1911 { 1661 intmat nullmat[2][1]; // used to set 1662 // 4) find a vertex which has only one bounded edge, 1663 // if none exists zero is returned, 1912 intmat nullmat[2][1]; // used to set 1913 // 4) find a vertex which has only one bounded edge, 1914 // if none exists zero is returned, 1664 1915 // otherwise the number of the vertex in the list graph 1665 int nonloopvertex=findNonLoopVertex(graph); 1916 int nonloopvertex=findNonLoopVertex(graph); 1666 1917 int dv; //checks if vert. has been found to which nonloopvertex is connected 1667 intmat delvert; // takes for a moment graph[i][3] of the vertex 1918 intmat delvert; // takes for a moment graph[i][3] of the vertex 1668 1919 // to which nonloopvertex is connected 1669 // 5) delete successively vertices in the graph which 1920 // 5) delete successively vertices in the graph which 1670 1921 // have only one bounded edge 1671 1922 while (nonloopvertex>0) 1672 1923 { 1673 // find the only vertex to which the nonloopvertex 1924 // find the only vertex to which the nonloopvertex 1674 1925 // is connected, when it is found 1675 1926 // delete the connection in graph[i][3] and set dv=1 … … 1684 1935 { 1685 1936 delvert=graph[i][3]; 1686 delvert=intmatcoldelete(delvert,j); // delete the connection (note 1937 delvert=intmatcoldelete(delvert,j); // delete the connection (note 1687 1938 // there must have been two!) 1688 1939 dv=1; … … 1692 1943 } 1693 1944 } 1694 graph[nonloopvertex][3]=nullmat; // the only connection of nonloopvertex 1945 graph[nonloopvertex][3]=nullmat; // the only connection of nonloopvertex 1695 1946 // is killed 1696 nonloopvertex=findNonLoopVertex(graph); // find the next vertex 1947 nonloopvertex=findNonLoopVertex(graph); // find the next vertex 1697 1948 // which has only one edge 1698 1949 } … … 1700 1951 intvec loop,weights; // encodes the loop and the edges 1701 1952 i=1; 1702 // start by finding some vertex which belongs to the loop 1703 while (loop==0) 1953 // start by finding some vertex which belongs to the loop 1954 while (loop==0) 1704 1955 { 1705 1956 // if graph[i][3] of a vertex in the loop has 2 columns, all others have 1 1706 if (ncols(graph[i][3])==1) 1957 if (ncols(graph[i][3])==1) 1707 1958 { 1708 1959 i++; … … 1710 1961 else 1711 1962 { 1712 loop[1]=i; // a starting vertex is found 1713 loop[2]=graph[i][3][1,1]; // it is connected to vertex with this number 1963 loop[1]=i; // a starting vertex is found 1964 loop[2]=graph[i][3][1,1]; // it is connected to vertex with this number 1714 1965 weights[2]=graph[i][3][2,1]; // and the edge has this weight 1715 1966 } … … 1719 1970 while (j!=i) // the loop ends with the same vertex with which it starts 1720 1971 { 1721 // the first row of graph[j][3] has two entries 1972 // the first row of graph[j][3] has two entries 1722 1973 // corresponding to the two vertices 1723 // to which the active vertex j is connected; 1974 // to which the active vertex j is connected; 1724 1975 // one is loop[k-1], i.e. the one which 1725 1976 // precedes j in the loop; we have to choose the other one 1726 if (graph[j][3][1,1]==loop[k-1]) 1977 if (graph[j][3][1,1]==loop[k-1]) 1727 1978 { 1728 1979 loop[k+1]=graph[j][3][1,2]; … … 1735 1986 } 1736 1987 j=loop[k+1]; // set loop[k+1] the new active vertex 1737 k++; 1738 } 1988 k++; 1989 } 1739 1990 // 7) compute for each edge in the loop the lattice length 1740 poly xcomp,ycomp; // the x- and y-components of the vectors 1991 poly xcomp,ycomp; // the x- and y-components of the vectors 1741 1992 // connecting two vertices of the loop 1742 number nenner; // the product of the denominators of 1993 number nenner; // the product of the denominators of 1743 1994 // the x- and y-components 1744 1995 number jinvariant; // the j-invariant 1745 int eins,zwei,ggt; 1996 int eins,zwei,ggt; 1746 1997 for (i=1;i<=size(loop)-1;i++) // compute the lattice length for each edge 1747 1998 { 1748 xcomp=graph[loop[i]][1]-graph[loop[i+1]][1]; 1749 ycomp=graph[loop[i]][2]-graph[loop[i+1]][2]; 1999 xcomp=graph[loop[i]][1]-graph[loop[i+1]][1]; 2000 ycomp=graph[loop[i]][2]-graph[loop[i+1]][2]; 1750 2001 nenner=denominator(leadcoef(xcomp))*denominator(leadcoef(ycomp)); 1751 execute("eins="+string(numerator(leadcoef(nenner*xcomp)))+";"); 1752 execute("zwei="+string(numerator(leadcoef(nenner*ycomp)))+";"); 2002 execute("eins="+string(numerator(leadcoef(nenner*xcomp)))+";"); 2003 execute("zwei="+string(numerator(leadcoef(nenner*ycomp)))+";"); 1753 2004 ggt=gcd(eins,zwei); // the lattice length is the "gcd" 1754 2005 // of the x-component and the y-component 1755 jinvariant=jinvariant+ggt/(nenner*weights[i+1]); // divided by the 2006 jinvariant=jinvariant+ggt/(nenner*weights[i+1]); // divided by the 1756 2007 // weight of the edge 1757 2008 } 1758 return(jinvariant); 2009 return(jinvariant); 1759 2010 } 1760 2011 } … … 1770 2021 // the curve can have arbitrary degree 1771 2022 tropicalJInvariant(t*(x7+y7+1)+1/t*(x4+y4+x2+y2+x3y+xy3)+1/t7*x2y2); 1772 // the procedure does not realise, if the embedded graph of the tropical 2023 // the procedure does not realise, if the embedded graph of the tropical 1773 2024 // curve has a loop that can be resolved 1774 2025 tropicalJInvariant(1+x+y+xy+tx2y+txy2); 1775 2026 // but it does realise, if the curve has no loop at all ... 1776 2027 tropicalJInvariant(x+y+1); 1777 // or if the embedded graph has more than one loop - even if only one 2028 // or if the embedded graph has more than one loop - even if only one 1778 2029 // cannot be resolved 1779 2030 tropicalJInvariant(1+x+y+xy+tx2y+txy2+t3x5+t3y5+tx2y2+t2xy4+t2yx4); … … 1784 2035 proc weierstrassForm (poly f,list #) 1785 2036 "USAGE: weierstrassForm(wf[,#]); wf poly, # list 1786 ASSUME: wf is a a polynomial whose Newton polygon has precisely one 1787 interior lattice point, so that it defines an elliptic curve 2037 ASSUME: wf is a a polynomial whose Newton polygon has precisely one 2038 interior lattice point, so that it defines an elliptic curve 1788 2039 on the toric surface corresponding to the Newton polygon 1789 2040 RETURN: poly, the Weierstrass normal form of the polynomial … … 1791 2042 to Fernando Rodriguez Villegas, villegas@math.utexas.edu 1792 2043 @* - the characteristic of the base field should not be 2 or 3 1793 @* - if an additional argument # is given, a simplified Weierstrass 2044 @* - if an additional argument # is given, a simplified Weierstrass 1794 2045 form is computed 1795 2046 EXAMPLE: example weierstrassForm; shows an example" … … 1852 2103 1853 2104 proc jInvariant (poly f,list #) 1854 "USAGE: jInvariant(f[,#]); f poly, # list 1855 ASSUME: - f is a a polynomial whose Newton polygon has precisely one 1856 interior lattice point, so that it defines an elliptic curve 2105 "USAGE: jInvariant(f[,#]); f poly, # list 2106 ASSUME: - f is a a polynomial whose Newton polygon has precisely one 2107 interior lattice point, so that it defines an elliptic curve 1857 2108 on the toric surface corresponding to the Newton polygon 1858 @* - it the optional argument # is present the base field should be 1859 Q(t) and the optional argument should be one of the following 2109 @* - it the optional argument # is present the base field should be 2110 Q(t) and the optional argument should be one of the following 1860 2111 strings: 1861 @* 'ord' : then the return value is of type integer, 2112 @* 'ord' : then the return value is of type integer, 1862 2113 namely the order of the j-invariant 1863 @* 'split' : then the return value is a list of two polynomials, 2114 @* 'split' : then the return value is a list of two polynomials, 1864 2115 such that the quotient of these two is the j-invariant 1865 2116 RETURN: poly, the j-invariant of the elliptic curve defined by poly 1866 NOTE: the characteristic of the base field should not be 2 or 3, 2117 NOTE: the characteristic of the base field should not be 2 or 3, 1867 2118 unless the input is a plane cubic 1868 2119 EXAMPLE: example jInvariant; shows an example" … … 1890 2141 echo=2; 1891 2142 ring r=(0,t),(x,y),dp; 1892 // jInvariant computes the j-invariant of a cubic 2143 // jInvariant computes the j-invariant of a cubic 1893 2144 jInvariant(x+y+x2y+y3+1/t*xy); 1894 // if the ground field has one parameter t, then we can instead 2145 // if the ground field has one parameter t, then we can instead 1895 2146 // compute the order of the j-invariant 1896 2147 jInvariant(x+y+x2y+y3+1/t*xy,"ord"); … … 1900 2151 poly h=x22y11+x19y10+x17y9+x16y9+x12y7+x9y6+x7y5+x2y3+x14y8; 1901 2152 // its j-invariant is 1902 jInvariant(h); 2153 jInvariant(h); 1903 2154 } 1904 2155 … … 1919 2170 @* l[6] = a list containing the vertices of the tropical conic f 1920 2171 @* l[7] = a list containing lists with vertices of the tangents 1921 @* l[8] = a string which contains the latex-code to draw the 2172 @* l[8] = a string which contains the latex-code to draw the 1922 2173 tropical conic and its tropicalised tangents 1923 2174 @* l[9] = if # is non-empty, this is the same data for the dual … … 1943 2194 ring LINRING=(0,t),(x,y,a(1..6)),lp; 1944 2195 list points=imap(BASERING,points); 1945 ideal I; // the ideal will contain the linear equations given by the conic 2196 ideal I; // the ideal will contain the linear equations given by the conic 1946 2197 // and the points 1947 2198 for (i=1;i<=5;i++) … … 1964 2215 ring tRING=0,t,ls; 1965 2216 list pointdenom=imap(BASERING,pointdenom); 1966 list pointnum=imap(BASERING,pointnum); 2217 list pointnum=imap(BASERING,pointnum); 1967 2218 intvec pointcoordinates; 1968 2219 for (i=1;i<=size(pointdenom);i++) … … 2040 2291 We consider the concic through the following five points: 2041 2292 \\begin{displaymath} 2042 "; 2293 "; 2043 2294 string texf=texDrawTropical(graphf,list("",scalefactor)); 2044 2295 for (i=1;i<=size(points);i++) … … 2077 2328 \\end{document}"; 2078 2329 setring BASERING; 2079 // If # non-empty, compute the dual conic and the tangents 2080 // through the dual points 2330 // If # non-empty, compute the dual conic and the tangents 2331 // through the dual points 2081 2332 // corresponding to the tangents of the given conic. 2082 2333 if (size(#)>0) 2083 2334 { 2084 2335 list dualpoints; 2085 for (i=1;i<=size(points);i++) 2336 for (i=1;i<=size(points);i++) 2086 2337 { 2087 2338 dualpoints[i]=list(leadcoef(tangents[i])/substitute(tangents[i],x,0,y,0),leadcoef(tangents[i]-lead(tangents[i]))/substitute(tangents[i],x,0,y,0)); … … 2107 2358 // conic[2] is the equation of the conic f passing through the five points 2108 2359 conic[2]; 2109 // conic[3] is a list containing the equations of the tangents 2360 // conic[3] is a list containing the equations of the tangents 2110 2361 // through the five points 2111 2362 conic[3]; 2112 2363 // conic[4] is an ideal representing the tropicalisation of the conic f 2113 2364 conic[4]; 2114 // conic[5] is a list containing the tropicalisation 2365 // conic[5] is a list containing the tropicalisation 2115 2366 // of the five tangents in conic[3] 2116 2367 conic[5]; 2117 // conic[6] is a list containing the vertices of the tropical conic 2368 // conic[6] is a list containing the vertices of the tropical conic 2118 2369 conic[6]; 2119 2370 // conic[7] is a list containing the vertices of the five tangents 2120 2371 conic[7]; 2121 // conic[8] contains the latex code to draw the tropical conic and 2122 // its tropicalised tangents; it can written in a file, processed and 2123 // displayed via kghostview 2124 write(":w /tmp/conic.tex",conic[8]); 2125 system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi -o; 2372 // conic[8] contains the latex code to draw the tropical conic and 2373 // its tropicalised tangents; it can written in a file, processed and 2374 // displayed via kghostview 2375 write(":w /tmp/conic.tex",conic[8]); 2376 system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi -o; 2126 2377 kghostview conic.ps &"); 2127 // with an optional argument the same information for the dual conic is computed 2378 // with an optional argument the same information for the dual conic is computed 2128 2379 // and saved in conic[9] 2129 2380 conic=conicWithTangents(points,1); 2130 2381 conic[9][2]; // the equation of the dual conic 2131 2382 } 2132 2383 2133 2384 /////////////////////////////////////////////////////////////////////////////// 2134 2385 /// Procedures concerned with tropicalisation … … 2139 2390 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 2140 2391 RETURN: list, the linear forms of the tropicalisation of f 2141 NOTE: if # is empty, then the valuation of t will be 1, 2142 @* if # is the string 'max' it will be -1; 2143 @* the latter supposes that we consider the maximum of the 2392 NOTE: if # is empty, then the valuation of t will be 1, 2393 @* if # is the string 'max' it will be -1; 2394 @* the latter supposes that we consider the maximum of the 2144 2395 computed linear forms, the former that we consider their minimum 2145 2396 EXAMPLE: example tropicalise; shows an example" … … 2164 2415 { 2165 2416 tropicalf[i]=tropicalf[i]+exp[j]*var(j); 2166 } 2417 } 2167 2418 f=f-lead(f); 2168 2419 } … … 2204 2455 ///////////////////////////////////////////////////////////////////////// 2205 2456 2206 proc tInitialForm (poly f, intvec w) 2457 proc tInitialForm (poly f, intvec w) 2207 2458 "USAGE: tInitialForm(f,w); f a polynomial, w an integer vector 2208 2459 ASSUME: f is a polynomial in Q[t,x_1,...,x_n] and w=(w_0,w_1,...,w_n) 2209 2460 RETURN: poly, the t-initialform of f(t,x) w.r.t. w evaluated at t=1 2210 NOTE: the t-initialform is the sum of the terms with MAXIMAL 2461 NOTE: the t-initialform is the sum of the terms with MAXIMAL 2211 2462 weighted order w.r.t. w 2212 2463 EXAMPLE: example tInitialForm; shows an example" … … 2218 2469 // do the same for the remaining part of f and compare the results 2219 2470 // keep only the smallest ones 2220 int vglgewicht; 2221 f=f-lead(f); 2471 int vglgewicht; 2472 f=f-lead(f); 2222 2473 while (f!=0) 2223 2474 { … … 2234 2485 initialf=initialf+lead(f); 2235 2486 } 2236 } 2487 } 2237 2488 f=f-lead(f); 2238 2489 } … … 2254 2505 proc tInitialIdeal (ideal i,intvec w,list #) 2255 2506 "USAGE: tInitialIdeal(i,w); i ideal, w intvec 2256 ASSUME: i is an ideal in Q[t,x_1,...,x_n] and w=(w_0,...,w_n) 2507 ASSUME: i is an ideal in Q[t,x_1,...,x_n] and w=(w_0,...,w_n) 2257 2508 RETURN: ideal ini, the t-initial ideal of i with respect to w" 2258 2509 { 2259 2510 // THE PROCEDURE WILL BE CALLED FROM OTHER PROCEDURES INSIDE THIS LIBRARY; 2260 // IN THIS CASE THE VARIABLE t WILL INDEED BE THE LAST VARIABLE INSTEAD OF 2511 // IN THIS CASE THE VARIABLE t WILL INDEED BE THE LAST VARIABLE INSTEAD OF 2261 2512 // THE FIRST, 2262 2513 // AND WE THEREFORE HAVE TO MOVE IT BACK TO THE FRONT! … … 2282 2533 // ... and compute a standard basis with 2283 2534 // respect to the homogenised ordering defined by w. Since the generators 2284 // of i will be homogeneous it we can instead take the ordering wp 2285 // with the weightvector (0,w) replaced by (M,...,M)+(0,w) for some 2286 // large M, so that all entries are positive 2287 int M=-minInIntvec(w)[1]+1; // find M such that w[j]+M is 2535 // of i will be homogeneous it we can instead take the ordering wp 2536 // with the weightvector (0,w) replaced by (M,...,M)+(0,w) for some 2537 // large M, so that all entries are positive 2538 int M=-minInIntvec(w)[1]+1; // find M such that w[j]+M is 2288 2539 // strictly positive for all j 2289 2540 intvec whomog=M; … … 2293 2544 } 2294 2545 execute("ring WEIGHTRING=("+charstr(basering)+"),("+varstr(basering)+"),(wp("+string(whomog)+"));"); 2295 // map i to the new ring and compute a GB of i, then dehomogenise i, 2296 // so that we can be sure, that the 2546 // map i to the new ring and compute a GB of i, then dehomogenise i, 2547 // so that we can be sure, that the 2297 2548 // initial forms of the generators generate the initial ideal 2298 2549 ideal i=subst(groebner(imap(HOMOGRING,i)),@s,1); … … 2548 2799 proc texDrawBasic (list texdraw) 2549 2800 "USAGE: texDrawBasic(texdraw); list texdraw 2550 ASSUME: texdraw is a list of strings representing texdraw commands 2551 (as produced by texDrawTropical) which should be embedded into 2801 ASSUME: texdraw is a list of strings representing texdraw commands 2802 (as produced by texDrawTropical) which should be embedded into 2552 2803 a texdraw environment 2553 2804 RETURN: string, a texdraw environment enclosing the input … … 2569 2820 \\end{texdraw}"; 2570 2821 return(texdrawtp); 2571 } 2822 } 2572 2823 example 2573 2824 { … … 2586 2837 ASSUME: graph is the output of tropicalCurve 2587 2838 RETURN: string, the texdraw code of the tropical plane curve encoded by graph 2588 NOTE: - if the list # is non-empty, the first entry should be a string; 2589 if this string is 'max', then the tropical curve is considered 2839 NOTE: - if the list # is non-empty, the first entry should be a string; 2840 if this string is 'max', then the tropical curve is considered 2590 2841 with respect to the maximum 2591 @* - the procedure computes a scalefactor for the texdraw command which 2592 should help to display the curve in the right way; this may, 2593 however, be a bad idea if several texDrawTropical outputs are 2594 put together to form one image; the scalefactor can be prescribed 2842 @* - the procedure computes a scalefactor for the texdraw command which 2843 should help to display the curve in the right way; this may, 2844 however, be a bad idea if several texDrawTropical outputs are 2845 put together to form one image; the scalefactor can be prescribed 2595 2846 by the further optional entry of type poly 2596 @* - one can add a string as last opional argument to the list #; 2597 it can be used to insert further texdraw commands (e.g. to have 2598 a lighter image as when called from inside conicWithTangents); 2847 @* - one can add a string as last opional argument to the list #; 2848 it can be used to insert further texdraw commands (e.g. to have 2849 a lighter image as when called from inside conicWithTangents); 2599 2850 @* - the list # is optional and may as well be empty 2600 2851 EXAMPLE: example texDrawTropical; shows an example" 2601 2852 { 2602 // there is one possible argument, which is not explained to the user; 2853 // there is one possible argument, which is not explained to the user; 2603 2854 // it is used to draw several tropical curves; there we want to suppress 2604 // the weights sometimes; this is done by handing over the string "noweights" 2605 int i,j; 2855 // the weights sometimes; this is done by handing over the string "noweights" 2856 int i,j; 2606 2857 int noweights; // controls if weights should be drawn or not 2607 2858 for (i=1;i<=size(#);i++) … … 2616 2867 } 2617 2868 } 2618 // deal first with the pathological case that 2869 // deal first with the pathological case that 2619 2870 // the input polynomial was a monomial 2620 // and does therefore not define a tropical curve, 2621 // and check if the Newton polytope is 2871 // and does therefore not define a tropical curve, 2872 // and check if the Newton polytope is 2622 2873 // a line segment so that the curve defines a bunch of lines 2623 2874 int bunchoflines; 2624 2875 // if the boundary of the Newton polytope consists of a single point 2625 if (size(graph[size(graph)][1])==1) 2876 if (size(graph[size(graph)][1])==1) 2626 2877 { 2627 2878 return(string()); … … 2636 2887 } 2637 2888 // then the Newton polytope is a line segment 2638 if ((size(graph[size(graph)][1])-size(syz(M)))==1) 2889 if ((size(graph[size(graph)][1])-size(syz(M)))==1) 2639 2890 { 2640 2891 bunchoflines=1; … … 2667 2918 int nachkomma=2; // number of decimals for the scalefactor 2668 2919 number sf=1; // correction factor for scalefactor 2669 // if no scale factor was handed over to the procedure, use the 2920 // if no scale factor was handed over to the procedure, use the 2670 2921 // one computed by minScaleFactor; 2671 2922 // check first if a scale factor has been handed over … … 2675 2926 { 2676 2927 // if the scalefactor as polynomial was handed over, get it 2677 if (typeof(#[i])=="poly") 2928 if (typeof(#[i])=="poly") 2678 2929 { 2679 2930 poly scalefactor=#[2]; 2680 2931 scfpresent=1; 2681 2932 } 2682 // if the procedure is called for drawing more than one tropical curve 2933 // if the procedure is called for drawing more than one tropical curve 2683 2934 // then scalefactor,sf,nachkomma,minx,miny,maxx,maxy,centerx,centery 2684 2935 // has been handed over to the procedure … … 2697 2948 } 2698 2949 i++; 2699 } 2950 } 2700 2951 // if no scalefactor was handed over we take the one computed in SCF 2701 2952 if (scfpresent==0) … … 2712 2963 { 2713 2964 // if the curve is a bunch of lines no vertex has to be drawn 2714 if (bunchoflines==0) 2965 if (bunchoflines==0) 2715 2966 { 2716 2967 texdrawtp=texdrawtp+" … … 2718 2969 } 2719 2970 // draw the bounded edges emerging from the ith vertex 2720 for (j=1;j<=ncols(graph[i][3]);j++) 2721 { 2722 // don't draw it twice - and if there is only one vertex 2971 for (j=1;j<=ncols(graph[i][3]);j++) 2972 { 2973 // don't draw it twice - and if there is only one vertex 2723 2974 // and graph[i][3][1,1] is thus 0, nothing is done 2724 if (i<graph[i][3][1,j]) 2725 { 2975 if (i<graph[i][3][1,j]) 2976 { 2726 2977 texdrawtp=texdrawtp+" 2727 2978 \\move ("+decimal((graph[i][1]-centerx)/sf)+" "+decimal((graph[i][2]-centery)/sf)+") \\lvec ("+decimal((graph[graph[i][3][1,j]][1]-centerx)/sf)+" "+decimal((graph[graph[i][3][1,j]][2]-centery)/sf)+")"; … … 2736 2987 // draw the unbounded edges emerging from the ith vertex 2737 2988 // they should not be too long 2738 for (j=1;j<=size(graph[i][4]);j++) 2739 { 2989 for (j=1;j<=size(graph[i][4]);j++) 2990 { 2740 2991 relxy=shorten(list(decimal((3*graph[i][4][j][1][1]/scalefactor)*sf),decimal((3*graph[i][4][j][1][2]/scalefactor)*sf),string(5*sf/2))); 2741 2992 texdrawtp=texdrawtp+" … … 2836 3087 // check if scaling is necessary 2837 3088 if (scalefactor<1) 2838 { 3089 { 2839 3090 subdivision=subdivision+" 2840 3091 \\relunitscale"+ decimal(scalefactor); … … 2844 3095 { 2845 3096 subdivision=subdivision+" 2846 \\move ("+string(boundary[i][1])+" "+string(boundary[i][2])+") 3097 \\move ("+string(boundary[i][1])+" "+string(boundary[i][2])+") 2847 3098 \\lvec ("+string(boundary[i+1][1])+" "+string(boundary[i+1][2])+")"; 2848 } 3099 } 2849 3100 subdivision=subdivision+" 2850 \\move ("+string(boundary[size(boundary)][1])+" "+string(boundary[size(boundary)][2])+") 3101 \\move ("+string(boundary[size(boundary)][1])+" "+string(boundary[size(boundary)][2])+") 2851 3102 \\lvec ("+string(boundary[1][1])+" "+string(boundary[1][2])+") 2852 3103 … … 2855 3106 { 2856 3107 subdivision=subdivision+" 2857 \\move ("+string(inneredges[i][1][1])+" "+string(inneredges[i][1][2])+") 3108 \\move ("+string(inneredges[i][1][1])+" "+string(inneredges[i][1][2])+") 2858 3109 \\lvec ("+string(inneredges[i][2][1])+" "+string(inneredges[i][2][2])+")"; 2859 3110 } … … 2866 3117 { 2867 3118 if (scalefactor > 2) 2868 { 3119 { 2869 3120 subdivision=subdivision+" 2870 3121 \\move ("+string(i)+" "+string(j)+") \\fcir f:0.6 r:"+decimal(2/(10*scalefactor),size(string(int(scalefactor)))+1); … … 2876 3127 } 2877 3128 } 2878 } 3129 } 2879 3130 if ((shiftvector[1]!=0) or (shiftvector[2]!=0)) 2880 3131 { … … 2883 3134 } 2884 3135 } 2885 // deal with the pathological cases 3136 // deal with the pathological cases 2886 3137 if (size(boundary)==1) // then the Newton polytope is a point 2887 3138 { … … 2938 3189 { 2939 3190 if (scalefactor > 2) 2940 { 3191 { 2941 3192 subdivision=subdivision+" 2942 \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 3193 \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 2943 3194 \\fcir f:0 r:"+decimal(2/(8*scalefactor),size(string(int(scalefactor)))+1); 2944 3195 } … … 2946 3197 { 2947 3198 subdivision=subdivision+" 2948 \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 3199 \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 2949 3200 \\fcir f:0 r:"+decimal(2/(16*scalefactor),size(string(int(scalefactor)))+1); 2950 3201 } 2951 3202 } 2952 3203 // enclose subdivision in the texdraw environment 2953 string texsubdivision=" 3204 string texsubdivision=" 2954 3205 \\begin{texdraw} 2955 \\drawdim cm \\relunitscale 1 3206 \\drawdim cm \\relunitscale 1 2956 3207 \\linewd 0.05" 2957 3208 +subdivision+" … … 2967 3218 poly f=x+y+x2y+xy2+1/t*xy; 2968 3219 list graph=tropicalCurve(f); 2969 // compute the texdraw code of the Newton subdivision of the tropical curve 3220 // compute the texdraw code of the Newton subdivision of the tropical curve 2970 3221 texDrawNewtonSubdivision(graph); 2971 3222 } … … 2975 3226 proc texDrawTriangulation (list triang,list polygon) 2976 3227 "USAGE: texDrawTriangulation(triang,polygon); triang,polygon list 2977 ASSUME: polygon is a list of integer vectors describing the 3228 ASSUME: polygon is a list of integer vectors describing the 2978 3229 lattice points of a marked polygon; 2979 triang is a list of integer vectors describing a 3230 triang is a list of integer vectors describing a 2980 3231 triangulation of the marked polygon 2981 in the sense that an integer vector of the form (i,j,k) describes 3232 in the sense that an integer vector of the form (i,j,k) describes 2982 3233 the triangle formed by polygon[i], polygon[j] and polygon[k] 2983 RETURN: string, a texdraw code for the triangulation described 3234 RETURN: string, a texdraw code for the triangulation described 2984 3235 by triang without the texdraw environment 2985 3236 EXAMPLE: example texDrawTriangulation; shows an example" … … 2990 3241 "; 2991 3242 int i,j; // indices 2992 list pairs,markings; // stores edges of the triangulation, respecively 2993 // the marked points for each triangle store the edges and marked 3243 list pairs,markings; // stores edges of the triangulation, respecively 3244 // the marked points for each triangle store the edges and marked 2994 3245 // points of the triangle 2995 3246 for (i=1;i<=size(triang);i++) … … 3000 3251 markings[3*i-2]=triang[i][1]; 3001 3252 markings[3*i-1]=triang[i][2]; 3002 markings[3*i]=triang[i][3]; 3253 markings[3*i]=triang[i][3]; 3003 3254 } 3004 3255 // delete redundant pairs which occur more than once … … 3033 3284 { 3034 3285 latex=latex+" 3035 \\move ("+string(polygon[markings[i]][1])+" "+string(polygon[markings[i]][2])+") 3286 \\move ("+string(polygon[markings[i]][1])+" "+string(polygon[markings[i]][2])+") 3036 3287 \\fcir f:0 r:0.08"; 3037 3288 } … … 3040 3291 { 3041 3292 latex=latex+" 3042 \\move ("+string(polygon[pairs[i][1]][1])+" "+string(polygon[pairs[i][1]][2])+") 3293 \\move ("+string(polygon[pairs[i][1]][1])+" "+string(polygon[pairs[i][1]][2])+") 3043 3294 \\lvec ("+string(polygon[pairs[i][2]][1])+" "+string(polygon[pairs[i][2]][2])+")"; 3044 3295 } … … 3047 3298 { 3048 3299 latex=latex+" 3049 \\move ("+string(polygon[i][1])+" "+string(polygon[i][2])+") 3300 \\move ("+string(polygon[i][1])+" "+string(polygon[i][2])+") 3050 3301 \\fcir f:0.7 r:0.04"; 3051 3302 } … … 3056 3307 "EXAMPLE:"; 3057 3308 echo=2; 3058 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 3309 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 3059 3310 // with all integer points as markings 3060 3311 list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0),intvec(0,0), 3061 3312 intvec(2,1),intvec(0,1),intvec(1,2),intvec(0,2),intvec(0,3); 3062 // define a triangulation by connecting the only interior point 3313 // define a triangulation by connecting the only interior point 3063 3314 // with the vertices 3064 3315 list triang=intvec(1,2,5),intvec(1,5,10),intvec(1,2,10); … … 3068 3319 3069 3320 /////////////////////////////////////////////////////////////////////////////// 3070 /// Auxilary Procedures 3321 /// Auxilary Procedures 3071 3322 /////////////////////////////////////////////////////////////////////////////// 3072 3323 … … 3074 3325 "USAGE: radicalMemberShip (f,i); f poly, i ideal 3075 3326 RETURN: int, 1 if f is in the radical of i, 0 else 3076 EXAMPLE: example radicalMemberShip; shows an example" 3327 EXAMPLE: example radicalMemberShip; shows an example" 3077 3328 { 3078 3329 def BASERING=basering; … … 3114 3365 { 3115 3366 // compute first the t-order of the leading coefficient of f (leitkoef[1]) and 3116 // the rational constant corresponding to this order in leadkoef(f) 3367 // the rational constant corresponding to this order in leadkoef(f) 3117 3368 // (leitkoef[2]) 3118 3369 list leitkoef=simplifyToOrder(f); … … 3124 3375 // do the same for the remaining part of f and compare the results 3125 3376 // keep only the smallest ones 3126 int vglgewicht; 3127 f=f-lead(f); 3377 int vglgewicht; 3378 f=f-lead(f); 3128 3379 while (f!=0) 3129 3380 { 3130 leitkoef=simplifyToOrder(f); 3381 leitkoef=simplifyToOrder(f); 3131 3382 vglgewicht=leitkoef[1]+scalarproduct(w,leadexp(f)); 3132 3383 if (vglgewicht<gewicht) … … 3143 3394 initialf=initialf+koef*leadmonom(f); 3144 3395 } 3145 } 3396 } 3146 3397 f=f-lead(f); 3147 3398 } … … 3168 3419 { 3169 3420 // compute first the t-order of the leading coefficient of f (leitkoef[1]) and 3170 // the rational constant corresponding to this order in leadkoef(f) 3421 // the rational constant corresponding to this order in leadkoef(f) 3171 3422 // (leitkoef[2]) 3172 list leitkoef=simplifyToOrder(f); 3423 list leitkoef=simplifyToOrder(f); 3173 3424 execute("poly koef="+leitkoef[2]+";"); 3174 3425 // take in lead(f) only the term of lowest t-order and set t=1 … … 3179 3430 // keep only the largest ones 3180 3431 int vglgewicht; 3181 f=f-lead(f); 3432 f=f-lead(f); 3182 3433 while (f!=0) 3183 3434 { … … 3197 3448 initialf=initialf+koef*leadmonom(f); 3198 3449 } 3199 } 3450 } 3200 3451 f=f-lead(f); 3201 3452 } … … 3216 3467 proc solveTInitialFormPar (ideal i) 3217 3468 "USAGE: solveTInitialFormPar(i); i ideal 3218 ASSUME: i is a zero-dimensional ideal in Q(t)[x_1,...,x_n] generated 3219 by the (1,w)-homogeneous elements for some integer vector w 3469 ASSUME: i is a zero-dimensional ideal in Q(t)[x_1,...,x_n] generated 3470 by the (1,w)-homogeneous elements for some integer vector w 3220 3471 - i.e. by the (1,w)-initialforms of polynomials 3221 3472 RETURN: none 3222 NOTE: the procedure just displays complex approximations 3473 NOTE: the procedure just displays complex approximations 3223 3474 of the solution set of i 3224 3475 EXAMPLE: example solveTInitialFormPar; shows an example" … … 3245 3496 ///////////////////////////////////////////////////////////////////////// 3246 3497 3247 proc detropicalise (def p) 3498 proc detropicalise (def p) 3248 3499 "USAGE: detropicalise(f); f poly or f list 3249 ASSUME: if f is of type poly then t is a linear polynomial with 3250 an arbitrary constant term and positive integer coefficients 3500 ASSUME: if f is of type poly then t is a linear polynomial with 3501 an arbitrary constant term and positive integer coefficients 3251 3502 as further coefficients; 3252 3503 @* if f is of type list then f is a list of polynomials of 3253 3504 the type just described in before 3254 3505 RETURN: poly, the detropicalisation of f ignoring the constant parts 3255 NOTE: the output will be a monomial and the constant coefficient 3506 NOTE: the output will be a monomial and the constant coefficient 3256 3507 has been ignored 3257 3508 EXAMPLE: example detropicalise; shows an example" … … 3261 3512 { 3262 3513 if (leadmonom(p)!=1) 3263 { 3514 { 3264 3515 dtp=dtp*leadmonom(p)^int(leadcoef(p)); 3265 3516 } … … 3278 3529 ///////////////////////////////////////////////////////////////////////// 3279 3530 3280 proc tDetropicalise (def p) 3531 proc tDetropicalise (def p) 3281 3532 "USAGE: tDetropicalise(f); f poly or f list 3282 ASSUME: if f is of type poly then f is a linear polynomial with an 3283 integer constant term and positive integer coefficients 3533 ASSUME: if f is of type poly then f is a linear polynomial with an 3534 integer constant term and positive integer coefficients 3284 3535 as further coefficients; 3285 3536 @* if f is of type list then it is a list of polynomials of 3286 the type just described in before 3537 the type just described in before 3287 3538 RETURN: poly, the detropicalisation of f over the field Q(t) 3288 3539 NOTE: the output will be a term where the coeffiecient is a Laurent … … 3293 3544 if (typeof(p)=="list") 3294 3545 { 3295 int i; 3546 int i; 3296 3547 for (i=1;i<=size(p);i++) 3297 3548 { … … 3305 3556 { 3306 3557 if (leadmonom(p)!=1) 3307 { 3558 { 3308 3559 dtp=dtp*leadmonom(p)^int(leadcoef(p)); 3309 3560 } … … 3363 3614 proc parameterSubstitute (poly f,int N) 3364 3615 "USAGE: parameterSubstitute(f,N); f poly, N int 3365 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] describing 3616 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] describing 3366 3617 a plane curve over Q(t) 3367 3618 RETURN: poly f with t replaced by t^N … … 3417 3668 poly f=t2x+1/t*y-1; 3418 3669 tropicalSubst(f,2,x,x+t,y,tx+y+t2); 3419 // The procedure can be used to study the effect of a transformation of 3670 // The procedure can be used to study the effect of a transformation of 3420 3671 // the form x -> x+t^b, with b a rational number, on the tropicalisation and 3421 3672 // the j-invariant of a cubic over the Puiseux series. 3422 3673 f=t7*y3+t3*y2+t*(x3+xy2+y+1)+xy; 3423 // - the j-invariant, and hence its valuation, 3674 // - the j-invariant, and hence its valuation, 3424 3675 // does not change under the transformation 3425 3676 jInvariant(f,"ord"); 3426 // - b=3/2, then the cycle length of the tropical cubic equals -val(j-inv) 3427 list g32=tropicalSubst(f,2,x,x+t3,y,y); 3677 // - b=3/2, then the cycle length of the tropical cubic equals -val(j-inv) 3678 list g32=tropicalSubst(f,2,x,x+t3,y,y); 3428 3679 tropicalJInvariant(g32); 3429 3680 // - b=1, then it is still true, but only just ... … … 3438 3689 3439 3690 proc randomPoly (int d,int ug, int og, list #) 3440 "USAGE: randomPoly(d,ug,og[,#]); d, ug, og int, # list 3691 "USAGE: randomPoly(d,ug,og[,#]); d, ug, og int, # list 3441 3692 ASSUME: the basering has a parameter t 3442 RETURN: poly, a polynomial of degree d where the coefficients are 3693 RETURN: poly, a polynomial of degree d where the coefficients are 3443 3694 of the form t^j with j a random integer between ug and og 3444 NOTE: if an optional argument # is given, then the coefficients are 3445 instead either of the form t^j as above or they are zero, 3695 NOTE: if an optional argument # is given, then the coefficients are 3696 instead either of the form t^j as above or they are zero, 3446 3697 and this is chosen randomly 3447 3698 EXAMPLE: example randomPoly; shows an example" … … 3460 3711 { 3461 3712 if (size(#)!=0) 3462 { 3713 { 3463 3714 k=random(0,1); 3464 3715 } 3465 3716 if (k==0) 3466 { 3717 { 3467 3718 j=random(ug,og); 3468 3719 randomPolynomial=randomPolynomial+t^j*m[i]; … … 3494 3745 RETURN: none" 3495 3746 { 3496 system("sh","cd /tmp; /bin/rm -f tropicalcurve*; /bin/rm -f tropicalnewtonsubdivision*"); 3747 system("sh","cd /tmp; /bin/rm -f tropicalcurve*; /bin/rm -f tropicalnewtonsubdivision*"); 3497 3748 } 3498 3749 … … 3551 3802 static proc cutdown (ideal jideal,intvec wvec,int dimension,list #) 3552 3803 "USAGE: cutdown(i,w,d); i ideal, w intvec, d int, # list 3553 ASSUME: i an ideal in Q[t,x_1,...,x_n], (w_1,...,w_n) is in the tropical 3554 variety of jideal and d=dim(i)>0, in Q(t)[x]; the optional 3555 parameter # can contain the string 'isPrime' to indicate that 3556 the input ideal is prime and no minimal associated primes have 3804 ASSUME: i an ideal in Q[t,x_1,...,x_n], (w_1,...,w_n) is in the tropical 3805 variety of jideal and d=dim(i)>0, in Q(t)[x]; the optional 3806 parameter # can contain the string 'isPrime' to indicate that 3807 the input ideal is prime and no minimal associated primes have 3557 3808 to be computed 3558 RETURN: list, the first entry is a ring, namely the basering where some 3559 variables have been eliminated, and the ring contains 3809 RETURN: list, the first entry is a ring, namely the basering where some 3810 variables have been eliminated, and the ring contains 3560 3811 the ideal i (with the same variables eliminated), 3561 the t-initial ideal ini of i (w.r.t. the weight vector 3562 where the entries corresponding to the deleted variables 3563 have been eliminated) and a list repl where for each 3812 the t-initial ideal ini of i (w.r.t. the weight vector 3813 where the entries corresponding to the deleted variables 3814 have been eliminated) and a list repl where for each 3564 3815 eliminated variable there is one entry, namely a polynomial 3565 in the remaining variables and t that explains how 3566 resubstitution of a solution for the new i gives a solution 3816 in the remaining variables and t that explains how 3817 resubstitution of a solution for the new i gives a solution 3567 3818 for the old i; the second entry is the weight vector 3568 wvec with the components corresponding to the eliminated 3819 wvec with the components corresponding to the eliminated 3569 3820 variables removed 3570 NOTE: needs the libraries random.lib and primdec.lib; 3821 NOTE: needs the libraries random.lib and primdec.lib; 3571 3822 is called from tropicalLifting" 3572 { 3573 // IDEA: i is an ideal of dimension d; we want to cut it with d random linear 3823 { 3824 // IDEA: i is an ideal of dimension d; we want to cut it with d random linear 3574 3825 // forms in such a way that the resulting 3575 3826 // ideal is 0-dim and still contains w in the tropical variety 3576 // NOTE: t is the last variable in the basering 3827 // NOTE: t is the last variable in the basering 3577 3828 ideal pideal; //this is the ideal we want to return 3578 3829 ideal cutideal; … … 3592 3843 for (j1=1;j1<=nvars(basering)-1;j1++) 3593 3844 { 3594 variablen=variablen+var(j1); // read the set of variables 3845 variablen=variablen+var(j1); // read the set of variables 3595 3846 // (needed to make the quotring later) 3596 product=product*var(j1); // make product of all variables 3847 product=product*var(j1); // make product of all variables 3597 3848 // (needed for the initial-monomial-check later 3598 } 3849 } 3599 3850 execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;"); 3600 3851 setring BASERING; … … 3603 3854 { 3604 3855 setring QUOTRING; 3605 ideal jideal=imap(BASERING,jideal); 3606 list primp=minAssGTZ(jideal); //compute the primary decomposition 3856 ideal jideal=imap(BASERING,jideal); 3857 list primp=minAssGTZ(jideal); //compute the primary decomposition 3607 3858 for (j1=1;j1<=size(primp);j1++) 3608 { 3859 { 3609 3860 for(j2=1;j2<=size(primp[j1]);j2++) 3610 3861 { 3611 3862 // clear all denominators 3612 3863 primp[j1][j2]=primp[j1][j2]/content(primp[j1][j2]); 3613 } 3864 } 3614 3865 } 3615 3866 setring BASERING; 3616 3867 list primp=imap(QUOTRING,primp); 3617 3868 // if i is not primary itself 3618 // go through the list of min. ass. primes and find the first 3869 // go through the list of min. ass. primes and find the first 3619 3870 // one which has w in its tropical variety 3620 if (size(primp)>1) 3871 if (size(primp)>1) 3621 3872 { 3622 3873 j1=1; … … 3625 3876 //compute the t-initial of the associated prime 3626 3877 // - the last entry 1 only means that t is the last variable in the ring 3627 primini=tInitialIdeal(primp[j1],wvec,1); 3628 // check if it contains a monomial (resp if the product of var 3878 primini=tInitialIdeal(primp[j1],wvec,1); 3879 // check if it contains a monomial (resp if the product of var 3629 3880 // is in the radical) 3630 if (radicalMemberShip(product,primini)==0) 3631 { 3881 if (radicalMemberShip(product,primini)==0) 3882 { 3632 3883 // if w is in the tropical variety of the prime, we take that 3633 3884 jideal=primp[j1]; … … 3636 3887 setring BASERING; 3637 3888 winprim=1; // and stop the checking 3638 } 3889 } 3639 3890 j1=j1+1; //else we look at the next associated prime 3640 3891 } … … 3643 3894 { 3644 3895 jideal=primp[1]; //if i is primary itself we take its prime instead 3645 } 3896 } 3646 3897 } 3647 3898 // now we start as a first try to intersect with a hyperplane parallel to 3648 3899 // coordinate axes, because this would make our further computations 3649 // a lot easier. 3650 // We choose a subset of our n variables of size d=dim(ideal). 3900 // a lot easier. 3901 // We choose a subset of our n variables of size d=dim(ideal). 3651 3902 // For each of these 3652 // variables, we want to fix a value: x_i= a_i*t^-w_i. 3903 // variables, we want to fix a value: x_i= a_i*t^-w_i. 3653 3904 // This will only work if the 3654 // projection of the d-dim variety to the other n-d variables 3905 // projection of the d-dim variety to the other n-d variables 3655 3906 // is the whole n-d plane. 3656 // Then a general choice for a_i will intersect the variety 3907 // Then a general choice for a_i will intersect the variety 3657 3908 // in finitely many points. 3658 // If the projection is not the whole n-d plane, 3909 // If the projection is not the whole n-d plane, 3659 3910 // then a general choice will not work. 3660 // We could determine if we picked a good 3911 // We could determine if we picked a good 3661 3912 // d-subset of variables using elimination 3662 // (NOTE, there EXIST d variables such that 3913 // (NOTE, there EXIST d variables such that 3663 3914 // a random choice of a_i's would work!). 3664 // But since this involves many computations, 3915 // But since this involves many computations, 3665 3916 // we prefer to choose randomly and just 3666 // try in the end if our intersected ideal 3667 // satisfies our requirements. If this does not 3917 // try in the end if our intersected ideal 3918 // satisfies our requirements. If this does not 3668 3919 // work, we give up this try and use our second intersection idea, which 3669 3920 // will work for a Zariksi-open subset (i.e. almost always). 3670 3921 // 3671 // As random subset of d variables we choose 3922 // As random subset of d variables we choose 3672 3923 // those for which the absolute value of the 3673 // wvec-coordinate is smallest, because this will 3924 // wvec-coordinate is smallest, because this will 3674 3925 // give us the smallest powers of t and hence 3675 // less effort in following computations. 3926 // less effort in following computations. 3676 3927 // Note that the smallest absolute value have those 3677 // which are biggest, because wvec is negative. 3928 // which are biggest, because wvec is negative. 3678 3929 //print("first try"); 3679 3930 intvec wminust=intvecdelete(wvec,1); … … 3682 3933 A[1,1..size(wminust)]=-wminust; 3683 3934 A[2,1..size(wminust)]=1..size(wminust); 3684 // sort this matrix in order to get 3935 // sort this matrix in order to get 3685 3936 // the d biggest entries and their position in wvec 3686 A=sortintmat(A); 3687 // we construct a vector which has 1 at entry j if j belongs to the list 3937 A=sortintmat(A); 3938 // we construct a vector which has 1 at entry j if j belongs to the list 3688 3939 // of the d biggest entries of wvec and a 0 else 3689 3940 for (j1=1;j1<=nvars(basering)-1;j1++) //go through the variables … … 3694 3945 { 3695 3946 setvec[j1]=1;//put a 1 3696 } 3697 } 3698 } 3699 // using this 0/1-vector we produce 3700 // a random constant (i.e. coeff in Q times something in t) 3701 // for each of the biggest variables, 3947 } 3948 } 3949 } 3950 // using this 0/1-vector we produce 3951 // a random constant (i.e. coeff in Q times something in t) 3952 // for each of the biggest variables, 3702 3953 // we add the forms x_i-random constant to the ideal 3703 // and we save the constant at the i-th place of 3954 // and we save the constant at the i-th place of 3704 3955 // a list we want to return for later computations 3705 3956 j3=0; … … 3712 3963 { 3713 3964 if(setvec[j1]==1)//if x_i belongs to the biggest variables 3714 { 3965 { 3715 3966 if ((j3==1) and ((char(basering)==0) or (char(basering)>3))) 3716 { 3967 { 3717 3968 randomp1=random(1,3); 3718 randomp=t^(A[1,j2])*randomp1;// make a random constant 3969 randomp=t^(A[1,j2])*randomp1;// make a random constant 3719 3970 // --- first we try small numbers 3720 } 3971 } 3721 3972 if ((j3==2) and ((char(basering)==0) or (char(basering)>100))) 3722 3973 { 3723 3974 randomp1=random(1,100); 3724 randomp=t^(A[1,j2])*randomp1;// make a random constant 3975 randomp=t^(A[1,j2])*randomp1;// make a random constant 3725 3976 // --- next we try bigger numbers 3726 } 3977 } 3727 3978 else 3728 3979 { … … 3736 3987 else 3737 3988 { 3738 ergl[j1]=0; //if the variable is not among the d biggest ones, 3989 ergl[j1]=0; //if the variable is not among the d biggest ones, 3739 3990 //save 0 in the list 3740 3991 erglini[j1]=0; 3741 } 3992 } 3742 3993 } 3743 3994 // print(ergl);print(pideal); 3744 // now we check if we made a good choice of pideal, i.e. if dim=0 and 3995 // now we check if we made a good choice of pideal, i.e. if dim=0 and 3745 3996 // wvec is still in the tropical variety 3746 3997 // change to quotring where we compute dimension … … 3749 4000 { 3750 4001 if(setvec[j1]==1) 3751 { 3752 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 3753 } 4002 { 4003 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 4004 } 3754 4005 } 3755 4006 setring QUOTRING; … … 3763 4014 { 3764 4015 // compute the t-initial of the associated prime 3765 // - the last 1 just means that the variable t is 4016 // - the last 1 just means that the variable t is 3766 4017 // the last variable in the ring 3767 4018 pini=tInitialIdeal(cutideal,wvec ,1); 3768 4019 //print("initial"); 3769 4020 //print(pini); 3770 // and if the initial w.r.t. t contains no monomial 4021 // and if the initial w.r.t. t contains no monomial 3771 4022 // as we want (checked with 3772 4023 // radical-membership of the product of all variables) 3773 if (radicalMemberShip(product,pini)==0) 3774 { 3775 // we made the right choice and now 3776 // we substitute the variables in the ideal 4024 if (radicalMemberShip(product,pini)==0) 4025 { 4026 // we made the right choice and now 4027 // we substitute the variables in the ideal 3777 4028 // to get an ideal in less variables 3778 // also we make a projected vector 4029 // also we make a projected vector 3779 4030 // from wvec only the components of the remaining variables 3780 4031 wvecp=wvec; 3781 variablen=0; 4032 variablen=0; 3782 4033 j2=0; 3783 4034 for(j1=1;j1<=nvars(basering)-1;j1++) … … 3792 4043 else 3793 4044 { 3794 variablen=variablen+var(j1); // read the set of remaining variables 4045 variablen=variablen+var(j1); // read the set of remaining variables 3795 4046 // (needed to make quotring later) 3796 } 3797 } 4047 } 4048 } 3798 4049 // return pideal, the initial and the list ergl which tells us 3799 4050 // which variables we replaced by which form … … 3805 4056 export(ini); 3806 4057 export(repl); 3807 return(list(BASERINGLESS1,wvecp)); 4058 return(list(BASERINGLESS1,wvecp)); 3808 4059 } 3809 4060 } 3810 4061 } 3811 4062 // this is our second try to cut down, which we only use if the first try 3812 // didn't work out. We intersect with d general hyperplanes 4063 // didn't work out. We intersect with d general hyperplanes 3813 4064 // (i.e. we don't choose 3814 4065 // them to be parallel to coordinate hyperplanes anymore. This works out with 3815 4066 // probability 1. 3816 4067 // 3817 // We choose general hyperplanes, i.e. linear forms which involve all x_i. 3818 // Each x_i has to be multiplied bz t^(w_i) in order 3819 // to get the same weight (namely 0) 4068 // We choose general hyperplanes, i.e. linear forms which involve all x_i. 4069 // Each x_i has to be multiplied bz t^(w_i) in order 4070 // to get the same weight (namely 0) 3820 4071 // for each term. As we cannot have negative exponents, we multiply 3821 // the whole form by t^minimumw. Notice that then in the first form, 4072 // the whole form by t^minimumw. Notice that then in the first form, 3822 4073 // there is one term without t- the term of the variable 3823 4074 // x_i such that w_i is minimal. That is, we can solve for this variable. 3824 // In the second form, we can replace that variable, 3825 // and divide by t as much as possible. 3826 // Then there is again one term wihtout t - 3827 // the term of the variable with second least w. 4075 // In the second form, we can replace that variable, 4076 // and divide by t as much as possible. 4077 // Then there is again one term wihtout t - 4078 // the term of the variable with second least w. 3828 4079 // So we can solve for this one again and also replace it in the first form. 3829 // Since all our coefficients are chosen randomly, 3830 // we can also from the beginning on 3831 // choose the set of variables which belong to the d smallest entries of wvec 3832 // (t not counting) and pick random forms g_i(t,x') 3833 // (where x' is the set of remaining variables) 3834 // and set x_i=g_i(t,x'). 4080 // Since all our coefficients are chosen randomly, 4081 // we can also from the beginning on 4082 // choose the set of variables which belong to the d smallest entries of wvec 4083 // (t not counting) and pick random forms g_i(t,x') 4084 // (where x' is the set of remaining variables) 4085 // and set x_i=g_i(t,x'). 3835 4086 // 3836 4087 // make a matrix with first row wvec (without t) and second row 1..n 3837 4088 //print("second try"); 3838 4089 setring BASERING; 3839 A[1,1..size(wminust)]=wminust; 4090 A[1,1..size(wminust)]=wminust; 3840 4091 A[2,1..size(wminust)]=1..size(wminust); 3841 // sort this matrix in otder to get the d smallest entries 4092 // sort this matrix in otder to get the d smallest entries 3842 4093 // (without counting the t-entry) 3843 4094 A=sortintmat(A); … … 3845 4096 setvec=0; 3846 4097 setvec[nvars(basering)-1]=0; 3847 // we construct a vector which has 1 at entry j if j belongs to the list of 4098 // we construct a vector which has 1 at entry j if j belongs to the list of 3848 4099 // the d smallest entries of wvec and a 0 else 3849 4100 for (j1=1;j1<=nvars(basering)-1;j1++) //go through the variables … … 3865 4116 { 3866 4117 j2=j2+1; 3867 wvecp=intvecdelete(wvecp,j1+2-j2);// delete the components 4118 wvecp=intvecdelete(wvecp,j1+2-j2);// delete the components 3868 4119 // we substitute from wvec 3869 4120 } 3870 4121 else 3871 4122 { 3872 variablen=variablen+var(j1); // read the set of remaining variables 4123 variablen=variablen+var(j1); // read the set of remaining variables 3873 4124 // (needed to make the quotring later) 3874 4125 } 3875 } 4126 } 3876 4127 setring BASERING; 3877 4128 execute("ring BASERINGLESS2=("+charstr(BASERING)+"),("+string(variablen)+",t),(dp("+string(ncols(variablen))+"),lp(1));"); 3878 // using the 0/1-vector which tells us which variables belong 4129 // using the 0/1-vector which tells us which variables belong 3879 4130 // to the set of smallest entries of wvec 3880 // we construct a set of d random linear 3881 // polynomials of the form x_i=g_i(t,x'), 4131 // we construct a set of d random linear 4132 // polynomials of the form x_i=g_i(t,x'), 3882 4133 // where the set of all x_i is the set of 3883 // all variables which are in the list of smallest 4134 // all variables which are in the list of smallest 3884 4135 // entries in wvec, and x' are the other variables. 3885 // We add these d random linear polynomials to 3886 // the ideal pideal, i.e. we intersect 4136 // We add these d random linear polynomials to 4137 // the ideal pideal, i.e. we intersect 3887 4138 // with these and hope to get something 3888 // 0-dim which still contains wvec in its 3889 // tropical variety. Also, we produce a list ergl 4139 // 0-dim which still contains wvec in its 4140 // tropical variety. Also, we produce a list ergl 3890 4141 // with g_i at the i-th position. 3891 4142 // This is a list we want to return. … … 3893 4144 setring BASERING; 3894 4145 pideal=jideal; 3895 for(j1=1;j1<=dimension;j1++)//go through the list of variables 4146 for(j1=1;j1<=dimension;j1++)//go through the list of variables 3896 4147 { // corres to the d smallest in wvec 3897 4148 if ((char(basering)==0) or (char(basering)>3)) 3898 { 4149 { 3899 4150 randomp1=random(1,3); 3900 4151 randomp=randomp1*t^(-A[1,j1]); … … 3909 4160 if(setvec[j2]==0)//if x_j belongs to the set x' 3910 4161 { 3911 // add a random term with the suitable power 4162 // add a random term with the suitable power 3912 4163 // of t to the random linear form 3913 4164 if ((char(basering)==0) or (char(basering)>3)) … … 3934 4185 } 3935 4186 //print(ergl); 3936 // Again, we have to test if we made a good choice 3937 // to intersect,i.e. we have to check whether 4187 // Again, we have to test if we made a good choice 4188 // to intersect,i.e. we have to check whether 3938 4189 // pideal is 0-dim and contains wvec in the tropical variety. 3939 4190 cutideal=pideal; … … 3942 4193 if(setvec[j1]==1) 3943 4194 { 3944 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 3945 } 4195 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 4196 } 3946 4197 } 3947 4198 setring QUOTRING; … … 3955 4206 { 3956 4207 // compute the t-initial of the associated prime 3957 // - the last 1 just means that the variable t 4208 // - the last 1 just means that the variable t 3958 4209 // is the last variable in the ring 3959 4210 pini=tInitialIdeal(cutideal,wvec ,1); … … 3962 4213 // and if the initial w.r.t. t contains no monomial as we want (checked with 3963 4214 // radical-membership of the product of all variables) 3964 if (radicalMemberShip(product,pini)==0) 4215 if (radicalMemberShip(product,pini)==0) 3965 4216 { 3966 4217 // we want to replace the variables x_i by the forms -g_i in 3967 // our ideal in order to return an ideal with less variables 4218 // our ideal in order to return an ideal with less variables 3968 4219 // first we substitute the chosen variables 3969 4220 for(j1=1;j1<=nvars(basering)-1;j1++) … … 3982 4233 export(ini); 3983 4234 export(repl); 3984 return(list(BASERINGLESS2,wvecp)); 4235 return(list(BASERINGLESS2,wvecp)); 3985 4236 } 3986 4237 } 3987 4238 // now we try bigger numbers 3988 while (1) //a never-ending loop which will stop with prob. 1 4239 while (1) //a never-ending loop which will stop with prob. 1 3989 4240 { // as we find a suitable ideal with that prob 3990 4241 setring BASERING; 3991 4242 pideal=jideal; 3992 for(j1=1;j1<=dimension;j1++)//go through the list of variables 4243 for(j1=1;j1<=dimension;j1++)//go through the list of variables 3993 4244 { // corres to the d smallest in wvec 3994 4245 randomp1=random(1,100); 3995 4246 randomp=randomp1*t^(-A[1,j1]); 3996 4247 for(j2=1;j2<=nvars(basering)-1;j2++)//go through all variables 3997 { 4248 { 3998 4249 if(setvec[j2]==0)//if x_j belongs to the set x' 3999 4250 { 4000 // add a random term with the suitable power 4251 // add a random term with the suitable power 4001 4252 // of t to the random linear form 4002 4253 if ((char(basering)==0) or (char(basering)>100)) 4003 { 4254 { 4004 4255 randomp2=random(1,100); 4005 4256 randomp1=randomp1+randomp2*var(j2); … … 4022 4273 } 4023 4274 //print(ergl); 4024 // Again, we have to test if we made a good choice to 4025 // intersect,i.e. we have to check whether 4275 // Again, we have to test if we made a good choice to 4276 // intersect,i.e. we have to check whether 4026 4277 // pideal is 0-dim and contains wvec in the tropical variety. 4027 4278 cutideal=pideal; … … 4030 4281 if(setvec[j1]==1) 4031 4282 { 4032 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 4033 } 4283 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 4284 } 4034 4285 } 4035 4286 setring QUOTRING; … … 4039 4290 //print(dimp); 4040 4291 kill cutideal; 4041 setring BASERING; 4292 setring BASERING; 4042 4293 if (dimp==0) // if it is 0 as we want 4043 4294 { 4044 4295 // compute the t-initial of the associated prime 4045 // - the last 1 just means that the variable t 4296 // - the last 1 just means that the variable t 4046 4297 // is the last variable in the ring 4047 4298 pini=tInitialIdeal(cutideal,wvec ,1); 4048 4299 //print("initial"); 4049 4300 //print(pini); 4050 // and if the initial w.r.t. t contains no monomial 4301 // and if the initial w.r.t. t contains no monomial 4051 4302 // as we want (checked with 4052 4303 // radical-membership of the product of all variables) 4053 if (radicalMemberShip(product,pini)==0) 4304 if (radicalMemberShip(product,pini)==0) 4054 4305 { 4055 4306 // we want to replace the variables x_i by the forms -g_i in … … 4062 4313 pideal=subst(pideal,var(j1),ergl[j1]);//substitute it 4063 4314 pini=subst(pini,var(j1),erglini[j1]); 4064 } 4065 } 4315 } 4316 } 4066 4317 // return pideal and the list ergl which tells us 4067 4318 // which variables we replaced by which form … … 4073 4324 export(ini); 4074 4325 export(repl); 4075 return(list(BASERINGLESS2,wvecp)); 4326 return(list(BASERINGLESS2,wvecp)); 4076 4327 } 4077 4328 } … … 4082 4333 ///////////////////////////////////////////////////////////////////////// 4083 4334 4084 static proc tropicalparametriseNoabs (ideal i,intvec ww,int ordnung,int gfanold,int nogfan, list #)4085 "USAGE: tropicalparametriseNoabs(i,tw,ord,gf,ng [,#]); i ideal, tw intvec, ord int, gf,ngint, # opt. list4086 ASSUME: - i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], 4087 tw=(w_0,w_1,...,w_n,0,...,0) and (w_0,...,w_n,0,...,0) is in 4088 the tropical variety of i, and ord is the order up to which a point 4089 in V(i) over C((t)) lying over w shall be computed; 4335 static proc tropicalparametriseNoabs (ideal i,intvec ww,int ordnung,int gfanold,int nogfan,int puiseux,list #) 4336 "USAGE: tropicalparametriseNoabs(i,tw,ord,gf,ng,pu[,#]); i ideal, tw intvec, ord int, gf,ng,pu int, # opt. list 4337 ASSUME: - i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], 4338 tw=(w_0,w_1,...,w_n,0,...,0) and (w_0,...,w_n,0,...,0) is in 4339 the tropical variety of i, and ord is the order up to which a point 4340 in V(i) over C((t)) lying over w shall be computed; 4090 4341 - moreover, k should be zero if the procedure is not called recursively; 4091 - the point in the tropical variety is supposed to lie in the NEGATIVE 4342 - the point in the tropical variety is supposed to lie in the NEGATIVE 4092 4343 orthant; 4093 - the ideal is zero-dimensional when considered 4344 - the ideal is zero-dimensional when considered 4094 4345 in (Q(t)[X_1,...,X_k]/m)[x_1,...,x_n], 4095 where m=#[2] is a maximal ideal in Q(t)[X_1,...,X_k]; 4346 where m=#[2] is a maximal ideal in Q(t)[X_1,...,X_k]; 4096 4347 - gf is 0 if version 2.2 or larger is used and it is 1 else 4097 - ng is 1 if gfan should not be executed 4348 - ng is 1 if gfan should not be executed 4349 - pu is 1 if n=1 and i is generated by one polynomial and newtonpoly is used to find a 4350 point in the tropical variety instead of gfan 4098 4351 RETURN: list, l[1] = ring Q(0,X_1,...,X_r)[[t]] 4099 4352 l[2] = int 4100 4353 l[3] = string 4101 4354 NOTE: - the procedure is also called recursively by itself, and 4102 if it is called in the first recursion, the list # is empty, 4103 otherwise #[1] is an integer, one more than the number 4355 if it is called in the first recursion, the list # is empty, 4356 otherwise #[1] is an integer, one more than the number 4104 4357 of true variables x_1,...,x_n, 4105 4358 and #[2] will contain the maximal ideal m in the variables X_1,...X_k … … 4107 4360 work correctly in K[t,x_1,...,x_n] where K=Q[X_1,...,X_k]/m is a field 4108 4361 extension of Q; 4109 - the ring l[1] contains an ideal PARA, which contains the 4110 parametrisation of a point in V(i) lying over w up to the 4362 - the ring l[1] contains an ideal PARA, which contains the 4363 parametrisation of a point in V(i) lying over w up to the 4111 4364 first ord terms; 4112 - the string m=l[3] contains the code of the maximal ideal m, 4113 by which we have to divide Q[X_1,...,X_r] in order to have 4365 - the string m=l[3] contains the code of the maximal ideal m, 4366 by which we have to divide Q[X_1,...,X_r] in order to have 4114 4367 the appropriate field extension over which the parametrisation lives; 4115 - and if the integer l[2] is N then t has to be replaced by t^1/N in 4116 the parametrisation, or alternatively replace t by t^N in the 4368 - and if the integer l[2] is N then t has to be replaced by t^1/N in 4369 the parametrisation, or alternatively replace t by t^N in the 4117 4370 defining ideal 4118 - the procedure REQUIRES that the program GFAN is installed on 4371 - the procedure REQUIRES that the program GFAN is installed on 4119 4372 your computer" 4120 4373 { … … 4124 4377 if (size(#)==2) // this means the precedure has been called recursively 4125 4378 { 4126 // how many variables are true variables, and how many come 4379 // how many variables are true variables, and how many come 4127 4380 // from the field extension 4128 4381 // only true variables have to be transformed … … 4130 4383 ideal gesamt_m=std(#[2]); // stores all maxideals used for field extensions 4131 4384 // find the zeros of the w-initial ideal and transform the ideal i; 4132 // findzeros and basictransformideal need to know how 4385 // findzeros and basictransformideal need to know how 4133 4386 // many of the variables are true variables 4134 4387 list m_ring=findzeros(i,ww,anzahlvariablen); … … 4137 4390 else // the procedure has been called by tropicalLifting 4138 4391 { 4139 // how many variables are true variables, and how many come from 4392 // how many variables are true variables, and how many come from 4140 4393 // the field extension only true variables have to be transformed 4141 4394 int anzahlvariablen=nvars(basering); … … 4144 4397 ideal ini=#[1]; 4145 4398 // find the zeros of the w-initial ideal and transform the ideal i; 4146 // we should hand the t-initial ideal ine to findzeros, 4399 // we should hand the t-initial ideal ine to findzeros, 4147 4400 // since we know it already 4148 4401 list m_ring=findzeros(i,ww,ini); … … 4166 4419 list a=btr[2]; 4167 4420 ideal m=btr[3]; 4168 gesamt_m=gesamt_m+m; // add the newly found maximal 4421 gesamt_m=gesamt_m+m; // add the newly found maximal 4169 4422 // ideal to the previous ones 4170 4423 } 4171 4424 // check if there is a solution which has the n-th component zero, 4172 // if so, then eliminate the n-th variable from sat(i+x_n,t), 4425 // if so, then eliminate the n-th variable from sat(i+x_n,t), 4173 4426 // otherwise leave i as it is; 4174 // then check if the (remaining) ideal has as solution 4427 // then check if the (remaining) ideal has as solution 4175 4428 // where the n-1st component is zero, 4176 4429 // and procede as before; do the same for the remaining variables; 4177 // this way we make sure that the remaining ideal has 4430 // this way we make sure that the remaining ideal has 4178 4431 // a solution which has no component zero; 4179 4432 intvec deletedvariables; // the jth entry is set 1, if we eliminate x_j 4180 4433 int numberdeletedvariables; // the number of eliminated variables 4181 4434 ideal variablen; // will contain the variables which are not eliminated 4182 intvec tw=ww; // in case some variables are deleted, 4435 intvec tw=ww; // in case some variables are deleted, 4183 4436 // we have to store the old weight vector 4184 4437 deletedvariables[anzahlvariablen]=0; 4185 ideal I,LI; 4438 ideal I,LI; 4186 4439 i=i+m; // if a field extension was necessary, then i has to be extended by m 4187 4440 for (jj=anzahlvariablen-1;jj>=1;jj--) // the variable t is the last one !!! … … 4190 4443 LI=subst(I,var(nvars(basering)),0); 4191 4444 //size(deletedvariables)=anzahlvariablen(before elim.) 4192 for (kk=1;kk<=size(deletedvariables)-1;kk++) 4445 for (kk=1;kk<=size(deletedvariables)-1;kk++) 4193 4446 { 4194 4447 LI=subst(LI,var(kk),0); 4195 4448 } 4196 if (size(LI)==0) // if no power of t is in lead(I) 4449 if (size(LI)==0) // if no power of t is in lead(I) 4197 4450 { // (where the X(i) are considered as field elements) 4198 // get rid of var(jj) 4451 // get rid of var(jj) 4199 4452 i=eliminate(I,var(jj)); 4200 4453 deletedvariables[jj]=1; 4201 anzahlvariablen--; // if a variable is eliminated, 4454 anzahlvariablen--; // if a variable is eliminated, 4202 4455 // then the number of true variables drops 4203 4456 numberdeletedvariables++; … … 4209 4462 } 4210 4463 variablen=invertorder(variablen); 4211 // store also the additional variables and t, 4464 // store also the additional variables and t, 4212 4465 // since they for sure have not been eliminated 4213 4466 for (jj=anzahlvariablen+numberdeletedvariables-1;jj<=nvars(basering);jj++) … … 4215 4468 variablen=variablen+var(jj); 4216 4469 } 4217 // if some variables have been eliminated, 4470 // if some variables have been eliminated, 4218 4471 // then pass to a new ring which has less variables, 4219 4472 // but if no variables are left, then we are done 4220 4473 def BASERING=basering; 4221 if ((numberdeletedvariables>0) and (anzahlvariablen>1)) // if only t remains, 4474 if ((numberdeletedvariables>0) and (anzahlvariablen>1)) // if only t remains, 4222 4475 { // all true variables are gone 4223 4476 execute("ring NEURING=("+charstr(basering)+"),("+string(variablen)+"),(dp("+string(size(variablen)-1)+"),lp(1));"); 4224 4477 ideal i=imap(BASERING,i); 4225 ideal gesamt_m=imap(BASERING,gesamt_m); 4226 } 4227 // now we have to compute a point ww on the tropical variety 4478 ideal gesamt_m=imap(BASERING,gesamt_m); 4479 } 4480 // now we have to compute a point ww on the tropical variety 4228 4481 // of the transformed ideal i; 4229 // of course, we only have to do so, if we have not yet 4482 // of course, we only have to do so, if we have not yet 4230 4483 // reached the order up to which we 4231 4484 // were supposed to do our computations 4232 if ((ordnung>1) and (anzahlvariablen>1)) // if only t remains, 4485 if ((ordnung>1) and (anzahlvariablen>1)) // if only t remains, 4233 4486 { // all true variables are gone 4487 // else we have to use gfan 4234 4488 def PREGFANRING=basering; 4235 4489 if (nogfan!=1) 4236 { 4490 { 4237 4491 // pass to a ring which has variables which are suitable for gfan 4238 4492 execute("ring GFANRING=("+charstr(basering)+"),(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z),dp;"); 4239 ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z; 4493 ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z; 4240 4494 phiideal[nvars(PREGFANRING)]=a; // map t to a 4241 map phi=PREGFANRING,phiideal; 4495 map phi=PREGFANRING,phiideal; 4242 4496 ideal i=phi(i); 4243 // homogenise the ideal i with the first not yet 4244 // used variable in our ring, since gfan 4245 // only handles homogenous ideals; in principle 4497 // homogenise the ideal i with the first not yet 4498 // used variable in our ring, since gfan 4499 // only handles homogenous ideals; in principle 4246 4500 // for this one has first to compute a 4247 // standard basis of i and homogenise that, 4248 // but for the tropical variety (says Anders) 4501 // standard basis of i and homogenise that, 4502 // but for the tropical variety (says Anders) 4249 4503 // it suffices to homogenise an arbitrary system of generators 4250 // i=groebner(i); 4504 // i=groebner(i); 4251 4505 i=homog(i,maxideal(1)[nvars(PREGFANRING)+1]); 4252 4506 // if gfan version >= 0.3.0 is used and the characteristic … … 4260 4514 write(":a /tmp/gfaninput","{"+string(i)+"}"); 4261 4515 } 4262 else 4516 else 4263 4517 { 4264 4518 // write the ideal to a file which gfan takes as input and call gfan … … 4274 4528 else 4275 4529 { 4276 // system("sh","gfan_tropicalstartingcone < /tmp/gfaninput > /tmp/gfantropstcone");4277 // system("sh","gfan_tropicaltraverse < /tmp/gfantropstcone > /tmp/gfanoutput");4530 // system("sh","gfan_tropicalstartingcone < /tmp/gfaninput > /tmp/gfantropstcone"); 4531 // system("sh","gfan_tropicaltraverse < /tmp/gfantropstcone > /tmp/gfanoutput"); 4278 4532 system("sh","gfan_tropicalbasis < /tmp/gfaninput > /tmp/gfanbasis"); 4279 4533 system("sh","gfan_tropicalintersection < /tmp/gfanbasis > /tmp/gfanoutput"); … … 4281 4535 string trop=read("/tmp/gfanoutput"); 4282 4536 setring PREGFANRING; 4283 intvec wneu=-1; // this integer vector will store 4537 intvec wneu=-1; // this integer vector will store 4284 4538 // the point on the tropical variety 4285 4539 wneu[nvars(basering)]=0; … … 4294 4548 "IF YOU WANT wneu TO BE TESTED, THEN SET goon=0;"; 4295 4549 ~ 4296 4297 4298 // test, if wneu really is in the tropical variety4550 // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY THE 4551 // TROPICAL PREVARIETY 4552 // test, if wneu really is in the tropical variety 4299 4553 while (goon==0) 4300 4554 { … … 4303 4557 "CHOOSE A DIFFERENT RAY"; 4304 4558 ~ 4305 4559 } 4306 4560 else 4307 4561 { … … 4313 4567 { 4314 4568 system("sh","gfan_tropicallifting -n "+string(anzahlvariablen)+" --noMult -c < /tmp/gfaninput > /tmp/gfanoutput"); 4315 // read the result from gfan and store it to a string, 4569 // read the result from gfan and store it to a string, 4316 4570 // which in a later version 4317 4571 // should be interpreded by Singular … … 4322 4576 else // if gfan is NOT executed 4323 4577 { 4324 "Set intvec wneu!"; 4325 ~ 4326 } 4327 } 4328 // if we have not yet computed our parametrisation 4578 // if puiseux is set, then we are in the case of a plane curve and can use the command newtonpoly 4579 if (puiseux==1) 4580 { 4581 list NewtP=newtonpoly(i[1]); 4582 wneu=NewtP[1]-NewtP[2]; 4583 int ggteiler=gcd(wneu[1],wneu[2]); 4584 wneu[1]=-wneu[1]/ggteiler; 4585 wneu[2]=wneu[2]/ggteiler; 4586 if (wneu[1]>0) 4587 { 4588 wneu=-wneu; 4589 } 4590 kill NewtP,ggteiler; 4591 } 4592 else // set wneu by hand 4593 { 4594 "Set intvec wneu!"; 4595 ~ 4596 } 4597 } 4598 } 4599 // if we have not yet computed our parametrisation 4329 4600 // up to the required order and 4330 // zero is not yet a solution, then we have 4601 // zero is not yet a solution, then we have 4331 4602 // to go on by calling the procedure recursively; 4332 4603 // if all variables were deleted, then i=0 and thus anzahlvariablen==0 4333 4604 if ((ordnung>1) and (anzahlvariablen>1)) 4334 { 4335 // we call the procedure with the transformed ideal i, 4605 { 4606 // we call the procedure with the transformed ideal i, 4336 4607 // the new weight vector, with the 4337 // required order lowered by one, and with 4608 // required order lowered by one, and with 4338 4609 // additional parameters, namely the number of 4339 // true variables and the maximal ideal that 4610 // true variables and the maximal ideal that 4340 4611 // was computed so far to describe the field extension 4341 list PARALIST=tropicalparametriseNoabs(i,wneu,ordnung-1,gfanold,nogfan, anzahlvariablen,gesamt_m);4342 // the output will be a ring, in which the 4612 list PARALIST=tropicalparametriseNoabs(i,wneu,ordnung-1,gfanold,nogfan,puiseux,anzahlvariablen,gesamt_m); 4613 // the output will be a ring, in which the 4343 4614 // parametrisation lives, and a string, which contains 4344 4615 // the maximal ideal that describes the necessary field extension … … 4347 4618 string PARAm=PARALIST[3]; 4348 4619 setring PARARing; 4349 // if some variables have been eliminated in before, 4350 // then we have to insert zeros 4620 // if some variables have been eliminated in before, 4621 // then we have to insert zeros 4351 4622 // into the parametrisation for those variables 4352 4623 if (numberdeletedvariables>0) … … 4354 4625 ideal PARAneu=PARA; 4355 4626 int k; 4356 for (jj=1;jj<=anzahlvariablen+numberdeletedvariables-1;jj++) // t admits 4627 for (jj=1;jj<=anzahlvariablen+numberdeletedvariables-1;jj++) // t admits 4357 4628 { // no parametrisation 4358 4629 if (deletedvariables[jj]!=1) … … 4368 4639 } 4369 4640 } 4370 // otherwise we are done and we can start to compute 4641 // otherwise we are done and we can start to compute 4371 4642 // the last step of the parametrisation 4372 4643 else … … 4374 4645 // we store the information on m in a string 4375 4646 string PARAm=string(gesamt_m); 4376 // we define the weight of t, i.e. in the parametrisation t 4647 // we define the weight of t, i.e. in the parametrisation t 4377 4648 // has to be replaced by t^1/tweight 4378 4649 int tweight=-tw[1]; 4379 // if additional variables were necessary, 4650 // if additional variables were necessary, 4380 4651 // we introduce them now as parameters; 4381 // in any case the parametrisation ring will 4382 // have only one variable, namely t, 4383 // and its order will be local, so that it 4652 // in any case the parametrisation ring will 4653 // have only one variable, namely t, 4654 // and its order will be local, so that it 4384 4655 // displays the lowest term in t first 4385 4656 if (anzahlvariablen+numberdeletedvariables<nvars(basering)) … … 4392 4663 } 4393 4664 ideal PARA; // will contain the parametrisation 4394 // we start by initialising the entries to be zero; 4665 // we start by initialising the entries to be zero; 4395 4666 // one entry for each true variable 4396 // here we also have to consider the variables 4667 // here we also have to consider the variables 4397 4668 // that we have eliminated in before 4398 4669 for (jj=1;jj<=anzahlvariablen+numberdeletedvariables-1;jj++) … … 4401 4672 } 4402 4673 } 4403 // we now have to change the parametrisation by 4674 // we now have to change the parametrisation by 4404 4675 // reverting the transformations that we have done 4405 4676 list a=imap(BASERING,a); 4406 if (defined(wneu)==0) // when tropicalparametriseNoabs is called for the 4407 { // last time, it does not enter the part, where wneu is defined and the 4677 if (defined(wneu)==0) // when tropicalparametriseNoabs is called for the 4678 { // last time, it does not enter the part, where wneu is defined and the 4408 4679 intvec wneu=-1; // variable t should have weight -1 4409 4680 } … … 4412 4683 PARA[jj]=(PARA[jj]+a[jj+1])*t^(tw[jj+1]*tweight/ww[1]); 4413 4684 } 4414 // if we have reached the stop-level, i.e. either 4685 // if we have reached the stop-level, i.e. either 4415 4686 // we had only to compute up to order 1 4416 // or zero was a solution of the ideal, then we have 4687 // or zero was a solution of the ideal, then we have 4417 4688 // to export the computed parametrisation 4418 4689 // otherwise it has already been exported before 4419 4690 // note, if all variables were deleted, then i==0 and thus testaufnull==0 4420 4691 if ((ordnung==1) or (anzahlvariablen==1)) 4421 { 4692 { 4422 4693 export(PARA); 4423 4694 } 4424 4695 // kill the gfan files in /tmp 4425 system("sh","cd /tmp; /usr/bin/touch gfaninput; /usr/bin/touch gfanoutput; /bin/rm gfaninput; /bin/rm gfanoutput"); 4426 // we return a list which contains the 4696 system("sh","cd /tmp; /usr/bin/touch gfaninput; /usr/bin/touch gfanoutput; /bin/rm gfaninput; /bin/rm gfanoutput"); 4697 // we return a list which contains the 4427 4698 // parametrisation ring (with the parametrisation ideal) 4428 // and the string representing the maximal ideal 4699 // and the string representing the maximal ideal 4429 4700 // describing the necessary field extension 4430 4701 return(list(PARARing,tweight,PARAm)); … … 4435 4706 static proc findzeros (ideal i,intvec w,list #) 4436 4707 "USAGE: findzeros(i,w[,#]); i ideal, w intvec, # an optional list 4437 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_n+1,...,X_m] and 4708 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_n+1,...,X_m] and 4438 4709 w=(w_0,...,w_n,0,...,0) is in the tropical variety of i 4439 RETURN: list, l[1] = is polynomial ring containing an associated maximal 4440 ideal m of the w-initial ideal of i which does not 4710 RETURN: list, l[1] = is polynomial ring containing an associated maximal 4711 ideal m of the w-initial ideal of i which does not 4441 4712 contain any monomial and where the variables 4442 which do not lead to a field extension have already 4443 been eliminated, and containing a list a such that 4444 the non-zero entries of a correspond to the values 4713 which do not lead to a field extension have already 4714 been eliminated, and containing a list a such that 4715 the non-zero entries of a correspond to the values 4445 4716 of the zero of the associated maximal ideal for the 4446 4717 eliminated variables 4447 4718 l[2] = number of variables which have not been eliminated 4448 l[3] = intvec, if the entry is one then the corresponding 4719 l[3] = intvec, if the entry is one then the corresponding 4449 4720 variable has not been eliminated 4450 NOTE: the procedure is called from inside the recursive procedure 4721 NOTE: the procedure is called from inside the recursive procedure 4451 4722 tropicalparametriseNoabs; 4452 if it is called in the first recursion, the list #[1] contains 4453 the t-initial ideal of i w.r.t. w, otherwise #[1] is an integer, 4723 if it is called in the first recursion, the list #[1] contains 4724 the t-initial ideal of i w.r.t. w, otherwise #[1] is an integer, 4454 4725 one more than the number of true variables x_1,...,x_n" 4455 4726 { 4456 def BASERING=basering; 4727 def BASERING=basering; 4457 4728 // set anzahlvariablen to the number of true variables 4458 4729 if (typeof(#[1])=="int") … … 4460 4731 int anzahlvariablen=#[1]; 4461 4732 // compute the initial ideal of i 4462 // - the last 1 just means that the variable t is the last 4733 // - the last 1 just means that the variable t is the last 4463 4734 // variable in the ring 4464 4735 ideal ini=tInitialIdeal(i,w,1); … … 4467 4738 { 4468 4739 int anzahlvariablen=nvars(basering); 4469 ideal ini=#[1]; // the t-initial ideal has been computed 4740 ideal ini=#[1]; // the t-initial ideal has been computed 4470 4741 // in before and was handed over 4471 4742 } 4472 // move to a polynomial ring with global monomial ordering 4743 // move to a polynomial ring with global monomial ordering 4473 4744 // - the variable t is superflous 4474 4745 ideal variablen; 4475 4746 for (int j=1;j<=nvars(basering)-1;j++) 4476 { 4747 { 4477 4748 variablen=variablen+var(j); 4478 4749 } … … 4480 4751 ideal ini=imap(BASERING,ini); 4481 4752 // compute the associated primes of the initialideal 4482 // ordering the maximal ideals shall help to avoid 4753 // ordering the maximal ideals shall help to avoid 4483 4754 // unneccessary field extensions 4484 4755 list maximalideals=ordermaximalidealsNoabs(minAssGTZ(std(ini)),anzahlvariablen); 4485 4756 ideal m=maximalideals[1][1]; // the first associated maximal ideal 4486 4757 int neuvar=maximalideals[1][2]; // the number of new variables needed 4487 intvec neuevariablen=maximalideals[1][3]; // the information which variable 4758 intvec neuevariablen=maximalideals[1][3]; // the information which variable 4488 4759 // leads to a new one 4489 list a=maximalideals[1][4]; // a_k is the kth component of a 4760 list a=maximalideals[1][4]; // a_k is the kth component of a 4490 4761 // zero of m, if it is not zero 4491 // eliminate from m the superflous variables, that is those ones, 4762 // eliminate from m the superflous variables, that is those ones, 4492 4763 // which do not lead to a new variable 4493 4764 poly elimvars=1; … … 4499 4770 } 4500 4771 } 4501 m=eliminate(m,elimvars); 4502 export(a); 4772 m=eliminate(m,elimvars); 4773 export(a); 4503 4774 export(m); 4504 4775 list m_ring=INITIALRING,neuvar,neuevariablen; … … 4512 4783 static proc basictransformideal (ideal i,intvec w,list m_ring,list #) 4513 4784 "USAGE: basictransformideal(i,w,m_ring[,#]); i ideal, w intvec, m_ring list, # an optional list 4514 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], 4515 w=(w_0,...,w_n,0,...,0) is in the tropical variety of i, and 4785 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], 4786 w=(w_0,...,w_n,0,...,0) is in the tropical variety of i, and 4516 4787 m_ring contains a ring containing a maximal ideal m needed 4517 to describe the field extension over which a corresponding 4518 associated maximal ideal of the initialideal of i, considered 4519 in (Q[X_1,...,X_k]/m_alt)(t)[x_1,...,x_n], has a zero, and 4788 to describe the field extension over which a corresponding 4789 associated maximal ideal of the initialideal of i, considered 4790 in (Q[X_1,...,X_k]/m_alt)(t)[x_1,...,x_n], has a zero, and 4520 4791 containing a list a describing the zero of m, and m_ring contains 4521 4792 the information how many new variables are needed for m … … 4524 4795 l[3] = ideal, the maximal ideal m 4525 4796 or l[1] = ring which contains the ideals i and m, and the list a 4526 NOTE: the procedure is called from inside the recursive procedure 4797 NOTE: the procedure is called from inside the recursive procedure 4527 4798 tropicalparametriseNoabs; 4528 if it is called in the first recursion, the list # is empty, 4799 if it is called in the first recursion, the list # is empty, 4529 4800 otherwise #[1] is an integer, the number of true variables x_1,...,x_n; 4530 during the procedure we check if a field extension is necessary 4531 to express a zero (a_1,...,a_n) of m; if so, we have to introduce 4532 new variables and a list containing a ring is returned, otherwise 4533 the list containing i, a and m is returned; 4534 the ideal m will be changed during the procedure since all variables 4801 during the procedure we check if a field extension is necessary 4802 to express a zero (a_1,...,a_n) of m; if so, we have to introduce 4803 new variables and a list containing a ring is returned, otherwise 4804 the list containing i, a and m is returned; 4805 the ideal m will be changed during the procedure since all variables 4535 4806 which reduce to a polynomial in X_1,...,X_k modulo m will be eliminated, 4536 4807 while the others are replaced by new variables X_k+1,...,X_k'" … … 4544 4815 wdegs[j]=deg(i[j],intvec(w[2..size(w)],w[1])); 4545 4816 } 4546 // how many variables are true variables, 4817 // how many variables are true variables, 4547 4818 // and how many come from the field extension 4548 4819 // only real variables have to be transformed … … 4559 4830 // get the information if any new variables are needed from m_ring 4560 4831 int neuvar=m_ring[2]; // number of variables which have to be added 4561 intvec neuevariablen=m_ring[3]; // [i]=1, if for the ith comp. 4832 intvec neuevariablen=m_ring[3]; // [i]=1, if for the ith comp. 4562 4833 // of a zero of m a new variable is needed 4563 4834 def MRING=m_ring[1]; // MRING contains a and m 4564 list a=imap(MRING,a); // (a_1,...,a_n)=(a[2],...,a[n+1]) will be 4835 list a=imap(MRING,a); // (a_1,...,a_n)=(a[2],...,a[n+1]) will be 4565 4836 // a common zero of the ideal m 4566 ideal m=std(imap(MRING,m)); // m is zero, if neuvar==0, 4837 ideal m=std(imap(MRING,m)); // m is zero, if neuvar==0, 4567 4838 // otherwise we change the ring anyway 4568 // if a field extension is needed, then extend the polynomial 4839 // if a field extension is needed, then extend the polynomial 4569 4840 // ring by new variables X_k+1,...,X_k'; 4570 4841 if (neuvar>0) 4571 4842 { 4572 // change to a ring where for each variable needed 4843 // change to a ring where for each variable needed 4573 4844 // in m a new variable has been introduced 4574 4845 ideal variablen; … … 4581 4852 // map i into the new ring 4582 4853 ideal i=imap(BASERING,i); 4583 // define a map phi which maps the true variables, which are not 4854 // define a map phi which maps the true variables, which are not 4584 4855 // reduced to polynomials in the additional variables modulo m, to 4585 // the corresponding newly introduced variables, and which maps 4856 // the corresponding newly introduced variables, and which maps 4586 4857 // the old additional variables to themselves 4587 4858 ideal phiideal; 4588 4859 k=1; 4589 for (j=2;j<=size(neuevariablen);j++) // starting with 2, since the 4860 for (j=2;j<=size(neuevariablen);j++) // starting with 2, since the 4590 4861 { // first entry corresponds to t 4591 4862 if(neuevariablen[j]==1) … … 4596 4867 else 4597 4868 { 4598 phiideal[j-1]=0; 4869 phiideal[j-1]=0; 4599 4870 } 4600 4871 } … … 4603 4874 phiideal=phiideal,X(1..nvars(BASERING)-anzahlvariablen); 4604 4875 } 4605 map phi=MRING,phiideal; 4606 // map m and a to the new ring via phi, so that the true variables 4876 map phi=MRING,phiideal; 4877 // map m and a to the new ring via phi, so that the true variables 4607 4878 // in m and a are replaced by 4608 4879 // the corresponding newly introduced variables … … 4610 4881 list a=phi(a); 4611 4882 } 4612 // replace now the zeros among the a_j by the corresponding 4883 // replace now the zeros among the a_j by the corresponding 4613 4884 // newly introduced variables; 4614 // note that no component of a can be zero 4885 // note that no component of a can be zero 4615 4886 // since the maximal ideal m contains no variable! 4616 // moreover, substitute right away in the ideal i 4887 // moreover, substitute right away in the ideal i 4617 4888 // the true variable x_j by (a_j+x_j)*t^w_j 4618 4889 zaehler=nvars(BASERING)-anzahlvariablen+1; 4619 for (j=1;j<=anzahlvariablen;j++) 4890 for (j=1;j<=anzahlvariablen;j++) 4620 4891 { 4621 4892 if ((a[j]==0) and (j!=1)) // a[1]=0, since t->t^w_0 4622 { 4893 { 4623 4894 a[j]=X(zaehler); 4624 4895 zaehler++; … … 4627 4898 { 4628 4899 if (j!=1) // corresponds to x_(j-1) -- note t is the last variable 4629 { 4900 { 4630 4901 i[k]=substitute(i[k],var(j-1),(a[j]+var(j-1))*t^(-w[j])); 4631 4902 } … … 4639 4910 for (j=1;j<=ncols(i);j++) 4640 4911 { 4641 if (wdegs[j]<0) // if wdegs[j]==0 there is no need to divide, and 4912 if (wdegs[j]<0) // if wdegs[j]==0 there is no need to divide, and 4642 4913 { // we made sure that it is no positive 4643 4914 i[j]=i[j]/t^(-wdegs[j]); 4644 4915 } 4645 4916 } 4646 // since we want to consider i now in the ring 4917 // since we want to consider i now in the ring 4647 4918 // (Q[X_1,...,X_k']/m)[t,x_1,...,x_n] 4648 // we can reduce i modulo m, so that "constant terms" 4919 // we can reduce i modulo m, so that "constant terms" 4649 4920 // which are "zero" since they 4650 4921 // are in m will disappear; simplify(...,2) then really removes them 4651 4922 i=simplify(reduce(i,m),2); 4652 // if new variables have been introduced, we have 4923 // if new variables have been introduced, we have 4653 4924 // to return the ring containing i, a and m 4654 4925 // otherwise we can simply return a list containing i, a and m … … 4671 4942 static proc testw (ideal i,intvec w,int anzahlvariablen,list #) 4672 4943 "USAGE: testw(i,w,n); i ideal, w intvec, n number 4673 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k] and 4674 w=(w_0,...,w_n,0,...,0) 4675 RETURN: int b, 0 if the t-initial ideal of i considered in 4944 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k] and 4945 w=(w_0,...,w_n,0,...,0) 4946 RETURN: int b, 0 if the t-initial ideal of i considered in 4676 4947 Q(X_1,...,X_k)[t,x_1,...,x_n] is monomial free, 1 else 4677 4948 NOTE: the procedure is called by tinitialform" … … 4687 4958 ideal tin=tInitialIdeal(i,w,1); 4688 4959 } 4689 4960 4690 4961 int j; 4691 4962 ideal variablen; … … 4719 4990 def BASERING=basering; 4720 4991 if (anzahlvariablen<nvars(basering)) 4721 { 4992 { 4722 4993 execute("ring TINRING=("+charstr(basering)+","+string(Parameter)+"),("+string(variablen)+"),dp;"); 4723 4994 } … … 4729 5000 poly monom=imap(BASERING,monom); 4730 5001 return(radicalMemberShip(monom,tin)); 4731 } 5002 } 4732 5003 4733 5004 ///////////////////////////////////////////////////////////////////////// … … 4735 5006 static proc simplifyToOrder (poly f) 4736 5007 "USAGE: simplifyToOrder(f); f a polynomial 4737 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 5008 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 4738 5009 RETURN: list, l[1] = t-order of leading term of f 4739 5010 l[2] = the rational coefficient of the term of lowest t-order … … 4758 5029 static proc scalarproduct (intvec w,intvec v) 4759 5030 "USAGE: scalarproduct(w,v); w,v intvec 4760 ASSUME: w and v are integer vectors of the same length 5031 ASSUME: w and v are integer vectors of the same length 4761 5032 RETURN: int, the scalarproduct of v and w 4762 5033 NOTE: the procedure is called by tropicalparametriseNoabs" … … 4816 5087 "USAGE: ordermaximalidealsNoabs(minassi); minassi list 4817 5088 ASSUME: minassi is a list of maximal ideals 4818 RETURN: list, the procedure orders the maximal ideals in minassi according 4819 to how many new variables are needed to describe the zeros 5089 RETURN: list, the procedure orders the maximal ideals in minassi according 5090 to how many new variables are needed to describe the zeros 4820 5091 of the ideal 4821 5092 l[j][1] = jth maximal ideal 4822 5093 l[j][2] = the number of variables needed 4823 l[j][3] = intvec, if for the kth variable a new variable is 4824 needed to define the corresponding zero of 5094 l[j][3] = intvec, if for the kth variable a new variable is 5095 needed to define the corresponding zero of 4825 5096 l[j][1], then the k+1st entry is one 4826 l[j][4] = list, if for the kth variable no new variable is 4827 needed to define the corresponding zero of 5097 l[j][4] = list, if for the kth variable no new variable is 5098 needed to define the corresponding zero of 4828 5099 l[j][1], then its value is the k+1st entry 4829 5100 NOTE: if a maximal ideal contains a variable, it is removed from the list; … … 4834 5105 int pruefer; // is set one if a maximal ideal contains a variable 4835 5106 list minassisort; // will contain the output 4836 for (j=1;j<=size(minassi);j++){minassisort[j]=0;} // initialise minassisort 5107 for (j=1;j<=size(minassi);j++){minassisort[j]=0;} // initialise minassisort 4837 5108 // to fix its initial length 4838 5109 list zwischen; // needed for reordering 4839 5110 list a;// (a_1,...,a_n)=(a[2],...,a[n+1]) will be a common zero of the ideal m 4840 5111 poly nf; // normalform of a variable w.r.t. m 4841 intvec neuevariablen; // ith entry is 1, if for the ith component of a zero 5112 intvec neuevariablen; // ith entry is 1, if for the ith component of a zero 4842 5113 // of m a new variable is needed 4843 5114 intvec testvariablen; // integer vector of length n=number of variables 4844 // compute for each maximal ideal the number of new variables, 5115 // compute for each maximal ideal the number of new variables, 4845 5116 // which are needed to describe 4846 // its zeros -- note, a new variable is needed if modulo 4847 // the maximal ideal it does not reduce 5117 // its zeros -- note, a new variable is needed if modulo 5118 // the maximal ideal it does not reduce 4848 5119 // to something which only depends on the following variables; 4849 // if no new variable is needed, then store the value 4850 // a variable reduces to in the list a; 5120 // if no new variable is needed, then store the value 5121 // a variable reduces to in the list a; 4851 5122 for (j=size(minassi);j>=1;j--) 4852 5123 { 4853 a[1]=poly(0); // the first entry in a and in neuevariablen 5124 a[1]=poly(0); // the first entry in a and in neuevariablen 4854 5125 // corresponds to the variable t, 4855 5126 neuevariablen[1]=0; // which is not present in the INITIALRING … … 4859 5130 { 4860 5131 nf=reduce(var(k),minassi[j]); 4861 // if a variable reduces to zero, then the maximal ideal 5132 // if a variable reduces to zero, then the maximal ideal 4862 5133 // contains a variable and we can delete it 4863 5134 if (nf==0) … … 4865 5136 pruefer=1; 4866 5137 } 4867 // set the entries of testvariablen corresponding to the first 5138 // set the entries of testvariablen corresponding to the first 4868 5139 // k variables to 1, and the others to 0 4869 5140 for (l=1;l<=nvars(basering);l++) 4870 5141 { 4871 5142 if (l<=k) 4872 { 5143 { 4873 5144 testvariablen[l]=1; 4874 5145 } … … 4878 5149 } 4879 5150 } 4880 // if the variable x_j reduces to a polynomial 5151 // if the variable x_j reduces to a polynomial 4881 5152 // in x_j+1,...,x_n,X_1,...,X_k modulo m 4882 // then we can eliminate x_j from the maximal ideal 5153 // then we can eliminate x_j from the maximal ideal 4883 5154 // (since we do not need any 4884 // further field extension to express a_j) and a_j 5155 // further field extension to express a_j) and a_j 4885 5156 // will just be this normalform, 4886 5157 // otherwise we have to introduce a new variable in order to express a_j; … … 4889 5160 a[k+1]=nf; // a_k is the normal form of the kth variable modulo m 4890 5161 neuevariablen[k+1]=0; // no new variable is needed 4891 } 5162 } 4892 5163 else 4893 5164 { 4894 a[k+1]=poly(0); // a_k is set to zero until we have 5165 a[k+1]=poly(0); // a_k is set to zero until we have 4895 5166 // introduced the new variable 4896 5167 neuevariablen[k+1]=1; … … 4900 5171 // if the maximal ideal contains a variable, we simply delete it 4901 5172 if (pruefer==0) 4902 { 5173 { 4903 5174 minassisort[j]=list(minassi[j],neuvar,neuevariablen,a); 4904 5175 } 4905 // otherwise we store the information on a, 5176 // otherwise we store the information on a, 4906 5177 // neuevariablen and neuvar together with the ideal 4907 5178 else … … 4912 5183 } 4913 5184 } 4914 // sort the maximal ideals ascendingly according to 5185 // sort the maximal ideals ascendingly according to 4915 5186 // the number of new variables needed to 4916 5187 // express the zero of the maximal ideal … … 4919 5190 l=j; 4920 5191 for (k=j-1;k>=1;k--) 4921 { 5192 { 4922 5193 if (minassisort[l][2]<minassisort[k][2]) 4923 5194 { … … 4937 5208 "USAGE: displaypoly(p,N,wj,w1); p poly, N, wj, w1 int 4938 5209 ASSUME: p is a polynomial in r=(0,X(1..k)),t,ls 4939 RETURN: string, the string of t^-wj/w1*p(t^1/N) 5210 RETURN: string, the string of t^-wj/w1*p(t^1/N) 4940 5211 NOTE: the procedure is called from displayTropicalLifting" 4941 5212 { … … 4955 5226 { 4956 5227 if (koeffizienten[j-ord(p)+1]!=0) 4957 { 5228 { 4958 5229 if ((j-(N*wj)/w1)==0) 4959 5230 { … … 5005 5276 static proc displaycoef (poly p) 5006 5277 "USAGE: displaycoef(p); p poly 5007 RETURN: string, the string of p where brackets around 5278 RETURN: string, the string of p where brackets around 5008 5279 have been added if they were missing 5009 5280 NOTE: the procedure is called from displaypoly" … … 5077 5348 static proc tropicalliftingresubstitute (ideal i,list liftring,int N,list #) 5078 5349 "USAGE: tropicalliftingresubstitute(i,L,N[,#]); i ideal, L list, N int, # string 5079 ASSUME: i is an ideal and L[1] is a ring which contains the lifting of a 5080 point in the tropical variety of i computed with tropicalLifting; 5081 t has to be replaced by t^1/N in the lifting; #[1]=m is the string 5082 of the maximal ideal defining the necessary field extension as 5350 ASSUME: i is an ideal and L[1] is a ring which contains the lifting of a 5351 point in the tropical variety of i computed with tropicalLifting; 5352 t has to be replaced by t^1/N in the lifting; #[1]=m is the string 5353 of the maximal ideal defining the necessary field extension as 5083 5354 computed by tropicalLifting, if #[1] is present 5084 5355 RETURN: string, the lifting has been substituted into i … … 5103 5374 ideal i=imap(BASERING,i); 5104 5375 } 5105 } 5376 } 5106 5377 else 5107 5378 { … … 5116 5387 } 5117 5388 // map the resulting i back to LIFTRing; 5118 // if noAbs, then reduce i modulo the maximal ideal 5389 // if noAbs, then reduce i modulo the maximal ideal 5119 5390 // before going back to LIFTRing 5120 5391 if ((size(parstr(LIFTRing))!=0) and size(#)>0) … … 5133 5404 for (j=1;j<=ncols(i);j++) 5134 5405 { 5135 SUBSTTEST[j]=displaypoly(i[j],N,0,1); 5406 SUBSTTEST[j]=displaypoly(i[j],N,0,1); 5136 5407 } 5137 5408 return(SUBSTTEST); … … 5143 5414 /// - eliminatecomponents 5144 5415 /// - findzerosAndBasictransform 5145 /// - ordermaximalideals 5416 /// - ordermaximalideals 5146 5417 /////////////////////////////////////////////////////////////////////////////// 5147 5418 5148 static proc tropicalparametrise (ideal i,intvec ww,int ordnung,int gfanold,int findall,int nogfan, list #)5149 "USAGE: tropicalparametrise(i,tw,ord,gf,fa,ng [,#]); i ideal, tw intvec, ord int, gf,fa,ngint, # opt. list5150 ASSUME: - i is an ideal in Q[t,x_1,...,x_n,@a], tw=(w_0,w_1,...,w_n,0) 5151 and (w_0,...,w_n,0) is in the tropical variety of i, 5152 and ord is the order up to which a point in V(i) 5153 over K{{t}} lying over w shall be computed; 5154 - moreover, @a should be not be there if the procedure is not 5419 static proc tropicalparametrise (ideal i,intvec ww,int ordnung,int gfanold,int findall,int nogfan,int puiseux,list #) 5420 "USAGE: tropicalparametrise(i,tw,ord,gf,fa,ng,pu[,#]); i ideal, tw intvec, ord int, gf,fa,ng,pu int, # opt. list 5421 ASSUME: - i is an ideal in Q[t,x_1,...,x_n,@a], tw=(w_0,w_1,...,w_n,0) 5422 and (w_0,...,w_n,0) is in the tropical variety of i, 5423 and ord is the order up to which a point in V(i) 5424 over K{{t}} lying over w shall be computed; 5425 - moreover, @a should be not be there if the procedure is not 5155 5426 called recursively; 5156 5427 - the point in the tropical variety is supposed to lie in the 5157 5428 NEGATIVE orthant; 5158 - the ideal is zero-dimensional when considered in 5159 (K(t)[@a]/m)[x_1,...,x_n], where m=#[2] is a maximal ideal in K[@a]; 5429 - the ideal is zero-dimensional when considered in 5430 (K(t)[@a]/m)[x_1,...,x_n], where m=#[2] is a maximal ideal in K[@a]; 5160 5431 - gf is 0 if version 2.2 or larger is used and it is 1 else 5161 5432 - fa is 1 if all solutions should be found 5162 5433 - ng is 1 if gfan should not be executed 5434 - pu is 1 if n=1 and i is generated by one polynomial and newtonpoly is used to find a 5435 point in the tropical variety instead of gfan 5163 5436 RETURN: list, l[1] = ring K[@a]/m[[t]] 5164 5437 l[2] = int 5165 5438 NOTE: - the procedure is also called recursively by itself, and 5166 if it is called in the first recursion, the list # is empty, 5167 otherwise #[1] is an integer, one more than the number of 5168 true variables x_1,...,x_n, and #[2] will contain the maximal 5169 ideal m in the variable @a by which the ring K[t,x_1,...,x_n,@a] 5170 should be divided to work correctly in L[t,x_1,...,x_n] where 5439 if it is called in the first recursion, the list # is empty, 5440 otherwise #[1] is an integer, one more than the number of 5441 true variables x_1,...,x_n, and #[2] will contain the maximal 5442 ideal m in the variable @a by which the ring K[t,x_1,...,x_n,@a] 5443 should be divided to work correctly in L[t,x_1,...,x_n] where 5171 5444 L=Q[@a]/m is a field extension of K 5172 - the ring l[1] contains an ideal PARA, which contains the 5173 parametrisation of a point in V(i) lying over w up to the first 5445 - the ring l[1] contains an ideal PARA, which contains the 5446 parametrisation of a point in V(i) lying over w up to the first 5174 5447 ord terms; 5175 - the string m contains the code of the maximal ideal m, by which we 5448 - the string m contains the code of the maximal ideal m, by which we 5176 5449 have to divide K[@a] in order to have the appropriate field extension 5177 5450 over which the parametrisation lives; 5178 5451 - and if the integer l[3] is N then t has to be replaced by t^1/N in the 5179 parametrisation, or alternatively replace t by t^N in the defining 5452 parametrisation, or alternatively replace t by t^N in the defining 5180 5453 ideal 5181 - the procedure REQUIRES that the program GFAN is installed 5454 - the procedure REQUIRES that the program GFAN is installed 5182 5455 on your computer" 5183 5456 { … … 5185 5458 int recursively; // is set 1 if the procedure is called recursively by itself 5186 5459 int ii,jj,kk,ll,jjj,kkk,lll; 5187 if (typeof(#[1])=="int") // this means the precedure has been 5460 if (typeof(#[1])=="int") // this means the precedure has been 5188 5461 { // called recursively 5189 // how many variables are true variables, and how many come 5462 // how many variables are true variables, and how many come 5190 5463 // from the field extension 5191 5464 // only true variables have to be transformed 5192 5465 int anzahlvariablen=#[1]; 5193 5466 // find the zeros of the w-initial ideal and transform the ideal i; 5194 // findzeros and basictransformideal need to know 5467 // findzeros and basictransformideal need to know 5195 5468 // how many of the variables are true variables 5196 5469 // and do the basic transformation as well … … 5200 5473 else // the procedure has been called by tropicalLifting 5201 5474 { 5202 // how many variables are true variables, and 5475 // how many variables are true variables, and 5203 5476 // how many come from the field extension 5204 5477 // only true variables have to be transformed 5205 5478 int anzahlvariablen=nvars(basering); 5206 list zerolist; // will carry the zeros which are 5207 //computed in the recursion steps 5479 list zerolist; // will carry the zeros which are 5480 //computed in the recursion steps 5208 5481 // the initial ideal of i has been handed over as #[1] 5209 5482 ideal ini=#[1]; 5210 5483 // find the zeros of the w-initial ideal and transform the ideal i; 5211 // we should hand the t-initial ideal ine to findzeros, 5484 // we should hand the t-initial ideal ine to findzeros, 5212 5485 // since we know it already; 5213 5486 // and do the basic transformation as well … … 5215 5488 } 5216 5489 list wneulist; // carries all newly computed weight vector 5217 intvec wneu; // carries the newly computed weight vector 5490 intvec wneu; // carries the newly computed weight vector 5218 5491 int tweight; // carries the weight of t 5219 list PARALIST; // carries the result when tropicalparametrise 5492 list PARALIST; // carries the result when tropicalparametrise 5220 5493 // is recursively called 5221 5494 list eliminaterings; // carries the result of eliminatecomponents … … 5226 5499 list liftings,partliftings; // the computed liftings (all resp. partly) 5227 5500 // consider each ring which has been returned when computing the zeros of the 5228 // the t-initial ideal, equivalently, consider 5501 // the t-initial ideal, equivalently, consider 5229 5502 // each zero which has been returned 5230 5503 for (jj=1;jj<=size(trring);jj++) … … 5232 5505 def TRRING=trring[jj]; 5233 5506 setring TRRING; 5234 // check if a certain number of components lead to suitable 5507 // check if a certain number of components lead to suitable 5235 5508 // solutions with zero components; 5236 5509 // compute them all if findall==1 5237 5510 eliminaterings=eliminatecomponents(i,m,oldanzahlvariablen,findall,oldanzahlvariablen-1,deletedvariables); 5238 // consider each of the rings returned by eliminaterings ... 5511 // consider each of the rings returned by eliminaterings ... 5239 5512 // there is at least one !!! 5240 5513 for (ii=1;ii<=size(eliminaterings);ii++) 5241 5514 { 5242 5515 // #variables which have been eliminated 5243 numberdeletedvariables=oldanzahlvariablen-eliminaterings[ii][2]; 5516 numberdeletedvariables=oldanzahlvariablen-eliminaterings[ii][2]; 5244 5517 // #true variables which remain (including t) 5245 anzahlvariablen=eliminaterings[ii][2]; 5518 anzahlvariablen=eliminaterings[ii][2]; 5246 5519 // a 1 in this vector says that variable was eliminated 5247 deletedvariables=eliminaterings[ii][3]; 5520 deletedvariables=eliminaterings[ii][3]; 5248 5521 setring TRRING; // set TRRING - this is important for the loop 5249 5522 // pass the ring computed by eliminatecomponents 5250 def PREGFANRING=eliminaterings[ii][1]; 5523 def PREGFANRING=eliminaterings[ii][1]; 5251 5524 setring PREGFANRING; 5252 5525 poly m=imap(TRRING,m); // map the maximal ideal to this ring 5253 5526 list zero=imap(TRRING,zero); // map the vector of zeros to this ring 5254 // now we have to compute a point ww on the tropical 5527 // now we have to compute a point ww on the tropical 5255 5528 // variety of the transformed ideal i; 5256 // of course, we only have to do so, if we have 5529 // of course, we only have to do so, if we have 5257 5530 // not yet reached the order up to which we 5258 5531 // were supposed to do our computations 5259 if ((ordnung>1) and (anzahlvariablen>1)) // if only t remains, 5532 if ((ordnung>1) and (anzahlvariablen>1)) // if only t remains, 5260 5533 { // all true variables are gone 5261 5534 if (nogfan!=1) 5262 { 5535 { 5263 5536 // pass to a ring which has variables which are suitable for gfan 5264 5537 execute("ring GFANRING=("+string(char(basering))+"),(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z),dp;"); 5265 ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z; 5538 ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z; 5266 5539 phiideal[nvars(PREGFANRING)]=a; // map t to a 5267 map phi=PREGFANRING,phiideal; 5540 map phi=PREGFANRING,phiideal; 5268 5541 ideal II=phi(i); 5269 // homogenise the ideal II with the first not yet 5270 // used variable in our ring, since gfan 5271 // only handles homogenous ideals; in principle for this 5542 // homogenise the ideal II with the first not yet 5543 // used variable in our ring, since gfan 5544 // only handles homogenous ideals; in principle for this 5272 5545 // one has first to compute a 5273 // standard basis of II and homogenise that, 5274 // but for the tropical variety (says Anders) 5546 // standard basis of II and homogenise that, 5547 // but for the tropical variety (says Anders) 5275 5548 // it suffices to homogenise an arbitrary system of generators 5276 // II=groebner(II); 5549 // II=groebner(II); 5277 5550 II=homog(II,maxideal(1)[nvars(PREGFANRING)+1]); 5278 5551 // if gfan version >= 0.3.0 is used and the characteristic … … 5312 5585 int goon=1; 5313 5586 trop; 5314 "CHOOSE A RAY IN THE OUTPUT OF GFAN WHICH HAS ONLY"; 5587 "CHOOSE A RAY IN THE OUTPUT OF GFAN WHICH HAS ONLY"; 5315 5588 "NON-POSITIVE ENTRIES AND STARTS WITH A NEGATIVE ONE,"; 5316 5589 "E.G. (-3,-4,-1,-5,0,0,0) - the last entry will always be 0 -"; … … 5319 5592 "IF YOU WANT wneu TO BE TESTED, THEN SET goon=0;"; 5320 5593 ~ 5321 // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY 5594 // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY 5322 5595 // THE TROPICAL PREVARIETY 5323 // test, if wneu really is in the tropical variety 5596 // test, if wneu really is in the tropical variety 5324 5597 while (goon==0) 5325 5598 { … … 5339 5612 { 5340 5613 system("sh","gfan_tropicallifting -n "+string(anzahlvariablen)+" --noMult -c < /tmp/gfaninput > /tmp/gfanoutput"); 5341 // read the result from gfan and store it to a string, 5614 // read the result from gfan and store it to a string, 5342 5615 // which in a later version 5343 5616 // should be interpreded by Singular … … 5349 5622 else // if gfan is NOT executed 5350 5623 { 5351 if (findall==1) 5624 // if puiseux is set, then we are in the case of a plane curve and can use the command newtonpoly 5625 if (puiseux==1) 5352 5626 { 5353 "Set wneulist!"; 5354 ~ 5627 if (nvars(basering)>2) // if the basering has a parameter 5628 { // we have to pass to a ring with two variables to compute the newtonpoly 5629 def PRENPRing=basering; 5630 poly NPpoly=i[size(i)]; 5631 ring NPRING=(0,@a),(x(1),t),ds; 5632 poly NPpoly=imap(PRENPRing,NPpoly); 5633 list NewtP=newtonpoly(NPpoly); 5634 setring PRENPRing; 5635 kill NPRING; 5636 } 5637 else 5638 { 5639 list NewtP=newtonpoly(i[1]); 5640 } 5641 for (jjj=1;jjj<=size(NewtP)-1;jjj++) 5642 { 5643 wneu=NewtP[jjj]-NewtP[jjj+1]; 5644 int ggteiler=gcd(wneu[1],wneu[2]); 5645 wneu[1]=-wneu[1]/ggteiler; 5646 wneu[2]=wneu[2]/ggteiler; 5647 if (wneu[1]>0) 5648 { 5649 wneu=-wneu; 5650 } 5651 if (nvars(basering)>2) 5652 { 5653 wneu[3]=0; 5654 } 5655 wneulist[jjj]=wneu; 5656 } 5657 kill NewtP,ggteiler; 5355 5658 } 5356 else 5659 else // we have to set the points in the tropical variety by hand 5357 5660 { 5358 "Set intvec wneu!"; 5359 ~ 5360 wneulist[1]=wneu; 5361 } 5661 if (findall==1) 5662 { 5663 "Set wneulist!"; 5664 ~ 5665 } 5666 else 5667 { 5668 "Set intvec wneu!"; 5669 ~ 5670 wneulist[1]=wneu; 5671 } 5672 } 5362 5673 } 5363 5674 } 5364 // if we have not yet computed our parametrisation up to 5675 // if we have not yet computed our parametrisation up to 5365 5676 // the required order and 5366 // zero is not yet a solution, then we have to go on 5677 // zero is not yet a solution, then we have to go on 5367 5678 // by calling the procedure recursively; 5368 5679 // if all variables were deleted, then i=0 and thus anzahlvariablen==0 5369 5680 lll=0; 5370 5681 if ((ordnung>1) and (anzahlvariablen>1)) 5371 { 5682 { 5372 5683 partliftings=list(); // initialise partliftings 5373 // we call the procedure with the transformed 5684 // we call the procedure with the transformed 5374 5685 // ideal i, the new weight vector, with the 5375 // required order lowered by one, and with 5686 // required order lowered by one, and with 5376 5687 // additional parameters, namely the number of 5377 // true variables and the maximal ideal that 5688 // true variables and the maximal ideal that 5378 5689 // was computed so far to describe the field extension 5379 5690 for (kk=1;kk<=size(wneulist);kk++) 5380 5691 { 5381 5692 wneu=wneulist[kk]; 5382 PARALIST=tropicalparametrise(i,wneu,ordnung-1,gfanold,findall,nogfan, anzahlvariablen,zero);5383 // the output will be a ring, in which the 5693 PARALIST=tropicalparametrise(i,wneu,ordnung-1,gfanold,findall,nogfan,puiseux,anzahlvariablen,zero); 5694 // the output will be a ring, in which the 5384 5695 // parametrisation lives, and a string, which contains 5385 5696 // the maximal ideal that describes the necessary field extension 5386 5697 for (ll=1;ll<=size(PARALIST);ll++) 5387 { 5698 { 5388 5699 def PARARing=PARALIST[ll][1]; 5389 5700 tweight=-ww[1]*PARALIST[ll][2]; 5390 5701 setring PARARing; 5391 // if some variables have been eliminated 5392 // in before, then we have to insert zeros 5702 // if some variables have been eliminated 5703 // in before, then we have to insert zeros 5393 5704 // into the parametrisation for those variables 5394 5705 if (numberdeletedvariables>0) … … 5396 5707 ideal PARAneu=PARA; 5397 5708 kkk=0; 5398 for (jjj=1;jjj<=anzahlvariablen+numberdeletedvariables-1;jjj++) 5709 for (jjj=1;jjj<=anzahlvariablen+numberdeletedvariables-1;jjj++) 5399 5710 { // t admits no parametrisation 5400 5711 if (deletedvariables[jjj]!=1) … … 5416 5727 } 5417 5728 } 5418 // otherwise we are done and we can start 5729 // otherwise we are done and we can start 5419 5730 // to compute the last step of the parametrisation 5420 5731 else 5421 5732 { 5422 // we define the weight of t, i.e. in the 5733 // we define the weight of t, i.e. in the 5423 5734 // parametrisation t has to be replaced by t^1/tweight 5424 5735 tweight=-ww[1]; 5425 // if additional variables were necessary, 5736 // if additional variables were necessary, 5426 5737 // we introduce them now as parameters; 5427 // in any case the parametrisation ring will 5428 // have only one variable, namely t, 5429 // and its order will be local, so that it 5738 // in any case the parametrisation ring will 5739 // have only one variable, namely t, 5740 // and its order will be local, so that it 5430 5741 // displays the lowest term in t first 5431 5742 if (anzahlvariablen<nvars(basering)) … … 5439 5750 } 5440 5751 ideal PARA; // will contain the parametrisation 5441 // we start by initialising the entries to be zero; 5752 // we start by initialising the entries to be zero; 5442 5753 // one entry for each true variable 5443 // here we also have to consider the variables 5754 // here we also have to consider the variables 5444 5755 // that we have eliminated in before 5445 5756 for (jjj=1;jjj<=anzahlvariablen+numberdeletedvariables-1;jjj++) … … 5453 5764 kill PARARing; 5454 5765 } 5455 // we now have to change the parametrisation by 5766 // we now have to change the parametrisation by 5456 5767 // reverting the transformations that we have done 5457 5768 for (lll=1;lll<=size(partliftings);lll++) 5458 5769 { 5459 if (size(partliftings[lll])==2) // when tropicalparametrise is called 5460 { // for the last time, it does not enter the part, where wneu is 5770 if (size(partliftings[lll])==2) // when tropicalparametrise is called 5771 { // for the last time, it does not enter the part, where wneu is 5461 5772 wneu=-1; // defined and the variable t should have weight -1 5462 5773 } … … 5473 5784 PARA[jjj]=(PARA[jjj]+zeros[size(zeros)][jjj+1])*t^(ww[jjj+1]*tweight/ww[1]); 5474 5785 } 5475 // delete the last entry in zero, since that one has 5786 // delete the last entry in zero, since that one has 5476 5787 // been used for the transformation 5477 5788 zeros=delete(zeros,size(zeros)); 5478 // in order to avoid redefining commands an empty 5789 // in order to avoid redefining commands an empty 5479 5790 // zeros list should be removed 5480 5791 if (size(zeros)==0) … … 5491 5802 kill TRRING; 5492 5803 } 5493 // kill the gfan files in /tmp 5494 system("sh","cd /tmp; /usr/bin/touch gfaninput; /usr/bin/touch gfanoutput; /bin/rm gfaninput; /bin/rm gfanoutput"); 5495 // we return a list which contains lists of the parametrisation 5804 if (nogfan!=1) 5805 { 5806 // kill the gfan files in /tmp 5807 system("sh","cd /tmp; /usr/bin/touch gfaninput; /usr/bin/touch gfanoutput; /bin/rm gfaninput; /bin/rm gfanoutput"); 5808 } 5809 // we return a list which contains lists of the parametrisation 5496 5810 // rings (with the parametrisation ideal) 5497 5811 // and an integer N such that t should be replaced by t^1/N … … 5503 5817 static proc eliminatecomponents (ideal i,ideal m,int anzahlvariablen,int findall,int lastvar,intvec deletedvariables) 5504 5818 "USAGE: eliminatecomponents(i,m,n,a,v,d); i,m ideal, n,a,v int, d intvec 5505 ASSUME: i is an ideal in Q[x_1,...,x_n,@a,t] and w=(-w_1/w_0,...,-w_n/w_0) 5506 is in the tropical variety of i considered in 5507 Q[@a]/m{{t}}[x_1,...,x_n]; 5508 considered in this ring i is zero-dimensional; @a need not be present 5819 ASSUME: i is an ideal in Q[x_1,...,x_n,@a,t] and w=(-w_1/w_0,...,-w_n/w_0) 5820 is in the tropical variety of i considered in 5821 Q[@a]/m{{t}}[x_1,...,x_n]; 5822 considered in this ring i is zero-dimensional; @a need not be present 5509 5823 in which case m is zero; 1<=v<=n 5510 5824 RETURN: list, L of lists … … 5512 5826 L[j][2] = an integer anzahlvariablen 5513 5827 L[j][3] = an intvec deletedvariables 5514 NOTE: - the procedure is called from inside the recursive 5828 NOTE: - the procedure is called from inside the recursive 5515 5829 procedure tropicalparametrise 5516 - the procedure checks for solutions which have certain 5517 components zero; these are separated from the rest by 5518 elimination and saturation; the integer deletedvariables 5519 records which variables have been eliminated; 5520 the integer anzahlvariablen records how many true variables remain 5830 - the procedure checks for solutions which have certain 5831 components zero; these are separated from the rest by 5832 elimination and saturation; the integer deletedvariables 5833 records which variables have been eliminated; 5834 the integer anzahlvariablen records how many true variables remain 5521 5835 after the elimination 5522 - if the integer a is one then all zeros of the ideal i are 5523 considered and found, otherwise only one is considered, so that L 5836 - if the integer a is one then all zeros of the ideal i are 5837 considered and found, otherwise only one is considered, so that L 5524 5838 has length one" 5525 5839 { … … 5529 5843 // if all solutions have to be found 5530 5844 if (findall==1) 5531 { 5845 { 5532 5846 list saturatelist,eliminatelist; // carry the solution of the two tests 5533 // we test first if there is a solution which has the component 5534 // lastvar zero and 5847 // we test first if there is a solution which has the component 5848 // lastvar zero and 5535 5849 // where the order of each component is strictly positive; 5536 // if so, we add this variable to the ideal and 5850 // if so, we add this variable to the ideal and 5537 5851 // eliminate it - which amounts to 5538 // to projecting the solutions with this component 5852 // to projecting the solutions with this component 5539 5853 // zero to the hyperplane without this component; 5540 // for the test we compute the saturation with 5854 // for the test we compute the saturation with 5541 5855 // respect to t and replace each variable 5542 // x_i and also t by zero -- if the result is zero, 5543 // then 1 is not in I:t^infty 5856 // x_i and also t by zero -- if the result is zero, 5857 // then 1 is not in I:t^infty 5544 5858 // (i.e. there is a solution which has the component lastvar zero) and 5545 // the result lives in the maximal 5546 // ideal <t,x_1,...,[no x_lastvar],...,x_n> so that 5859 // the result lives in the maximal 5860 // ideal <t,x_1,...,[no x_lastvar],...,x_n> so that 5547 5861 // there is a solution which has strictly positive valuation 5548 5862 /* 5549 5863 // DER NACHFOLGENDE TEIL IST MUELL UND WIRD NICHT MEHR GAMACHT 5550 // for the test we simply compute the leading ideal 5864 // for the test we simply compute the leading ideal 5551 5865 // and set all true variables zero; 5552 // since the ordering was an elimination ordering 5866 // since the ordering was an elimination ordering 5553 5867 // with respect to (@a if present and) t 5554 // there remains something not equal to zero 5868 // there remains something not equal to zero 5555 5869 // if and only if there is polynomial which only 5556 // depends on t (and @a if present), but that is 5870 // depends on t (and @a if present), but that is 5557 5871 // a unit in K{{t}}, which would show that there 5558 5872 // is no solution with the component lastvar zero; 5559 // however, we also have to ensure that if there 5873 // however, we also have to ensure that if there 5560 5874 // exists a solution with the component lastvar 5561 // equal to zero then this component has a 5875 // equal to zero then this component has a 5562 5876 // valuation with all strictly positive values!!!!; 5563 // for this we can either saturate the ideal 5877 // for this we can either saturate the ideal 5564 5878 // after elimination with respect to <t,x_1,...,x_n> 5565 // and see if the saturated ideal is contained in <t,x_1,...x_n>+m, 5566 // or ALTERNATIVELY we can pass to the 5879 // and see if the saturated ideal is contained in <t,x_1,...x_n>+m, 5880 // or ALTERNATIVELY we can pass to the 5567 5881 // ring 0,(t,x_1,...,x_n,@a),(ds(n+1),dp(1)), 5568 // compute a standard basis of the elimination 5882 // compute a standard basis of the elimination 5569 5883 // ideal (plus m) there and check if the dimension 1 5570 // (since we have not omitted the variable lastvar, 5884 // (since we have not omitted the variable lastvar, 5571 5885 // this means that we have the ideal 5572 // generated by t,x_1,...,[no x_lastvar],...,x_n 5886 // generated by t,x_1,...,[no x_lastvar],...,x_n 5573 5887 // and this defines NO curve after omitting x_lastvar) 5574 5888 I=std(ideal(var(lastvar)+i)); … … 5576 5890 LI=lead(reduce(I,std(m))); 5577 5891 //size(deletedvariables)=anzahlvariablen(before elimination) 5578 for (j=1;j<=anzahlvariablen-1;j++) 5892 for (j=1;j<=anzahlvariablen-1;j++) 5579 5893 { 5580 5894 LI=subst(LI,var(j),0); … … 5582 5896 if (size(LI)==0) // if no power of t is in lead(I) (where @a is considered as a field element) 5583 5897 */ 5584 I=reduce(sat(ideal(var(lastvar)+i),t)[1],std(m)); // get rid of the minimal 5898 I=reduce(sat(ideal(var(lastvar)+i),t)[1],std(m)); // get rid of the minimal 5585 5899 // polynomial for the test 5586 5900 LI=subst(I,var(nvars(basering)),0); 5587 5901 //size(deletedvariables)=anzahlvariablen(before elimination) 5588 for (j=1;j<=anzahlvariablen-1;j++) 5902 for (j=1;j<=anzahlvariablen-1;j++) 5589 5903 { 5590 5904 LI=subst(LI,var(j),0); 5591 5905 } 5592 if (size(LI)==0) // the saturation lives in the maximal 5906 if (size(LI)==0) // the saturation lives in the maximal 5593 5907 { // ideal generated by t and the x_i 5594 5908 // get rid of var(lastvar) … … 5605 5919 { 5606 5920 string elring="ring ELIMINATERING=("+charstr(basering)+"),("+string(simplify(reduce(maxideal(1),std(var(lastvar))),2))+"),("; 5607 } 5608 if (anzahlvariablen<nvars(basering)) // if @a was present, the 5921 } 5922 if (anzahlvariablen<nvars(basering)) // if @a was present, the 5609 5923 { // ordersting needs an additional entry 5610 5924 elring=elring+"dp(1),"; 5611 5925 } 5612 5926 elring=elring+"lp(1));"; 5613 execute(elring); 5927 execute(elring); 5614 5928 ideal i=imap(BASERING,I); // move the ideal I to the new ring 5615 // if not yet all variables have been checked, 5929 // if not yet all variables have been checked, 5616 5930 // then go on with the next smaller variable, 5617 // else prepare the elimination ring and the neccessary 5931 // else prepare the elimination ring and the neccessary 5618 5932 // information for return 5619 5933 if (lastvar>1) … … 5628 5942 setring BASERING; 5629 5943 } 5630 // next we have to test if there is also a solution 5944 // next we have to test if there is also a solution 5631 5945 // which has the variable lastvar non-zero; 5632 // to do so, we saturate with respect to this variable; 5633 // since when considered over K{{t}} 5634 // the ideal is zero dimensional, this really removes 5946 // to do so, we saturate with respect to this variable; 5947 // since when considered over K{{t}} 5948 // the ideal is zero dimensional, this really removes 5635 5949 // all solutions with that component zero; 5636 5950 // the checking is then done as above 5637 5951 i=std(sat(i,var(lastvar))[1]); 5638 5952 I=reduce(i,std(m)); // "remove" m from i 5639 // test first, if i still is in the ideal <t,x_1,...,x_n> -- if not, then 5640 // we know that i has no longer a point in the tropical 5953 // test first, if i still is in the ideal <t,x_1,...,x_n> -- if not, then 5954 // we know that i has no longer a point in the tropical 5641 5955 // variety with all components negative 5642 5956 LI=subst(I,var(nvars(basering)),0); 5643 for (j=1;j<=anzahlvariablen-1;j++) // set all variables 5957 for (j=1;j<=anzahlvariablen-1;j++) // set all variables 5644 5958 { // t,x_1,...,x_n equal to zero 5645 5959 LI=subst(LI,var(j),0); 5646 5960 } 5647 5961 if (size(LI)==0) // the entries of i have not constant part 5648 { 5649 // check now, if the leading ideal of i contains an element 5962 { 5963 // check now, if the leading ideal of i contains an element 5650 5964 // which only depends on t 5651 5965 LI=lead(I); 5652 5966 //size(deletedvariables)=anzahlvariablen(before elimination) 5653 for (j=1;j<=anzahlvariablen-1;j++) 5967 for (j=1;j<=anzahlvariablen-1;j++) 5654 5968 { 5655 5969 LI=subst(LI,var(j),0); 5656 5970 } 5657 if (size(LI)==0) // if no power of t is in lead(i) 5971 if (size(LI)==0) // if no power of t is in lead(i) 5658 5972 { // (where @a is considered as a field element) 5659 // if not yet all variables have been tested, go on with the 5973 // if not yet all variables have been tested, go on with the 5660 5974 // next smaller variable 5661 5975 // else prepare the neccessary information for return … … 5665 5979 } 5666 5980 else 5667 { 5981 { 5668 5982 execute("ring SATURATERING=("+charstr(basering)+"),("+varstr(basering)+"),("+ordstr(basering)+");"); 5669 5983 ideal i=imap(BASERING,i); … … 5676 5990 return(eliminatelist+saturatelist); 5677 5991 } 5678 else // only one solution is searched for, we can do a simplified 5992 else // only one solution is searched for, we can do a simplified 5679 5993 { // version of the above 5680 // check if there is a solution which has the n-th component 5994 // check if there is a solution which has the n-th component 5681 5995 // zero and with positive valuation, 5682 // if so, then eliminate the n-th variable from 5996 // if so, then eliminate the n-th variable from 5683 5997 // sat(i+x_n,t), otherwise leave i as it is; 5684 // then check if the (remaining) ideal has as 5998 // then check if the (remaining) ideal has as 5685 5999 // solution where the n-1st component is zero ..., 5686 6000 // and procede as before; do the same for the remaining variables; 5687 // this way we make sure that the remaining ideal has 6001 // this way we make sure that the remaining ideal has 5688 6002 // a solution which has no component zero; 5689 6003 ideal variablen; // will contain the variables which are not eliminated … … 5693 6007 LI=subst(I,var(nvars(basering)),0); 5694 6008 //size(deletedvariables)=anzahlvariablen-1(before elimination) 5695 for (k=1;k<=size(deletedvariables);k++) 6009 for (k=1;k<=size(deletedvariables);k++) 5696 6010 { 5697 6011 LI=subst(LI,var(k),0); 5698 6012 } 5699 if (size(LI)==0) // if no power of t is in lead(I) 6013 if (size(LI)==0) // if no power of t is in lead(I) 5700 6014 { // (where the X(i) are considered as field elements) 5701 // get rid of var(j) 6015 // get rid of var(j) 5702 6016 i=eliminate(I,var(j)); 5703 6017 deletedvariables[j]=1; 5704 anzahlvariablen--; // if a variable is eliminated, 6018 anzahlvariablen--; // if a variable is eliminated, 5705 6019 // then the number of true variables drops 5706 6020 } … … 5711 6025 } 5712 6026 variablen=invertorder(variablen); 5713 // store also the additional variable and t, 6027 // store also the additional variable and t, 5714 6028 // since they for sure have not been eliminated 5715 6029 for (j=size(deletedvariables)+1;j<=nvars(basering);j++) … … 5717 6031 variablen=variablen+var(j); 5718 6032 } 5719 // if there are variables left, then pass to a ring which 5720 // only realises these variables else we are done 6033 // if there are variables left, then pass to a ring which 6034 // only realises these variables else we are done 5721 6035 if (anzahlvariablen>1) 5722 6036 { … … 5726 6040 { 5727 6041 string elring="ring ELIMINATERING=("+charstr(basering)+"),("+string(variablen)+"),("; 5728 } 5729 if (size(deletedvariables)+1<nvars(basering)) // if @a was present, 6042 } 6043 if (size(deletedvariables)+1<nvars(basering)) // if @a was present, 5730 6044 { // the ordersting needs an additional entry 5731 6045 elring=elring+"dp(1),"; 5732 6046 } 5733 6047 elring=elring+"lp(1));"; 5734 execute(elring); 6048 execute(elring); 5735 6049 ideal i=imap(BASERING,i); 5736 6050 ideal m=imap(BASERING,m); … … 5745 6059 static proc findzerosAndBasictransform (ideal i,intvec w,list zerolist,int findall,list #) 5746 6060 "USAGE: findzerosAndBasictransform(i,w,z,f[,#]); i ideal, w intvec, z list, f int,# an optional list 5747 ASSUME: i is an ideal in Q[t,x_1,...,x_n,@a] and w=(w_0,...,w_n,0) 6061 ASSUME: i is an ideal in Q[t,x_1,...,x_n,@a] and w=(w_0,...,w_n,0) 5748 6062 is in the tropical variety of i; @a need not be present; 5749 6063 the list 'zero' contains the zeros computed in previous recursion steps; 5750 if 'f' is one then all zeros should be found and returned, 6064 if 'f' is one then all zeros should be found and returned, 5751 6065 otherwise only one 5752 RETURN: list, each entry is a ring corresponding to one conjugacy class of 5753 zeros of the t-initial ideal inside the torus; each of the rings 6066 RETURN: list, each entry is a ring corresponding to one conjugacy class of 6067 zeros of the t-initial ideal inside the torus; each of the rings 5754 6068 contains the following objects 5755 6069 ideal i = the ideal i, where the variable @a (if present) has 5756 possibly been transformed according to the new 5757 minimal polynomial, and where itself has been 5758 submitted to the basic transform of the algorithm 6070 possibly been transformed according to the new 6071 minimal polynomial, and where itself has been 6072 submitted to the basic transform of the algorithm 5759 6073 given by the jth zero found for the t-initial ideal; 5760 note that the new minimal polynomial has already 6074 note that the new minimal polynomial has already 5761 6075 been added 5762 poly m = the new minimal polynomial for @a 6076 poly m = the new minimal polynomial for @a 5763 6077 (it is zero if no @a is present) 5764 list zero = zero[k+1] is the kth component of a zero 6078 list zero = zero[k+1] is the kth component of a zero 5765 6079 the t-initial ideal of i 5766 NOTE: - the procedure is called from inside the recursive procedure 6080 NOTE: - the procedure is called from inside the recursive procedure 5767 6081 tropicalparametrise; 5768 if it is called in the first recursion, the list #[1] contains 5769 the t-initial ideal of i w.r.t. w, otherwise #[1] is an integer, 6082 if it is called in the first recursion, the list #[1] contains 6083 the t-initial ideal of i w.r.t. w, otherwise #[1] is an integer, 5770 6084 one more than the number of true variables x_1,...,x_n 5771 - if #[2] is present, then it is an integer which tells whether 6085 - if #[2] is present, then it is an integer which tells whether 5772 6086 ALL zeros should be found or not" 5773 6087 { … … 5787 6101 int anzahlvariablen=#[1]; 5788 6102 // compute the initial ideal of i 5789 // - the last 1 just means that the variable t is the last 6103 // - the last 1 just means that the variable t is the last 5790 6104 // variable in the ring 5791 6105 ideal ini=tInitialIdeal(i,w,1); … … 5795 6109 int recursive=0; 5796 6110 int anzahlvariablen=nvars(basering); 5797 ideal ini=#[1]; // the t-initial ideal has been computed 6111 ideal ini=#[1]; // the t-initial ideal has been computed 5798 6112 // in before and was handed over 5799 } 6113 } 5800 6114 // collect the true variables x_1,...,x_n plus @a, if it is defined in BASERING 5801 6115 ideal variablen; 5802 6116 for (j=1;j<=nvars(basering)-1;j++) 5803 { 6117 { 5804 6118 variablen=variablen+var(j); 5805 6119 } 5806 // move to a polynomial ring with global monomial ordering 6120 // move to a polynomial ring with global monomial ordering 5807 6121 // - the variable t is superflous, 5808 6122 // the variable @a is not if it was already present 5809 6123 execute("ring INITIALRING=("+charstr(basering)+"),("+string(variablen)+"),dp;"); 5810 6124 ideal ini=imap(BASERING,ini); 5811 // compute the minimal associated primes of the 6125 // compute the minimal associated primes of the 5812 6126 // initialideal over the algebraic closure; 5813 // ordering the maximal ideals shall help to 6127 // ordering the maximal ideals shall help to 5814 6128 // avoid unneccessary field extensions 5815 6129 list absminass=absPrimdecGTZ(ini); 5816 def ABSRING=absminass[1]; // the ring in which the minimal 6130 def ABSRING=absminass[1]; // the ring in which the minimal 5817 6131 // associated primes live 5818 6132 setring ABSRING; … … 5825 6139 for (j=1;j<=size(maximalideals);j++) 5826 6140 { 5827 // check fortthe jth maximal ideal a field extension is necessary;6141 // check if for the jth maximal ideal a field extension is necessary; 5828 6142 // the latter condition says that @a is not in BASERING; 5829 // if some of the maximal ideals needs a field extension, 6143 // if some of the maximal ideals needs a field extension, 5830 6144 // then everything will live in this ring 5831 6145 if ((maximalideals[j][1]!=0) and (nvars(BASERING)==anzahlvariablen)) 5832 6146 { 5833 // define the extension ring which contains 6147 // define the extension ring which contains 5834 6148 // the new variable @a, if it is not yet present 5835 6149 execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+string(imap(BASERING,variablen))+",@a,"+tvar+"),(dp("+string(anzahlvariablen-1)+"),dp(1),lp(1));"); 5836 // phi maps x_i to x_i, @a to @a (if present in the ring), 6150 // phi maps x_i to x_i, @a to @a (if present in the ring), 5837 6151 // and the additional variable 5838 // for the field extension is mapped to @a as well 6152 // for the field extension is mapped to @a as well 5839 6153 // -- note that we only apply phi 5840 // to the list a, and in this list no @a is present; 6154 // to the list a, and in this list no @a is present; 5841 6155 // therefore, it does not matter where this is mapped to 5842 6156 map phi=ABSRING,imap(BASERING,variablen),@a; 5843 6157 } 5844 else // @a was already present in the BASERING or no 6158 else // @a was already present in the BASERING or no 5845 6159 { // field extension is necessary 5846 6160 execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+varstr(BASERING)+"),("+ordstr(BASERING)+");"); 5847 // phi maps x_i to x_i, @a to @a (if present in the ring), 6161 // phi maps x_i to x_i, @a to @a (if present in the ring), 5848 6162 // and the additional variable 5849 // for the field extension is mapped to @a as well respectively to 0, 6163 // for the field extension is mapped to @a as well respectively to 0, 5850 6164 // if no @a is present; 5851 // note that we only apply phi to the list a and to 6165 // note that we only apply phi to the list a and to 5852 6166 // the replacement rule for 5853 // the old variable @a, and in this list resp. 5854 // replacement rule no @a is present; 6167 // the old variable @a, and in this list resp. 6168 // replacement rule no @a is present; 5855 6169 // therefore, it does not matter where this is mapped to; 5856 6170 if (anzahlvariablen<nvars(EXTENSIONRING)) // @a is in EXTENSIONRING 5857