Changeset d8217b in git
 Timestamp:
 Oct 15, 2008, 10:53:18 AM (15 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
 Children:
 28f88cb738f9da7f460746ac9e08014e14065286
 Parents:
 5c9d99573bf1433cfce050d20faf365415f0e341
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/tropical.lib
r5c9d99 rd8217b 1 version="$Id: tropical.lib,v 1. 8 20081009 09:31:58 SingularExp $";1 version="$Id: tropical.lib,v 1.9 20081015 08:53:18 keilen Exp $"; 2 2 category="Tropical Geometry"; 3 3 info=" … … 8 8 @* Thomas Markwig, email: keilen@mathematik.unikl.de 9 9 10 WARNING: 10 WARNING: 11 11  tropicalLifting will only work under LINUX and if in addition gfan is installed. 12 12 @*  drawTropicalCurve and drawTropicalNewtonSubdivision will only display the tropical … … 20 20 the torus is embedded via the map sending a point x in (K*)^n to the point (x^v0,...,x^vm). 21 21 The generic hyperplane sections are just the images of the hypersurfaces in (K*)^n defined by 22 the polynomials f=a0*x^v0+...+am*x^vm=0. Some properties of these hypersurfaces can be studied 23 via tropicalisation. 24 25 For this we suppose that K=C{{t}} is the field of Puiseux series over the field of complex 22 the polynomials f=a0*x^v0+...+am*x^vm=0. Some properties of these hypersurfaces can be studied 23 via tropicalisation. 24 25 For this we suppose that K=C{{t}} is the field of Puiseux series over the field of complex 26 26 numbers (or any other field with a valuation into the real numbers). One associates to the 27 27 hypersurface given by f=a0*x^v0+...+am*x^vm the tropical hypersurface defined by the tropicalisation … … 29 29 of the integer vector v in Z^n with the vector x=(x1,...,xn) of variables, so that trop(f) is 30 30 a piecewise linear function on R^n. The corner locus of this function (i.e. the points at which 31 the minimum is attained a least twice) is the tropical hypersurface defined by trop(f). 31 the minimum is attained a least twice) is the tropical hypersurface defined by trop(f). 32 32 The theorem of NewtonKapranov states that this tropical hypersurface is the same as if one 33 33 computes pointwise the valuation of the hypersurface given by f. The analogue holds true if one 34 replaces one equation f by an ideal I. A constructive proof of the theorem is given by an adapted 34 replaces one equation f by an ideal I. A constructive proof of the theorem is given by an adapted 35 35 version of the NewtonPuiseux algorithm. The hard part is to find a point in the variety over 36 36 C{{t}} which corresponds to a given point in the tropical variety. … … 39 39 Of course we cannot represent the field of Puiseux series over C in its full strength, however, 40 40 in order to compute interesting examples it will be sufficient to replace the complex numbers C 41 by the rational numbers Q and to replace Puiseux series in t by rational functions in t, 42 i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. Note, that this in particular 41 by the rational numbers Q and to replace Puiseux series in t by rational functions in t, 42 i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. Note, that this in particular 43 43 forbits rational exponents for the t's. 44 44 … … 48 48 If, however, for some reason you prefer to work with general vi, then you have to pass right away to 49 49 the tropicalisation of the equations, whereever this is allowed  these are linear polynomials 50 where the constant coefficient correspond to the valuation of the original coefficient and where 50 where the constant coefficient correspond to the valuation of the original coefficient and where 51 51 the nonconstant coefficient correspond to the exponents of the monomials, thus they may be rational 52 numbers respectively negative numbers: 52 numbers respectively negative numbers: 53 53 e.g. if f=t^{1/2}*x^{2}*y^3+2t*x*y+4 then trop(f)=min{1/22x+3y,1+x+y,0}. 54 54 … … 59 59 I have to be in the polynomial ring Q[t,x1,...,xn] considered as a subring of 60 60 C{{t}}[x1,...,xn]; a solution will be constructed up to given order; note that 61 several field extensions of Q might be necessary thoughout the intermediate 61 several field extensions of Q might be necessary thoughout the intermediate 62 62 computations; the procedures uses the external program gfan 63 63 @*  drawTropicalCurve visualises a tropical plane curve either given by a polynomial in Q(t)[x,y] … … 66 66 @*  tropicalJInvariant computes the tropical jinvaiant of a tropical elliptic curve 67 67 @*  jInvariant computes the jinvariant of an elliptic curve 68 @*  weierstrassFom computes the Weierstrass form of an elliptic curve 68 @*  weierstrassFom computes the Weierstrass form of an elliptic curve 69 69 70 70 PROCEDURES CONCERNED WITH TROPICAL LIFTING: … … 93 93 PROCEDURES CONCERNED WITH THE LATEX CONVERSION: 94 94 texNumber(poly) outputs the texcommand for the leading coefficient of poly 95 texPolynomial(poly) outputs the texcommand for the polynomial poly 95 texPolynomial(poly) outputs the texcommand for the polynomial poly 96 96 texMatrix(matrix) outputs the texcommand for the matrix 97 97 texDrawBasic(list) embeds the output of texDrawTropical in a texdraw environment 98 98 texDrawTropical(list) computes the texdraw commands for a tropical curve 99 texDrawNewtonSubdivision(list) computes the texdraw commands for a Newton subdivision 100 texDrawTriangulation(list,list) computes the texdraw commands for a triangulation 99 texDrawNewtonSubdivision(list) computes the texdraw commands for a Newton subdivision 100 texDrawTriangulation(list,list) computes the texdraw commands for a triangulation 101 101 102 102 AUXILARY PROCEDURES: … … 108 108 dualConic(poly) computes the dual of the affine plane conic defined by poly 109 109 parameterSubstitute(poly,int) substitutes in the poly the parameter t by t^N 110 tropcialSubst(poly,int,list) computes the tropical polynomial of poly with certain substitutions 110 tropcialSubst(poly,int,list) computes the tropical polynomial of poly with certain substitutions 111 111 randomPoly(int,int,int) computes a polynomial with random coefficients 112 112 cleanTmp() removes the latex and ps files from /tmp created by other procedures … … 137 137 ///  eliminatecomponents 138 138 ///  findzerosAndBasictransform 139 ///  ordermaximalideals 139 ///  ordermaximalideals 140 140 ///  verticesTropicalCurve 141 141 ///  bunchOfLines … … 186 186 187 187 //////////////////////////////////////////////////////////////////////////////////// 188 /// Procedures concerned with tropical parametrisation 189 /////////////////////////////////////////////////////////////////////////////////// 188 /// Procedures concerned with tropical parametrisation 189 /////////////////////////////////////////////////////////////////////////////////// 190 190 191 191 proc tropicalLifting (ideal i,intvec w,int ordnung,list #) 192 192 "USAGE: tropicalLifting(i,w,ord[,opt]); i ideal, w intvec, ord int, opt string 193 ASSUME:  i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) 194 and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, 195 and ord is the order up to which a point in V(i) over Q{{t}} lying over 193 ASSUME:  i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) 194 and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, 195 and ord is the order up to which a point in V(i) over Q{{t}} lying over 196 196 (w_1/w_0,...,w_n/w_0) shall be computed; w_0 may NOT be ZERO 197 @*  the basering should not have any parameters on its own 197 @*  the basering should not have any parameters on its own 198 198 and it should have a global monomial ordering, e.g. ring r=0,(t,x(1..n)),dp; 199 @*  the first variable of the basering will be treated as the parameter t 199 @*  the first variable of the basering will be treated as the parameter t 200 200 in the Puiseux series field !!!! 201 201 @*  the optional parameter opt should be one or more strings among the following: … … 203 203 @* 'isPrime' : the ideal is prime over Q(t)[x_1,...,x_n] (not to be checked); 204 204 @* 'isInTrop' : (w_1/w_0,...,w_n/w_0) is in the tropical variety (not to be checked); 205 @* 'oldGfan' : uses gfan version 0.2.1 or less 205 @* 'oldGfan' : uses gfan version 0.2.1 or less 206 206 @* 'findAll' : find all solutions of a zerodimensional ideal over (w_1/w_0,...,w_n/w_0) 207 207 @* 'noAbs' : do NOT use absolute primary decomposition … … 226 226 in the tropical variety of i to a point in V(i) over Puiseux series field up to 227 227 the first ord terms, if the ideal is zerodimensional over Q{{t}}; 228 more precisely, each entry of the list is a list l as computed if 228 more precisely, each entry of the list is a list l as computed if 229 229 'find_all' was NOT set 230 230 @* WE NOW DESCRIBE THE LIST ENTRIES IF 'findAll' WAS NOT SET: 231 @*  the ring l[1] contains an ideal LIFT, which contains 231 @*  the ring l[1] contains an ideal LIFT, which contains 232 232 a point in V(i) lying over w up to the first ord terms; 233 233 @*  and if the integer l[2] is N then t has to be replaced by t^1/N in the … … 235 235 @*  if the k+1st entry of l[3] is nonzero, then the kth component of LIFT has to 236 236 be multiplied t^(l[3][k]/l[3][1]) AFTER substituting t by t^1/N 237 @*  unless the option 'noResubst' was set, the kth entry of list l[4] 237 @*  unless the option 'noResubst' was set, the kth entry of list l[4] 238 238 is a string which represents the kth generator of 239 239 the ideal i where the coordinates have been replaced by the result of the lift; … … 246 246 @*  if the parameter 'findAll' is set AND the ideal i is zerodimensional in Q{{t}}[x_1,...,x_n] 247 247 then ALL points in V(i) lying over w are computed up to order ord; if the ideal 248 is notzero dimenisonal, then only all points in the ideal after cutting down 248 is notzero dimenisonal, then only all points in the ideal after cutting down 249 249 to dimension zero will be computed 250 250 @*  the procedure REQUIRES that the program GFAN is installed on your computer; … … 263 263 and thus there may not exist a point in V(i) over the Puiseux series field 264 264 with the desired valuation; so there is no chance that the procedure produced 265 a sensible output  e.g. if i=tx^ptx1 266 @* + if the dimension of i over Z/pZ(t) is not zero the process of reduction to 265 a sensible output  e.g. if i=tx^ptx1 266 @* + if the dimension of i over Z/pZ(t) is not zero the process of reduction to 267 267 zero might not work if the characteristic is small and you are unlucky 268 @* + the option 'noAbs' has to be used since absolute primary decomposition in 268 @* + the option 'noAbs' has to be used since absolute primary decomposition in 269 269 Singular only works in characteristic zero 270 @*  the basefield should either be Q or Z/pZ for some prime p; field extensions 270 @*  the basefield should either be Q or Z/pZ for some prime p; field extensions 271 271 will be computed where necessary; if you need parameters or field extensions 272 272 from the beginning they should rather be simulated as variables possibly adding … … 346 346 { 347 347 Error("The first coordinate of your input w must be NONZERO, since it is a DENOMINATOR!"); 348 } 348 } 349 349 // if w_0<0, then replace w by w, so that the "denominator" w_0 is positive 350 350 if (w[1]<0) … … 362 362 w[1]=1; 363 363 } 364 // if some entry of w is positive, we have to make a transformation, 364 // if some entry of w is positive, we have to make a transformation, 365 365 // which moves it to something nonpositive 366 366 for (j=2;j<=nvars(basering);j++) … … 387 387 { 388 388 variablen=variablen+var(j); 389 } 389 } 390 390 map GRUNDPHI=BASERING,t,variablen; 391 391 ideal i=GRUNDPHI(i); 392 // compute the initial ideal of i and test if w is in the tropical variety of i 392 // compute the initial ideal of i and test if w is in the tropical variety of i 393 393 //  the last entry 1 only means that t is the last variable in the ring 394 394 ideal ini=tInitialIdeal(i,w,1); 395 395 if (isintrop==0) // test if w is in trop(i) only if isInTrop has not been set 396 { 396 { 397 397 poly product=1; 398 398 for (j=1;j<=nvars(basering)1;j++) … … 418 418 // the procedurce cutdown computes a new ring, in which there lives a zerodimensional 419 419 // ideal which has been computed by cutting down the input with generic linear forms 420 // of the type x_i1p_1,...,x_idp_d for some polynomials p_1,...,p_d not depending 420 // of the type x_i1p_1,...,x_idp_d for some polynomials p_1,...,p_d not depending 421 421 // on the variables x_i1,...,x_id; that way we have reduced the number of variables by dd !!! 422 422 // the new zerodimensional ideal is called i, its tinitial ideal (with respect to 423 // the new w=CUTDOWN[2]) is ini, and finally there is a list repl in the ring 423 // the new w=CUTDOWN[2]) is ini, and finally there is a list repl in the ring 424 424 // which contains at the polynomial p_j at position i_j and a zero otherwise; 425 425 if (isprime==0) // the minimal associated primes of i are computed … … 461 461 for (jj=1;jj<=size(TP);jj++) 462 462 { 463 // the list TP contains as a first entry the ring over which the tropical parametrisation 463 // the list TP contains as a first entry the ring over which the tropical parametrisation 464 464 // of the (possibly cutdown ideal) i lives 465 465 def LIFTRING=TP[jj][1]; … … 493 493 } 494 494 setring LIFTRING; 495 ideal LIFT=imap(REPLACEMENTRING,LIFT); 496 // test now if the LIFT has the correct valuation !!! 495 ideal LIFT=imap(REPLACEMENTRING,LIFT); 496 // test now if the LIFT has the correct valuation !!! 497 497 // note: it may happen, that when resubstituting PARA into the replacement rules 498 498 // there occured some unexpected cancellation; we only know that for SOME 499 // solution of the zerodimensional reduction NO canellation will occur, 499 // solution of the zerodimensional reduction NO canellation will occur, 500 500 // but for others this may very well happen; this in particular means that 501 501 // we possibly MUST compute all zerodimensional solutions when cutting down! … … 548 548 // replace @a by a in minpoly and in LIFT 549 549 map phi=INTERRING,t,a,a; 550 mp=phi(mp); 550 mp=phi(mp); 551 551 LIFT=phi(LIFT); 552 552 // pass now to a ring whithout @a and with a as parameter … … 555 555 ideal LIFT=imap(INTERRING,LIFT); 556 556 kill INTERRING; 557 } 557 } 558 558 // then export LIFT 559 export(LIFT); 559 export(LIFT); 560 560 // test the result by resubstitution 561 setring GRUNDRING; 561 setring GRUNDRING; 562 562 list resubst; 563 563 if (noresubst==0) … … 568 568 } 569 569 else 570 { 570 { 571 571 resubst=tropicalliftingresubstitute(substitute(i,t,t^(TP[jj][2])),list(LIFTRING),N*TP[jj][2]); 572 572 } 573 573 } 574 574 setring BASERING; 575 // Finally, if t has been replaced by t^N, then we have to change the 575 // Finally, if t has been replaced by t^N, then we have to change the 576 576 // third entry of TP by multiplying by N. 577 577 if (noabs==1) … … 598 598 "The procedure will be restarted with the option 'findAll'."; 599 599 "Go on by hitting RETURN!"; 600 findall=1; 600 findall=1; 601 601 noabs=0; 602 602 setring CUTDOWNRING; … … 604 604 "i";i; 605 605 "ini";tInitialIdeal(i,w,1); 606 606 607 607 /* 608 608 setring GRUNDRING; … … 630 630 if (voice+printlevel>=2) 631 631 { 632 632 633 633 "The procedure has created a list of lists. The jth entry of this list 634 634 contains a ring, an integer and an intvec. 635 635 In this ring lives an ideal representing the wanted lifting, 636 636 if the integer is N then in the parametrisation t has to be replaced by t^1/N, 637 and if the ith component of the intvec is w[i] then the ith component in LIFT 637 and if the ith component of the intvec is w[i] then the ith component in LIFT 638 638 should be multiplied by t^w[i]/N in order to get the parametrisation. 639 639 640 640 Suppose your list has the name L, then you can access the 1st ring via: 641 641 "; 642 642 if (findall==1) 643 643 { 644 "def LIFTRing=L[1][1]; setring LIFTRing; LIFT; 644 "def LIFTRing=L[1][1]; setring LIFTRing; LIFT; 645 645 "; 646 646 } 647 647 else 648 648 { 649 "def LIFTRing=L[1]; setring LIFTRing; LIFT; 649 "def LIFTRing=L[1]; setring LIFTRing; LIFT; 650 650 "; 651 } 651 } 652 652 } 653 653 if (findall==1) // if all solutions have been computed, return a list of lists … … 674 674 def LIFTRing=LIST[1]; 675 675 setring LIFTRing; 676 // LIFT contains the first 4 terms of a point in the variety of i 676 // LIFT contains the first 4 terms of a point in the variety of i 677 677 // over the Puiseux series field C{{t}} whose order is w[1]/w[0]=1 678 678 LIFT; … … 702 702 // NOTE: since the last component of v is positive, the lifting 703 703 // must start with a negative power of t, which in Singular 704 // is not allowed for a variable. 704 // is not allowed for a variable. 705 705 def LIFTRing3=LIST[1]; 706 706 setring LIFTRing3; … … 756 756 } 757 757 if (size(troplift)==4) // this means that tropicalLifting was called with absolute primary decomposition 758 { 758 { 759 759 setring LIFTRing; 760 760 "The lifting of the point in the tropical variety lives in the ring"; 761 761 if ((size(LIFTpar)==0) and (N==1)) 762 762 { 763 Kstring+"[[t]]"; 763 Kstring+"[[t]]"; 764 764 } 765 765 if ((size(LIFTpar)==0) and (N!=1)) 766 766 { 767 Kstring+"[[t^(1/"+string(N)+")]]"; 767 Kstring+"[[t^(1/"+string(N)+")]]"; 768 768 } 769 769 if ((size(LIFTpar)!=0) and (N!=1)) 770 { 771 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]"; 770 { 771 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]"; 772 772 } 773 773 if ((size(LIFTpar)!=0) and (N==1)) 774 { 775 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]"; 774 { 775 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]"; 776 776 } 777 777 } … … 790 790 } 791 791 if ((size(LIFTpar)!=0) and (N!=1)) 792 { 793 Kstring+"["+LIFTpar+"]/M[[t^(1/"+string(N)+")]]"; 792 { 793 Kstring+"["+LIFTpar+"]/M[[t^(1/"+string(N)+")]]"; 794 794 "where M is the maximal ideal"; 795 795 "M=<"+m+">"; 796 796 } 797 797 if ((size(LIFTpar)!=0) and (N==1)) 798 { 799 Kstring+"["+LIFTpar+"]/M[[t]]"; 798 { 799 Kstring+"["+LIFTpar+"]/M[[t]]"; 800 800 "where M is the maximal ideal"; 801 801 "M=<"+m+">"; 802 } 802 } 803 803 } 804 804 ""; … … 827 827 } 828 828 } 829 } 829 } 830 830 } 831 831 example … … 841 841 842 842 //////////////////////////////////////////////////////////////////////////////////// 843 /// Procedures concerned with drawing a tropical curve or a Newton subdivision 843 /// Procedures concerned with drawing a tropical curve or a Newton subdivision 844 844 //////////////////////////////////////////////////////////////////////////////////// 845 845 proc tropicalCurve (def tp,list #) 846 846 "USAGE: tropicalCurve(tp[,#]); tp list, # optional list 847 ASSUME: tp is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 847 ASSUME: tp is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 848 848 representing a tropical Laurent polynomial defining a tropical plane curve; 849 849 alternatively tp can be a polynomial in Q(t)[x,y] defining a tropical plane curve 850 via the valuation map; 850 via the valuation map; 851 851 the basering must have a global monomial ordering, two variables and up to one parameter! 852 RETURN: list, each entry i=1,...,size(l)1 corresponds to a vertex in the tropical plane 852 RETURN: list, each entry i=1,...,size(l)1 corresponds to a vertex in the tropical plane 853 853 curve defined by tp 854 854 l[i][1] = xcoordinate of the ith vertex … … 857 857 the tropical curve is connected to the jth vertex with multiplicity given 858 858 by the corresponding entry in the second row 859 l[i][4] = list of lists, the first entry of a list is a primitive integer vector 860 defining the direction of an unbounded edge emerging from the ith vertex 859 l[i][4] = list of lists, the first entry of a list is a primitive integer vector 860 defining the direction of an unbounded edge emerging from the ith vertex 861 861 of the graph, the corresponding second entry in the list is the multiplicity 862 862 of the unbounded edge 863 863 l[i][5] = a polynomial whose monomials mark the vertices in the Newton polygon 864 corresponding to the entries in tp which take the common minimum 864 corresponding to the entries in tp which take the common minimum 865 865 at the ith vertex  if some coefficient a or b of the linear polynomials 866 866 in the input was negative, then each monomial has to be shifted by … … 885 885 } 886 886 // if you insert a single polynomial instead of an ideal representing a tropicalised polynomial, 887 // then we compute first the tropicalisation of this polynomial  this feature is not 887 // then we compute first the tropicalisation of this polynomial  this feature is not 888 888 // documented in the above help string 889 889 if (typeof(tp)=="poly") … … 892 892 if ((npars(basering)!=1) or (nvars(basering)!=2)) 893 893 { 894 ERROR("The basering should have precisely one parameter and two indeterminates!"); 894 ERROR("The basering should have precisely one parameter and two indeterminates!"); 895 895 } 896 896 poly f=tp; … … 901 901 if (nvars(basering) != 2) 902 902 { 903 ERROR("The basering should have precisely two indeterminates!"); 903 ERROR("The basering should have precisely two indeterminates!"); 904 904 } 905 905 // 1) Exclude the pathological case that the defining tropical polynomial has only one term, … … 910 910 intmat M[2][1]=0,0; 911 911 return(list(list(0,0,M,list(),detropicalise(tp[1])),list(list(leadexp(detropicalise(tp[1]))),list()))); 912 } 912 } 913 913 // 0) If the input was a list of linear polynomials, then some coefficient of x or y can be negative, 914 914 // i.e. the input corresponds to the tropical curve of a Laurent polynomial. In that case we should … … 925 925 { 926 926 bb=koeffizienten(tp[i],2); 927 } 927 } 928 928 } 929 929 if ((aa!=0) or (bb!=0)) … … 942 942 return(bunchOfLines(tp)); 943 943 } 944 // 2) store all vertices belonging to the ith part of the 944 // 2) store all vertices belonging to the ith part of the 945 945 // Newton subdivision in the list vtp[i] as 4th entry, 946 946 // and store those, which are not corners of the ith subdivision polygon 947 947 // in vtp[i][6] 948 poly nwt; 948 poly nwt; 949 949 list boundaryNSD; // stores the boundary of a Newton subdivision 950 intmat zwsp[2][1]; // used for intermediate storage 950 intmat zwsp[2][1]; // used for intermediate storage 951 951 for (i=1;i<=size(vtp);i++) 952 952 { … … 954 954 nwt=vtp[i][3]; // the polynomial representing the ith part of the Newton subdivision 955 955 // store the vertices of the ith part of the Newton subdivision in the list newton 956 list newton; 956 list newton; 957 957 while (nwt!=0) 958 958 { … … 964 964 vtp[i][4]=boundaryNSD[1]; 965 965 vtp[i][5]=boundaryNSD[2]; 966 vtp[i][6]=zwsp; // the entries of the first row will denote to which vertex the ith one is connected 966 vtp[i][6]=zwsp; // the entries of the first row will denote to which vertex the ith one is connected 967 967 // and the entries of the second row will denote with which multiplicity 968 968 kill newton; // we kill the superflous list … … 984 984 kill ipairs; 985 985 } 986 // 4) Check for all pairs of verticies in the Newton diagram if they 986 // 4) Check for all pairs of verticies in the Newton diagram if they 987 987 // occur in two different parts of the Newton subdivision 988 988 int deleted; // if a pair occurs in two NSD, it can be removed from both  deleted is then set to 1 … … 991 991 d=1; // counts the inner edges 992 992 for (i=1;i<=size(pairs)1;i++) 993 { 993 { 994 994 for (j=i+1;j<=size(pairs);j++) 995 995 { … … 998 998 deleted=0; 999 999 for (l=size(pairs[j]);l>=1 and deleted==0;l) 1000 { 1000 { 1001 1001 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]))) 1002 1002 { … … 1062 1062 for (i=1;i<=size(pairs);i++) 1063 1063 { 1064 list ubedges; // stores the unbounded edges 1064 list ubedges; // stores the unbounded edges 1065 1065 k=1; // counts the unbounded edges 1066 1066 for (j=1;j<=size(pairs[i]);j++) … … 1114 1114 gr[3]=vtp[i][6]; // to which vertices is the ith vertex of the tropical curve connected 1115 1115 gr[4]=vtp[i][7]; // the directions unbounded edges emerging from the ith vertex of the trop. curve 1116 gr[5]=vtp[i][3]; // the vertices of the boundary of the ith part of the NSD 1116 gr[5]=vtp[i][3]; // the vertices of the boundary of the ith part of the NSD 1117 1117 graph[i]=gr; 1118 1118 } … … 1149 1149 // the coordinates of the first vertex are graph[1][1],graph[1][2]; 1150 1150 graph[1][1],graph[1][2]; 1151 // the first vertex is connected to the vertices 1151 // the first vertex is connected to the vertices 1152 1152 // graph[1][3][1,1..ncols(graph[1][3])] 1153 1153 intmat M=graph[1][3]; 1154 1154 M[1,1..ncols(graph[1][3])]; 1155 // the weights of the edges to these vertices are 1155 // the weights of the edges to these vertices are 1156 1156 // graph[1][3][2,1..ncols(graph[1][3])] 1157 1157 M[2,1..ncols(graph[1][3])]; 1158 1158 // from the first vertex emerge size(graph[1][4]) unbounded edges 1159 1159 size(graph[1][4]); 1160 // the primitive integral direction vector of the first unbounded edge 1160 // the primitive integral direction vector of the first unbounded edge 1161 1161 // of the first vertex 1162 1162 graph[1][4][1][1]; 1163 1163 // the weight of the first unbounded edge of the first vertex 1164 1164 graph[1][4][1][2]; 1165 // the monomials which are part of the Newton subdivision of the first vertex 1165 // the monomials which are part of the Newton subdivision of the first vertex 1166 1166 graph[1][5]; 1167 // connecting the points in graph[size(graph)][1] we get 1167 // connecting the points in graph[size(graph)][1] we get 1168 1168 // the boundary of the Newton polytope 1169 1169 graph[size(graph)][1]; 1170 // an entry in graph[size(graph)][2] is a pair of points 1170 // an entry in graph[size(graph)][2] is a pair of points 1171 1171 // in the Newton polytope bounding an inner edge 1172 1172 graph[size(graph)][2][1]; … … 1175 1175 proc drawTropicalCurve (def f,list #) 1176 1176 "USAGE: drawTropicalCurve(f[,#]); f poly or list, # optional list 1177 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1177 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1178 1178 representing a tropical Laurent polynomial defining a tropical plane curve; 1179 1179 alternatively f can be a polynomial in Q(t)[x,y] defining a tropical plane curve 1180 via the valuation map; 1180 via the valuation map; 1181 1181 the basering must have a global monomial ordering, two variables and up to one parameter! 1182 1182 RETURN: NONE 1183 NOTE:  the procedure produces the files /tmp/tropicalcurveNUMBER.tex and 1184 /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four digit integer; 1183 NOTE:  the procedure produces the files /tmp/tropicalcurveNUMBER.tex and 1184 /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four digit integer; 1185 1185 moreover it displays the tropical curve defined by f via kghostview; 1186 1186 if you wish to remove all these files from /tmp, call the procedure cleanTmp 1187 1187 @*  edges with multiplicity greater than one carry this multiplicity 1188 1188 @*  if # is empty, then the tropical curve is computed w.r.t. minimum, if #[1] is the 1189 string 'max', then it is computed w.r.t. maximum 1189 string 'max', then it is computed w.r.t. maximum 1190 1190 @*  if the last optional argument is 'onlytexfile' then only the latex file 1191 1191 is produced; this option should be used if kghostview is not installed on … … 1212 1212 if ((npars(basering)!=1) or (nvars(basering)!=2)) 1213 1213 { 1214 ERROR("The basering should have precisely one parameter and two indeterminates!"); 1214 ERROR("The basering should have precisely one parameter and two indeterminates!"); 1215 1215 } 1216 1216 texf=texPolynomial(f); // write the polynomial over Q(t) … … 1223 1223 texf="\\mbox{\\tt The defining equation was not handed over!}"; 1224 1224 list graph=f; 1225 } 1225 } 1226 1226 else 1227 1227 { // write the tropical polynomial defined by f 1228 1228 if (size(#)==0) 1229 { 1229 { 1230 1230 texf="\\min\\{"; 1231 1231 } … … 1236 1236 for (j=1;j<=size(f);j++) 1237 1237 { 1238 texf=texf+texPolynomial(f[j]); 1238 texf=texf+texPolynomial(f[j]); 1239 1239 if (j<size(f)) 1240 1240 { … … 1245 1245 texf=texf+"\\}"; 1246 1246 } 1247 } 1247 } 1248 1248 list graph=tropicalCurve(f,#); // the graph of the tropical polynomial f 1249 1249 } … … 1263 1263 \\addtolength{\\topmargin}{\\headheight} 1264 1264 \\addtolength{\\topmargin}{\\topskip} 1265 \\setlength{\\textheight}{267mm} 1265 \\setlength{\\textheight}{267mm} 1266 1266 \\addtolength{\\textheight}{\\topskip} 1267 1267 \\addtolength{\\textheight}{\\footskip} 1268 1268 \\addtolength{\\textheight}{30pt} 1269 \\setlength{\\oddsidemargin}{1in} 1269 \\setlength{\\oddsidemargin}{1in} 1270 1270 \\addtolength{\\oddsidemargin}{20mm} 1271 1271 \\setlength{\\evensidemargin}{\\oddsidemargin} 1272 \\setlength{\\textwidth}{170mm} 1272 \\setlength{\\textwidth}{170mm} 1273 1273 1274 1274 \\begin{document} 1275 1275 \\parindent0cm 1276 1276 \\begin{center} 1277 \\large\\bf The Tropicalisation of 1277 \\large\\bf The Tropicalisation of 1278 1278 1279 1279 \\bigskip … … 1299 1299 1300 1300 \\begin{center} 1301 "+texDrawNewtonSubdivision(graph,#)+" 1301 "+texDrawNewtonSubdivision(graph,#)+" 1302 1302 \\end{center} 1303 1303 \\end{document}"; … … 1306 1306 int rdnum=random(1000,9999); 1307 1307 write(":w /tmp/tropicalcurve"+string(rdnum)+".tex",TEXBILD); 1308 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 &"); 1308 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 &"); 1309 1309 } 1310 1310 else … … 1322 1322 // given by f and displays a post script image, provided you have kghostview 1323 1323 drawTropicalCurve(f); 1324 // we can instead apply the procedure to a tropical polynomial 1324 // we can instead apply the procedure to a tropical polynomial and use "maximum" 1325 1325 poly g=t3*(x7+y7+1)+1/t3*(x4+y4+x2+y2+x3y+xy3)+1/t21*x2y2; 1326 1326 list tropical_g=tropicalise(g); 1327 1327 tropical_g; 1328 drawTropicalCurve(tropical_g );1328 drawTropicalCurve(tropical_g,"max"); 1329 1329 } 1330 1330 1331 1331 proc drawNewtonSubdivision (def f,list #) 1332 1332 "USAGE: drawTropicalCurve(f[,#]); f poly, # optional list 1333 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1333 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1334 1334 representing a tropical Laurent polynomial defining a tropical plane curve; 1335 1335 alternatively f can be a polynomial in Q(t)[x,y] defining a tropical plane curve 1336 via the valuation map; 1336 via the valuation map; 1337 1337 the basering must have a global monomial ordering, two variables and up to one parameter! 1338 1338 RETURN: NONE 1339 NOTE:  the procedure produces the files /tmp/newtonsubdivisionNUMBER.tex, 1340 and /tmp/newtonsubdivisionNUMBER.ps, where NUMBER is a random four digit integer; 1339 NOTE:  the procedure produces the files /tmp/newtonsubdivisionNUMBER.tex, 1340 and /tmp/newtonsubdivisionNUMBER.ps, where NUMBER is a random four digit integer; 1341 1341 moreover it desplays the tropical curve defined by f via kghostview; 1342 1342 if you wish to remove all these files from /tmp, call the procedure cleanTmp 1343 1343 @* if # is empty, then the tropical curve is computed w.r.t. minimum, if #[1] is the 1344 string 'max', then it is computed w.r.t. maximum 1344 string 'max', then it is computed w.r.t. maximum 1345 1345 @*  note that lattice points in the Newton subdivision which are black correspond to markings 1346 1346 of the marked subdivision, while lattice points in grey are not marked … … 1357 1357 { // write the tropical polynomial defined by f 1358 1358 if (size(#)==0) 1359 { 1359 { 1360 1360 texf="\\min\\{"; 1361 1361 } … … 1366 1366 for (j=1;j<=size(f);j++) 1367 1367 { 1368 texf=texf+texPolynomial(f[j]); 1368 texf=texf+texPolynomial(f[j]); 1369 1369 if (j<size(f)) 1370 1370 { … … 1375 1375 texf=texf+"\\}"; 1376 1376 } 1377 } 1377 } 1378 1378 list graph=tropicalCurve(f,#); // the graph of the tropical polynomial f 1379 1379 } … … 1383 1383 \\parindent0cm 1384 1384 \\begin{center} 1385 \\large\\bf The Newtonsubdivison of 1385 \\large\\bf The Newtonsubdivison of 1386 1386 \\begin{displaymath} 1387 1387 f="+texf+" … … 1391 1391 1392 1392 \\begin{center} 1393 "+texDrawNewtonSubdivision(graph)+ 1393 "+texDrawNewtonSubdivision(graph)+ 1394 1394 " \\end{center} 1395 1395 … … 1397 1397 int rdnum=random(1000,9999); 1398 1398 write(":w /tmp/newtonsubdivision"+string(rdnum)+".tex",TEXBILD); 1399 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 &"); 1399 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 &"); 1400 1400 // return(TEXBILD); 1401 1401 } … … 1422 1422 proc tropicalJInvariant (def f,list #) 1423 1423 "USAGE: tropicalJInvariant(f[,#]); f poly or list, # optional list 1424 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1424 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1425 1425 representing a tropical Laurent polynomial defining a tropical plane curve; 1426 1426 alternatively f can be a polynomial in Q(t)[x,y] defining a tropical plane curve 1427 via the valuation map; 1427 via the valuation map; 1428 1428 @* the basering must have a global monomial ordering, two variables and up to one parameter! 1429 1429 RETURN: number, if the graph underlying the tropical curve has precisely one loop then its weighted 1430 1430 lattice length is returned, otherwise the result will be 1 1431 NOTE:  if the tropical curve is elliptic and its embedded graph has precisely one loop, 1431 NOTE:  if the tropical curve is elliptic and its embedded graph has precisely one loop, 1432 1432 then the weigthed lattice length of the loop is its tropical jinvariant 1433 @*  the procedure checks if the embedded graph of the tropical curve has genus one, 1434 but it does NOT check if the loop can be resolved, so that the curve is not 1435 a proper tropical elliptic curve 1433 @*  the procedure checks if the embedded graph of the tropical curve has genus one, 1434 but it does NOT check if the loop can be resolved, so that the curve is not 1435 a proper tropical elliptic curve 1436 1436 @*  if the embedded graph of a tropical elliptic curve has more than one loop, then 1437 1437 all but one can be resolved, but this is not observed by this procedure, so it 1438 1438 will not compute the jinvariant 1439 1439 @*  if # is empty, then the tropical curve is computed w.r.t. minimum, if #[1] is the 1440 string 'max', then it is computed w.r.t. maximum 1440 string 'max', then it is computed w.r.t. maximum 1441 1441 @*  the tropicalJInvariant of a plane tropical cubic is the 'cycle length' of the 1442 cubic as introduced in the paper: 1442 cubic as introduced in the paper: 1443 1443 Erik Katz, Hannah Markwig, Thomas Markwig: The jinvariant of a cubic tropical plane curve. 1444 1444 EXAMPLE: example tropicalJInvariant; shows an example" … … 1454 1454 { 1455 1455 if (typeof(f[1])=="list") 1456 { 1456 { 1457 1457 list graph=f; 1458 1458 } … … 1466 1466 { 1467 1467 ERROR("This is no valid input."); 1468 } 1468 } 1469 1469 } 1470 1470 } … … 1494 1494 else 1495 1495 { 1496 intmat nullmat[2][1]; // used to set 1497 // 4) find a vertex which has only one bounded edge, if none exists zero is returned, 1496 intmat nullmat[2][1]; // used to set 1497 // 4) find a vertex which has only one bounded edge, if none exists zero is returned, 1498 1498 // otherwise the number of the vertex in the list graph 1499 1499 int nonloopvertex=findNonLoopVertex(graph); … … 1528 1528 intvec loop,weights; // encodes the loop and the edges 1529 1529 i=1; 1530 // start by finding some vertex which belongs to the loop 1531 while (loop==0) 1530 // start by finding some vertex which belongs to the loop 1531 while (loop==0) 1532 1532 { 1533 1533 if (ncols(graph[i][3])==1) // the graph[i][3] of a vertex in the loop has 2 columns, all others have 1 … … 1537 1537 else 1538 1538 { 1539 loop[1]=i; // a starting vertex is found 1540 loop[2]=graph[i][3][1,1]; // it is connected to the vertex with this number 1539 loop[1]=i; // a starting vertex is found 1540 loop[2]=graph[i][3][1,1]; // it is connected to the vertex with this number 1541 1541 weights[2]=graph[i][3][2,1]; // and the edge has this weight 1542 1542 } … … 1549 1549 // to which the active vertex j is connected; one is loop[k1], i.e. the one which 1550 1550 // precedes j in the loop; we have to choose the other one 1551 if (graph[j][3][1,1]==loop[k1]) 1551 if (graph[j][3][1,1]==loop[k1]) 1552 1552 { 1553 1553 loop[k+1]=graph[j][3][1,2]; … … 1560 1560 } 1561 1561 j=loop[k+1]; // set loop[k+1] the new active vertex 1562 k++; 1563 } 1562 k++; 1563 } 1564 1564 // 7) compute for each edge in the loop the lattice length 1565 1565 poly xcomp,ycomp; // the x and ycomponents of the vectors connecting two vertices of the loop 1566 1566 number nenner; // the product of the denominators of the x and ycomponents 1567 1567 number jinvariant; // the jinvariant 1568 int eins,zwei,ggt; 1568 int eins,zwei,ggt; 1569 1569 for (i=1;i<=size(loop)1;i++) // compute the lattice length for each edge 1570 1570 { 1571 xcomp=graph[loop[i]][1]graph[loop[i+1]][1]; 1572 ycomp=graph[loop[i]][2]graph[loop[i+1]][2]; 1571 xcomp=graph[loop[i]][1]graph[loop[i+1]][1]; 1572 ycomp=graph[loop[i]][2]graph[loop[i+1]][2]; 1573 1573 nenner=denominator(leadcoef(xcomp))*denominator(leadcoef(ycomp)); 1574 execute("eins="+string(numerator(leadcoef(nenner*xcomp)))+";"); 1575 execute("zwei="+string(numerator(leadcoef(nenner*ycomp)))+";"); 1574 execute("eins="+string(numerator(leadcoef(nenner*xcomp)))+";"); 1575 execute("zwei="+string(numerator(leadcoef(nenner*ycomp)))+";"); 1576 1576 ggt=gcd(eins,zwei); // the lattice length is the "gcd" of the xcomponent and the ycomponent 1577 1577 jinvariant=jinvariant+ggt/(nenner*weights[i+1]); // divided by the weight of the edge 1578 1578 } 1579 return(jinvariant); 1579 return(jinvariant); 1580 1580 } 1581 1581 } … … 1591 1591 // the curve can have arbitrary degree 1592 1592 tropicalJInvariant(t*(x7+y7+1)+1/t*(x4+y4+x2+y2+x3y+xy3)+1/t7*x2y2); 1593 // the procedure does not realise, if the embedded graph of the tropical 1593 // the procedure does not realise, if the embedded graph of the tropical 1594 1594 // curve has a loop that can be resolved 1595 1595 tropicalJInvariant(1+x+y+xy+tx2y+txy2); 1596 1596 // but it does realise, if the curve has no loop at all ... 1597 1597 tropicalJInvariant(x+y+1); 1598 // or if the embedded graph has more than one loop  even if only one 1598 // or if the embedded graph has more than one loop  even if only one 1599 1599 // cannot be resolved 1600 1600 tropicalJInvariant(1+x+y+xy+tx2y+txy2+t3x5+t3y5+tx2y2+t2xy4+t2yx4); … … 1603 1603 proc weierstrassForm (poly f,list #) 1604 1604 "USAGE: weierstrassFormOfACubic(wf[,#]); wf poly, # list 1605 ASSUME: wf is a polynomial whose Newton polygon has precisely one interior lattice1605 ASSUME: wf is a a polynomial whose Newton polygon has precisely one interior lattice 1606 1606 point, so that it defines an elliptic curve on the toric surface corresponding 1607 1607 to the Newton polygon 1608 1608 RETURN: poly, the Weierstrass normal form of the polygon 1609 NOTE:  the algorithm for the coefficients of the Weierstrass form is due to 1609 NOTE:  the algorithm for the coefficients of the Weierstrass form is due to 1610 1610 Fernando Rodriguez Villegas, villegas@math.utexas.edu 1611 1611 @*  the characteristic of the base field should not be 2 or 3 … … 1669 1669 1670 1670 proc jInvariant (poly f,list #) 1671 "USAGE: jInvariant(f[,#]); f poly, # list 1672 ASSUME:  f is a polynomial whose Newton polygon has precisely one interior lattice1671 "USAGE: jInvariant(f[,#]); f poly, # list 1672 ASSUME:  f is a a polynomial whose Newton polygon has precisely one interior lattice 1673 1673 point, so that it defines an elliptic curve on the toric surface corresponding 1674 1674 to the Newton polygon 1675 @*  it the optional argument # is present the base field should be Q(t) and 1675 @*  it the optional argument # is present the base field should be Q(t) and 1676 1676 the optional argument should be one of the following strings: 1677 1677 @* 'ord' : then the return value is of type integer, namely the order of the jinvariant … … 1704 1704 echo=2; 1705 1705 ring r=(0,t),(x,y),dp; 1706 // jInvariant computes the jinvariant of a cubic 1706 // jInvariant computes the jinvariant of a cubic 1707 1707 jInvariant(x+y+x2y+y3+1/t*xy); 1708 // if the ground field has one parameter t, then we can instead 1708 // if the ground field has one parameter t, then we can instead 1709 1709 // compute the order of the jinvariant 1710 1710 jInvariant(x+y+x2y+y3+1/t*xy,"ord"); … … 1714 1714 poly h=x22y11+x19y10+x17y9+x16y9+x12y7+x9y6+x7y5+x2y3+x14y8; 1715 1715 // its jinvariant is 1716 jInvariant(h); 1716 jInvariant(h); 1717 1717 } 1718 1718 … … 1777 1777 ring tRING=0,t,ls; 1778 1778 list pointdenom=imap(BASERING,pointdenom); 1779 list pointnum=imap(BASERING,pointnum); 1779 list pointnum=imap(BASERING,pointnum); 1780 1780 intvec pointcoordinates; 1781 1781 for (i=1;i<=size(pointdenom);i++) … … 1853 1853 We consider the concic through the following five points: 1854 1854 \\begin{displaymath} 1855 "; 1855 "; 1856 1856 string texf=texDrawTropical(graphf,list("",scalefactor)); 1857 1857 for (i=1;i<=size(points);i++) … … 1891 1891 \\end{document}"; 1892 1892 setring BASERING; 1893 // If # nonempty, compute the dual conic and the tangents through the dual points 1893 // If # nonempty, compute the dual conic and the tangents through the dual points 1894 1894 // corresponding to the tangents of the given conic. 1895 1895 if (size(#)>0) 1896 1896 { 1897 1897 list dualpoints; 1898 for (i=1;i<=size(points);i++) 1898 for (i=1;i<=size(points);i++) 1899 1899 { 1900 1900 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)); … … 1920 1920 // conic[2] is the equation of the conic f passing through the five points 1921 1921 conic[2]; 1922 // conic[3] is a list containing the equations of the tangents 1922 // conic[3] is a list containing the equations of the tangents 1923 1923 // through the five points 1924 1924 conic[3]; 1925 1925 // conic[4] is an ideal representing the tropicalisation of the conic f 1926 1926 conic[4]; 1927 // conic[5] is a list containing the tropicalisation 1927 // conic[5] is a list containing the tropicalisation 1928 1928 // of the five tangents in conic[3] 1929 1929 conic[5]; 1930 // conic[6] is a list containing the vertices of the tropical conic 1930 // conic[6] is a list containing the vertices of the tropical conic 1931 1931 conic[6]; 1932 1932 // conic[7] is a list containing the vertices of the five tangents 1933 1933 conic[7]; 1934 // conic[8] contains the latex code to draw the tropical conic and 1935 // its tropicalised tangents; it can written in a file, processed and 1936 // displayed via kghostview 1937 write(":w /tmp/conic.tex",conic[8]); 1938 system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi o; 1934 // conic[8] contains the latex code to draw the tropical conic and 1935 // its tropicalised tangents; it can written in a file, processed and 1936 // displayed via kghostview 1937 write(":w /tmp/conic.tex",conic[8]); 1938 system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi o; 1939 1939 kghostview conic.ps &"); 1940 // with an optional argument the same information for the dual conic is computed 1940 // with an optional argument the same information for the dual conic is computed 1941 1941 // and saved in conic[9] 1942 1942 conic=conicWithTangents(points,1); 1943 1943 conic[9][2]; // the equation of the dual conic 1944 1944 } 1945 1945 1946 1946 //////////////////////////////////////////////////////////////////////////////////// 1947 1947 /// Procedures concerned with tropicalisation … … 1952 1952 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 1953 1953 RETURN: list, the linear forms of the tropicalisation of f 1954 NOTE: if # is empty, then the valuation of t will be 1, 1955 @* if # is the string 'max' it will be 1; 1956 @* the latter supposes that we consider the maximum of the computed1954 NOTE: if # is empty, then the valuation of t will be 1, 1955 @* if # is the string 'max' it will be 1; 1956 @* the latter supposes that we consider the maximum of the the computed 1957 1957 linear forms, the former that we consider their minimum 1958 1958 EXAMPLE: example tropicalise; shows an example" … … 1977 1977 { 1978 1978 tropicalf[i]=tropicalf[i]+exp[j]*var(j); 1979 } 1979 } 1980 1980 f=flead(f); 1981 1981 } … … 2013 2013 } 2014 2014 2015 proc tInitialForm (poly f, intvec w) 2015 proc tInitialForm (poly f, intvec w) 2016 2016 "USAGE: tInitialForm(f,w); f a polynomial, w an integer vector 2017 2017 ASSUME: f is a polynomial in Q[t,x_1,...,x_n] and w=(w_0,w_1,...,w_n) … … 2026 2026 // do the same for the remaining part of f and compare the results 2027 2027 // keep only the smallest ones 2028 int vglgewicht; 2029 f=flead(f); 2028 int vglgewicht; 2029 f=flead(f); 2030 2030 while (f!=0) 2031 2031 { … … 2042 2042 initialf=initialf+lead(f); 2043 2043 } 2044 } 2044 } 2045 2045 f=flead(f); 2046 2046 } … … 2058 2058 } 2059 2059 2060 proc tInitialIdeal (ideal i,intvec w,list #) 2060 proc tInitialIdeal (ideal i,intvec w,list #) 2061 2061 "USAGE: tInitialIdeal(i,w); i ideal, w intvec 2062 ASSUME: i is an ideal in Q[t,x_1,...,x_n] and w=(w_0,...,w_n) 2062 ASSUME: i is an ideal in Q[t,x_1,...,x_n] and w=(w_0,...,w_n) 2063 2063 RETURN: ideal ini, the tinitial ideal of i with respect to w" 2064 2064 { … … 2087 2087 // ... and compute a standard basis with 2088 2088 // respect to the homogenised ordering defined by w. Since the generators 2089 // of i will be homogeneous it we can instead take the ordering wp 2090 // with the weightvector (0,w) replaced by (M,...,M)+(0,w) for some 2091 // large M, so that all entries are positive 2089 // of i will be homogeneous it we can instead take the ordering wp 2090 // with the weightvector (0,w) replaced by (M,...,M)+(0,w) for some 2091 // large M, so that all entries are positive 2092 2092 int M=minInIntvec(w)[1]+1; // find M such that w[j]+M is strictly positive for all j 2093 2093 intvec whomog=M+1; … … 2097 2097 } 2098 2098 execute("ring WEIGHTRING=("+charstr(basering)+"),("+varstr(basering)+"),(wp("+string(whomog)+"));"); 2099 // map i to the new ring and compute a GB of i, then dehomogenise i, 2100 // so that we can be sure, that the 2099 // map i to the new ring and compute a GB of i, then dehomogenise i, 2100 // so that we can be sure, that the 2101 2101 // initial forms of the generators generate the initial ideal 2102 2102 ideal i=subst(groebner(imap(HOMOGRING,i)),@s,1); … … 2343 2343 proc texDrawBasic (list texdraw) 2344 2344 "USAGE: texDrawBasic(texdraw); list texdraw 2345 ASSUME: texdraw is a list of strings representing texdraw commands (as produced by 2345 ASSUME: texdraw is a list of strings representing texdraw commands (as produced by 2346 2346 texDrawTropical) which should be embedded into a texdraw environment 2347 2347 RETURN: string, a texdraw environment enclosing the input … … 2363 2363 \\end{texdraw}"; 2364 2364 return(texdrawtp); 2365 } 2365 } 2366 2366 example 2367 2367 { … … 2378 2378 ASSUME: graph is the output of tropicalCurve 2379 2379 RETURN: string, the texdraw code of the tropical plane curve encoded by graph 2380 NOTE:  if the list # is nonempty, the first entry should be a string; if this string is 'max', 2380 NOTE:  if the list # is nonempty, the first entry should be a string; if this string is 'max', 2381 2381 then the tropical curve is considered with respect to the maximum; otherwise the curve 2382 is considered with respect to the minimum and the string can be used to 2382 is considered with respect to the minimum and the string can be used to 2383 2383 insert further texdraw commands (e.g. to have a lighter image as when called 2384 from inside conicWithTangents); 2384 from inside conicWithTangents); 2385 2385 @*  the procedure computes a scalefactor for the texdraw command which should 2386 2386 help to display the curve in the right way; this may, however, be a bad idea … … 2392 2392 int i,j; 2393 2393 // deal first with the pathological case that the input polynomial was a monomial 2394 // and does therefore not define a tropical curve, and check if the Newton polytope is 2394 // and does therefore not define a tropical curve, and check if the Newton polytope is 2395 2395 // a line segment so that the curve defines a bunch of lines 2396 2396 int bunchoflines; … … 2414 2414 // go on with the case that a tropical curve is defined 2415 2415 if (size(#)==0) 2416 { 2416 { 2417 2417 string texdrawtp=" 2418 2418 … … 2422 2422 { 2423 2423 if ((#[1]!="max") and (#[1]!="")) 2424 { 2424 { 2425 2425 string texdrawtp=#[1]; 2426 2426 } … … 2545 2545 NOTE:  the list # should contain as only entry a string; if this string is 'max', then 2546 2546 the tropical curve is considered with respect to the maximum; otherwise the curve 2547 is considered with respect to the minimum and the string can be used to 2547 is considered with respect to the minimum and the string can be used to 2548 2548 insert further texdraw commands (e.g. to have a lighter image as when called 2549 2549 from inside conicWithTangents); the list # is optional and may as well be empty … … 2554 2554 int i,j,k,l; 2555 2555 list boundary=graph[size(graph)][1]; 2556 list inneredges=graph[size(graph)][2]; 2556 list inneredges=graph[size(graph)][2]; 2557 2557 intvec shiftvector=graph[size(graph)][3]; 2558 2558 string subdivision; … … 2566 2566 poly scalefactor=minOfPolys(list(12/leadcoef(maxx),12/leadcoef(maxy))); 2567 2567 if (scalefactor<1) 2568 { 2568 { 2569 2569 subdivision=subdivision+" 2570 2570 \\relunitscale"+ decimal(scalefactor); … … 2574 2574 { 2575 2575 subdivision=subdivision+" 2576 \\move ("+string(boundary[i][1])+" "+string(boundary[i][2])+") 2576 \\move ("+string(boundary[i][1])+" "+string(boundary[i][2])+") 2577 2577 \\lvec ("+string(boundary[i+1][1])+" "+string(boundary[i+1][2])+")"; 2578 } 2578 } 2579 2579 subdivision=subdivision+" 2580 \\move ("+string(boundary[size(boundary)][1])+" "+string(boundary[size(boundary)][2])+") 2580 \\move ("+string(boundary[size(boundary)][1])+" "+string(boundary[size(boundary)][2])+") 2581 2581 \\lvec ("+string(boundary[1][1])+" "+string(boundary[1][2])+") 2582 2582 … … 2585 2585 { 2586 2586 subdivision=subdivision+" 2587 \\move ("+string(inneredges[i][1][1])+" "+string(inneredges[i][1][2])+") 2587 \\move ("+string(inneredges[i][1][1])+" "+string(inneredges[i][1][2])+") 2588 2588 \\lvec ("+string(inneredges[i][2][1])+" "+string(inneredges[i][2][2])+")"; 2589 2589 } … … 2605 2605 } 2606 2606 } 2607 // deal with the pathological cases 2607 // deal with the pathological cases 2608 2608 if (size(boundary)==1) // then the Newton polytope is a point 2609 2609 { … … 2660 2660 { 2661 2661 subdivision=subdivision+" 2662 \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 2662 \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 2663 2663 \\fcir f:0 r:"+decimal(2/(8*scalefactor),size(string(int(scalefactor)))+1); 2664 2664 } 2665 2665 // enclose subdivision in the texdraw environment 2666 string texsubdivision=" 2666 string texsubdivision=" 2667 2667 \\begin{texdraw} 2668 \\drawdim cm \\relunitscale 1 2668 \\drawdim cm \\relunitscale 1 2669 2669 \\linewd 0.05" 2670 2670 +subdivision+" … … 2680 2680 poly f=x+y+x2y+xy2+1/t*xy; 2681 2681 list graph=tropicalCurve(f); 2682 // compute the texdraw code of the Newton subdivision of the tropical curve 2682 // compute the texdraw code of the Newton subdivision of the tropical curve 2683 2683 texDrawNewtonSubdivision(graph); 2684 2684 } … … 2707 2707 markings[3*i2]=triang[i][1]; 2708 2708 markings[3*i1]=triang[i][2]; 2709 markings[3*i]=triang[i][3]; 2709 markings[3*i]=triang[i][3]; 2710 2710 } 2711 2711 // delete redundant pairs which occur more than once … … 2740 2740 { 2741 2741 latex=latex+" 2742 \\move ("+string(polygon[markings[i]][1])+" "+string(polygon[markings[i]][2])+") 2742 \\move ("+string(polygon[markings[i]][1])+" "+string(polygon[markings[i]][2])+") 2743 2743 \\fcir f:0 r:0.08"; 2744 2744 } … … 2747 2747 { 2748 2748 latex=latex+" 2749 \\move ("+string(polygon[pairs[i][1]][1])+" "+string(polygon[pairs[i][1]][2])+") 2749 \\move ("+string(polygon[pairs[i][1]][1])+" "+string(polygon[pairs[i][1]][2])+") 2750 2750 \\lvec ("+string(polygon[pairs[i][2]][1])+" "+string(polygon[pairs[i][2]][2])+")"; 2751 2751 } … … 2754 2754 { 2755 2755 latex=latex+" 2756 \\move ("+string(polygon[i][1])+" "+string(polygon[i][2])+") 2756 \\move ("+string(polygon[i][1])+" "+string(polygon[i][2])+") 2757 2757 \\fcir f:0.7 r:0.04"; 2758 2758 } … … 2763 2763 "EXAMPLE:"; 2764 2764 echo=2; 2765 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 2765 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 2766 2766 // with all integer points as markings 2767 2767 list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0),intvec(0,0), 2768 2768 intvec(2,1),intvec(0,1),intvec(1,2),intvec(0,2),intvec(0,3); 2769 // define a triangulation by connecting the only interior point 2769 // define a triangulation by connecting the only interior point 2770 2770 // with the vertices 2771 2771 list triang=intvec(1,2,5),intvec(1,5,10),intvec(1,2,10); … … 2775 2775 2776 2776 //////////////////////////////////////////////////////////////////////////////////// 2777 /// Auxilary Procedures 2777 /// Auxilary Procedures 2778 2778 //////////////////////////////////////////////////////////////////////////////////// 2779 2779 … … 2829 2829 // do the same for the remaining part of f and compare the results 2830 2830 // keep only the smallest ones 2831 int vglgewicht; 2832 f=flead(f); 2831 int vglgewicht; 2832 f=flead(f); 2833 2833 while (f!=0) 2834 2834 { 2835 leitkoef=simplifyToOrder(f); 2835 leitkoef=simplifyToOrder(f); 2836 2836 vglgewicht=leitkoef[1]+scalarproduct(w,leadexp(f)); 2837 2837 if (vglgewicht<gewicht) … … 2848 2848 initialf=initialf+koef*leadmonom(f); 2849 2849 } 2850 } 2850 } 2851 2851 f=flead(f); 2852 2852 } … … 2872 2872 // compute first the torder of the leading coefficient of f (leitkoef[1]) and 2873 2873 // the rational constant corresponding to this order in leadkoef(f) (leitkoef[2]) 2874 list leitkoef=simplifyToOrder(f); 2874 list leitkoef=simplifyToOrder(f); 2875 2875 execute("poly koef="+leitkoef[2]+";"); 2876 2876 // take in lead(f) only the term of lowest torder and set t=1 … … 2881 2881 // keep only the largest ones 2882 2882 int vglgewicht; 2883 f=flead(f); 2883 f=flead(f); 2884 2884 while (f!=0) 2885 2885 { … … 2899 2899 initialf=initialf+koef*leadmonom(f); 2900 2900 } 2901 } 2901 } 2902 2902 f=flead(f); 2903 2903 } … … 2916 2916 proc solveTInitialFormPar (ideal i) 2917 2917 "USAGE: solveTInitialFormPar(i); i ideal 2918 ASSUME: i is a zerodimensional ideal in Q(t)[x_1,...,x_n] generated by the (1,w)homogeneous 2918 ASSUME: i is a zerodimensional ideal in Q(t)[x_1,...,x_n] generated by the (1,w)homogeneous 2919 2919 elements for some integer vector w  i.e. by the (1,w)initialforms of polynomials 2920 2920 RETURN: none … … 2941 2941 } 2942 2942 2943 proc detropicalise (poly p) 2943 proc detropicalise (poly p) 2944 2944 "USAGE: detropicalise(f); f poly 2945 2945 ASSUME: f is a linear polynomial with an arbitrary constant term and … … 2953 2953 { 2954 2954 if (leadmonom(p)!=1) 2955 { 2955 { 2956 2956 dtp=dtp*leadmonom(p)^int(leadcoef(p)); 2957 2957 } … … 3057 3057 poly f=t2x+1/t*y1; 3058 3058 tropicalSubst(f,2,x,x+t,y,tx+y+t2); 3059 // The procedure can be used to study the effect of a transformation of 3059 // The procedure can be used to study the effect of a transformation of 3060 3060 // the form x > x+t^b, with b a rational number, on the tropicalisation and 3061 3061 // the jinvariant of a cubic over the Puiseux series. … … 3063 3063 //  the jinvariant, and hence its valuation, does not change under the transformation 3064 3064 jInvariant(f,"ord"); 3065 //  b=3/2, then the cycle length of the tropical cubic equals val(jinv) 3066 list g32=tropicalSubst(f,2,x,x+t3,y,y); 3065 //  b=3/2, then the cycle length of the tropical cubic equals val(jinv) 3066 list g32=tropicalSubst(f,2,x,x+t3,y,y); 3067 3067 tropicalJInvariant(g32); 3068 3068 //  b=1, then it is still true, but only just ... … … 3075 3075 3076 3076 proc randomPoly (int d,int ug, int og, list #) 3077 "USAGE: randomPoly(d,ug,og[,#]); d, ug, og int, # list 3077 "USAGE: randomPoly(d,ug,og[,#]); d, ug, og int, # list 3078 3078 ASSUME: the basering has a parameter t 3079 3079 RETURN: poly, a polynomial of degree d where the coefficients are of the form t^j with 3080 3080 j a random integer between ug and og 3081 NOTE: if an optional argument # is given, then the coefficients are instead either of the 3081 NOTE: if an optional argument # is given, then the coefficients are instead either of the 3082 3082 form t^j as above or they are zero, and this is chosen randomly 3083 3083 EXAMPLE: example randomPoly; shows an example" … … 3095 3095 { 3096 3096 if (size(#)!=0) 3097 { 3097 { 3098 3098 k=random(0,1); 3099 3099 } 3100 3100 if (k==0) 3101 { 3101 { 3102 3102 j=random(ug,og); 3103 3103 randomPolynomial=randomPolynomial+t^j*m[i]; … … 3127 3127 RETURN: none" 3128 3128 { 3129 system("sh","cd /tmp; /bin/rm f tropicalcurve*; /bin/rm f tropicalnewtonsubdivision*"); 3129 system("sh","cd /tmp; /bin/rm f tropicalcurve*; /bin/rm f tropicalnewtonsubdivision*"); 3130 3130 } 3131 3131 … … 3182 3182 static proc cutdown (ideal jideal,intvec wvec,int dimension,list #) 3183 3183 "USAGE: cutdown(i,w,d); i ideal, w intvec, d int, # list 3184 ASSUME: i an ideal in Q[t,x_1,...,x_n], (w_1,...,w_n) is in the tropical variety of jideal 3184 ASSUME: i an ideal in Q[t,x_1,...,x_n], (w_1,...,w_n) is in the tropical variety of jideal 3185 3185 and d=dim(i)>0, in Q(t)[x]; the optional parameter # can contain the string 'isPrime' 3186 to indicate that the input ideal is prime and no minimal associated primes have 3186 to indicate that the input ideal is prime and no minimal associated primes have 3187 3187 to be computed 3188 3188 RETURN: list, the first entry is a ring, namely the basering where some variables have been … … 3195 3195 wvec with the components corresponding to the eliminated variables removed 3196 3196 NOTE: needs the libraries random.lib and primdec.lib; is called from tropicalLifting" 3197 { 3198 // IDEA: i is an ideal of dimension d; we want to cut it with d random linear 3197 { 3198 // IDEA: i is an ideal of dimension d; we want to cut it with d random linear 3199 3199 // forms in such a way that the resulting 3200 3200 // ideal is 0dim and still contains w in the tropical variety 3201 // NOTE: t is the last variable in the basering 3201 // NOTE: t is the last variable in the basering 3202 3202 ideal pideal; //this is the ideal we want to return 3203 3203 ideal cutideal; … … 3219 3219 variablen=variablen+var(j1); //read the set of variables (needed to make the quotring later) 3220 3220 product=product*var(j1); //make product of all variables (needed for the initialmonomialcheck later 3221 } 3221 } 3222 3222 execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;"); 3223 3223 setring BASERING; … … 3226 3226 { 3227 3227 setring QUOTRING; 3228 ideal jideal=imap(BASERING,jideal); 3229 list primp=minAssGTZ(jideal); //compute the primary decomposition 3228 ideal jideal=imap(BASERING,jideal); 3229 list primp=minAssGTZ(jideal); //compute the primary decomposition 3230 3230 for (j1=1;j1<=size(primp);j1++) 3231 { 3231 { 3232 3232 for(j2=1;j2<=size(primp[j1]);j2++) 3233 3233 { 3234 3234 primp[j1][j2]=primp[j1][j2]/content(primp[j1][j2]);// clear all denominators 3235 } 3235 } 3236 3236 } 3237 3237 setring BASERING; … … 3239 3239 // if i is not primary itself 3240 3240 // go through the list of min. ass. primes and find the first one which has w in its tropical variety 3241 if (size(primp)>1) 3241 if (size(primp)>1) 3242 3242 { 3243 3243 j1=1; … … 3246 3246 //compute the tinitial of the associated prime 3247 3247 //  the last entry 1 only means that t is the last variable in the ring 3248 primini=tInitialIdeal(primp[j1],wvec,1); 3248 primini=tInitialIdeal(primp[j1],wvec,1); 3249 3249 // check if it contains a monomial (resp if the product of var is in the radical) 3250 if (radicalMemberShip(product,primini)==0) 3251 { 3250 if (radicalMemberShip(product,primini)==0) 3251 { 3252 3252 jideal=primp[j1];// if w is in the tropical variety of the prime, we take that 3253 3253 setring QUOTRING; … … 3255 3255 setring BASERING; 3256 3256 winprim=1; // and stop the checking 3257 } 3257 } 3258 3258 j1=j1+1; //else we look at the next associated prime 3259 3259 } … … 3262 3262 { 3263 3263 jideal=primp[1]; //if i is primary itself we take its prime instead 3264 } 3264 } 3265 3265 } 3266 3266 // now we start as a first try to intersect with a hyperplane parallel to 3267 3267 // coordinate axes, because this would make our further computations 3268 // a lot easier. 3268 // a lot easier. 3269 3269 // We choose a subset of our n variables of size d=dim(ideal). For each of these 3270 3270 // variables, we want to fix a value: x_i= a_i*t^w_i. This will only work if the … … 3275 3275 // (NOTE, there EXIST d variables such that a random choice of a_i's would work!). 3276 3276 // But since this involves many computations, we prefer to choose randomly and just 3277 // try in the end if our intersected ideal satisfies our requirements. If this does not 3277 // try in the end if our intersected ideal satisfies our requirements. If this does not 3278 3278 // work, we give up this try and use our second intersection idea, which 3279 3279 // will work for a Zariksiopen subset (i.e. almost always). … … 3282 3282 // wveccoordinate is smallest, because this will give us the smallest powers of t and hence 3283 3283 // less effort in following computations. Note that the smallest absolute value have those 3284 // which are biggest, because wvec is negative. 3284 // which are biggest, because wvec is negative. 3285 3285 //print("first try"); 3286 3286 intvec wminust=intvecdelete(wvec,1); … … 3290 3290 A[2,1..size(wminust)]=1..size(wminust); 3291 3291 // sort this matrix in order to get the d biggest entries and their position in wvec 3292 A=sortintmat(A); 3293 // we construct a vector which has 1 at entry j if j belongs to the list 3292 A=sortintmat(A); 3293 // we construct a vector which has 1 at entry j if j belongs to the list 3294 3294 // of the d biggest entries of wvec and a 0 else 3295 3295 for (j1=1;j1<=nvars(basering)1;j1++) //go through the variables … … 3300 3300 { 3301 3301 setvec[j1]=1;//put a 1 3302 } 3303 } 3304 } 3305 // using this 0/1vector we produce a random constant (i.e. coeff in Q times something in t) 3302 } 3303 } 3304 } 3305 // using this 0/1vector we produce a random constant (i.e. coeff in Q times something in t) 3306 3306 // for each of the biggest variables, we add the forms x_irandom constant to the ideal 3307 3307 // and we save the constant at the ith place of a list we want to return for later computations … … 3315 3315 { 3316 3316 if(setvec[j1]==1)//if x_i belongs to the biggest variables 3317 { 3317 { 3318 3318 if ((j3==1) and ((char(basering)==0) or (char(basering)>3))) 3319 { 3319 { 3320 3320 randomp1=random(1,3); 3321 3321 randomp=t^(A[1,j2])*randomp1;//make a random constant  first we try small numbers 3322 } 3322 } 3323 3323 if ((j3==2) and ((char(basering)==0) or (char(basering)>100))) 3324 3324 { 3325 3325 randomp1=random(1,100); 3326 3326 randomp=t^(A[1,j2])*randomp1;//make a random constant  next we try bigger numbers 3327 } 3327 } 3328 3328 else 3329 3329 { … … 3337 3337 else 3338 3338 { 3339 ergl[j1]=0; //if the variable belongs not the d biggest ones, save 0 in the list3339 ergl[j1]=0; //if the variable belongs not the the d biggest ones, save 0 in the list 3340 3340 erglini[j1]=0; 3341 } 3341 } 3342 3342 } 3343 3343 // print(ergl);print(pideal); 3344 // now we check if we made a good choice of pideal, i.e. if dim=0 and 3344 // now we check if we made a good choice of pideal, i.e. if dim=0 and 3345 3345 // wvec is still in the tropical variety 3346 3346 //change to quotring where we compute dimension … … 3349 3349 { 3350 3350 if(setvec[j1]==1) 3351 { 3352 cutideal=cutideal,var(j1)ergl[j1];//add all forms to the ideal 3353 } 3351 { 3352 cutideal=cutideal,var(j1)ergl[j1];//add all forms to the ideal 3353 } 3354 3354 } 3355 3355 setring QUOTRING; … … 3369 3369 // and if the initial w.r.t. t contains no monomial as we want (checked with 3370 3370 // radicalmembership of the product of all variables) 3371 if (radicalMemberShip(product,pini)==0) 3372 { 3373 // we made the right choice and now we substitute the variables in the ideal 3371 if (radicalMemberShip(product,pini)==0) 3372 { 3373 // we made the right choice and now we substitute the variables in the ideal 3374 3374 //to get an ideal in less variables 3375 3375 // also we make a projected vector from wvec only the components of the remaining variables 3376 3376 wvecp=wvec; 3377 variablen=0; 3377 variablen=0; 3378 3378 j2=0; 3379 3379 for(j1=1;j1<=nvars(basering)1;j1++) … … 3389 3389 { 3390 3390 variablen=variablen+var(j1); //read the set of remaining variables (needed to make quotring later) 3391 } 3392 } 3391 } 3392 } 3393 3393 // return pideal, the initial and the list ergl which tells us 3394 3394 // which variables we replaced by which form … … 3400 3400 export(ini); 3401 3401 export(repl); 3402 return(list(BASERINGLESS1,wvecp)); 3402 return(list(BASERINGLESS1,wvecp)); 3403 3403 } 3404 3404 } … … 3409 3409 // probability 1. 3410 3410 // 3411 // We choose general hyperplanes, i.e. linear forms which involve all x_i. 3412 // Each x_i has to be multiplied bz t^(w_i) in order to get the same weight (namely 0) 3411 // We choose general hyperplanes, i.e. linear forms which involve all x_i. 3412 // Each x_i has to be multiplied bz t^(w_i) in order to get the same weight (namely 0) 3413 3413 // for each term. As we cannot have negative exponents, we multiply 3414 // the whole form by t^minimumw. Notice that then in the first form, 3414 // the whole form by t^minimumw. Notice that then in the first form, 3415 3415 // there is one term without t the term of the variable 3416 3416 // x_i such that w_i is minimal. That is, we can solve for this variable. 3417 // In the second form, we can replace that variable, and divide by t as much as possible. 3418 // Then there is again one term wihtout t  the term of the variable with second least w. 3417 // In the second form, we can replace that variable, and divide by t as much as possible. 3418 // Then there is again one term wihtout t  the term of the variable with second least w. 3419 3419 // So we can solve for this one again and also replace it in the first form. 3420 // Since all our coefficients are chosen randomly, we can also from the beginning on 3421 // choose the set of variables which belong to the d smallest entries of wvec 3422 // (t not counting) and pick random forms g_i(t,x') (where x' is the set of remaining variables) 3423 // and set x_i=g_i(t,x'). 3420 // Since all our coefficients are chosen randomly, we can also from the beginning on 3421 // choose the set of variables which belong to the d smallest entries of wvec 3422 // (t not counting) and pick random forms g_i(t,x') (where x' is the set of remaining variables) 3423 // and set x_i=g_i(t,x'). 3424 3424 // 3425 3425 // make a matrix with first row wvec (without t) and second row 1..n 3426 3426 //print("second try"); 3427 3427 setring BASERING; 3428 A[1,1..size(wminust)]=wminust; 3428 A[1,1..size(wminust)]=wminust; 3429 3429 A[2,1..size(wminust)]=1..size(wminust); 3430 3430 // sort this matrix in otder to get the d smallest entries (without counting the tentry) … … 3433 3433 setvec=0; 3434 3434 setvec[nvars(basering)1]=0; 3435 // we construct a vector which has 1 at entry j if j belongs to the list of 3435 // we construct a vector which has 1 at entry j if j belongs to the list of 3436 3436 // the d smallest entries of wvec and a 0 else 3437 3437 for (j1=1;j1<=nvars(basering)1;j1++) //go through the variables … … 3459 3459 variablen=variablen+var(j1); //read the set of remaining variables (needed to make the quotring later) 3460 3460 } 3461 } 3461 } 3462 3462 setring BASERING; 3463 3463 execute("ring BASERINGLESS2=("+charstr(BASERING)+"),("+string(variablen)+",t),(dp("+string(ncols(variablen))+"),lp(1));"); 3464 3464 // using the 0/1vector which tells us which variables belong to the set of smallest entries of wvec 3465 // we construct a set of d random linear polynomials of the form x_i=g_i(t,x'), 3465 // we construct a set of d random linear polynomials of the form x_i=g_i(t,x'), 3466 3466 // where the set of all x_i is the set of 3467 3467 // all variables which are in the list of smallest entries in wvec, and x' are the other variables. 3468 // We add these d random linear polynomials to the indeal pideal, i.e. we intersect 3468 // We add these d random linear polynomials to the indeal pideal, i.e. we intersect 3469 3469 // with these and hope to get something 3470 // 0dim which still contains wvec in its tropical variety. Also, we produce a list ergl 3470 // 0dim which still contains wvec in its tropical variety. Also, we produce a list ergl 3471 3471 // with g_i at the ith position. 3472 3472 // This is a list we want to return. … … 3477 3477 { 3478 3478 if ((char(basering)==0) or (char(basering)>3)) 3479 { 3479 { 3480 3480 randomp1=random(1,3); 3481 3481 randomp=randomp1*t^(A[1,j1]); … … 3514 3514 } 3515 3515 //print(ergl); 3516 // Again, we have to test if we made a good choice to intersect,i.e. we have to check whether 3516 // Again, we have to test if we made a good choice to intersect,i.e. we have to check whether 3517 3517 // pideal is 0dim and contains wvec in the tropical variety. 3518 3518 cutideal=pideal; … … 3521 3521 if(setvec[j1]==1) 3522 3522 { 3523 cutideal=cutideal,var(j1)ergl[j1];//add all forms to the ideal 3524 } 3523 cutideal=cutideal,var(j1)ergl[j1];//add all forms to the ideal 3524 } 3525 3525 } 3526 3526 setring QUOTRING; … … 3540 3540 // and if the initial w.r.t. t contains no monomial as we want (checked with 3541 3541 // radicalmembership of the product of all variables) 3542 if (radicalMemberShip(product,pini)==0) 3542 if (radicalMemberShip(product,pini)==0) 3543 3543 { 3544 3544 // we want to replace the variables x_i by the forms g_i in 3545 // our ideal in order to return an ideal with less variables 3545 // our ideal in order to return an ideal with less variables 3546 3546 // first we substitute the chosen variables 3547 3547 for(j1=1;j1<=nvars(basering)1;j1++) … … 3560 3560 export(ini); 3561 3561 export(repl); 3562 return(list(BASERINGLESS2,wvecp)); 3562 return(list(BASERINGLESS2,wvecp)); 3563 3563 } 3564 3564 } … … 3573 3573 randomp=randomp1*t^(A[1,j1]); 3574 3574 for(j2=1;j2<=nvars(basering)1;j2++)//go through all variables 3575 { 3575 { 3576 3576 if(setvec[j2]==0)//if x_j belongs to the set x' 3577 3577 { 3578 3578 // add a random term with the suitable power of t to the random linear form 3579 3579 if ((char(basering)==0) or (char(basering)>100)) 3580 { 3580 { 3581 3581 randomp2=random(1,100); 3582 3582 randomp1=randomp1+randomp2*var(j2); … … 3599 3599 } 3600 3600 //print(ergl); 3601 // Again, we have to test if we made a good choice to intersect,i.e. we have to check whether 3601 // Again, we have to test if we made a good choice to intersect,i.e. we have to check whether 3602 3602 // pideal is 0dim and contains wvec in the tropical variety. 3603 3603 cutideal=pideal; … … 3606 3606 if(setvec[j1]==1) 3607 3607 { 3608 cutideal=cutideal,var(j1)ergl[j1];//add all forms to the ideal 3609 } 3608 cutideal=cutideal,var(j1)ergl[j1];//add all forms to the ideal 3609 } 3610 3610 } 3611 3611 setring QUOTRING; … … 3615 3615 //print(dimp); 3616 3616 kill cutideal; 3617 setring BASERING; 3617 setring BASERING; 3618 3618 if (dimp==0) // if it is 0 as we want 3619 3619 { … … 3625 3625 // and if the initial w.r.t. t contains no monomial as we want (checked with 3626 3626 // radicalmembership of the product of all variables) 3627 if (radicalMemberShip(product,pini)==0) 3627 if (radicalMemberShip(product,pini)==0) 3628 3628 { 3629 3629 // we want to replace the variables x_i by the forms g_i in … … 3636 3636 pideal=subst(pideal,var(j1),ergl[j1]);//substitute it 3637 3637 pini=subst(pini,var(j1),erglini[j1]); 3638 } 3639 } 3638 } 3639 } 3640 3640 // return pideal and the list ergl which tells us 3641 3641 // which variables we replaced by which form … … 3647 3647 export(ini); 3648 3648 export(repl); 3649 return(list(BASERINGLESS2,wvecp)); 3649 return(list(BASERINGLESS2,wvecp)); 3650 3650 } 3651 3651 } … … 3656 3656 static proc tropicalparametriseNoabs (ideal i,intvec ww,int ordnung,int gfanold,int nogfan,list #) 3657 3657 "USAGE: tropicalparametriseNoabs(i,tw,ord,gf,ng[,#]); i ideal, tw intvec, ord int, gf,ng int, # opt. list 3658 ASSUME:  i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], tw=(w_0,w_1,...,w_n,0,...,0) 3659 and (w_0,...,w_n,0,...,0) is in the tropical variety of i, 3660 and ord is the order up to which a point in V(i) over C((t)) lying over w shall be computed; 3658 ASSUME:  i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], tw=(w_0,w_1,...,w_n,0,...,0) 3659 and (w_0,...,w_n,0,...,0) is in the tropical variety of i, 3660 and ord is the order up to which a point in V(i) over C((t)) lying over w shall be computed; 3661 3661  moreover, k should be zero if the procedure is not called recursively; 3662 3662  the point in the tropical variety is supposed to lie in the NEGATIVE orthant; 3663 3663  the ideal is zerodimensional when considered in (Q(t)[X_1,...,X_k]/m)[x_1,...,x_n], 3664 where m=#[2] is a maximal ideal in Q(t)[X_1,...,X_k]; 3664 where m=#[2] is a maximal ideal in Q(t)[X_1,...,X_k]; 3665 3665  gf is 0 if version 2.2 or larger is used and it is 1 else 3666  ng is 1 if gfan should not be executed 3666  ng is 1 if gfan should not be executed 3667 3667 RETURN: list, l[1] = ring Q(0,X_1,...,X_r)[[t]] 3668 3668 l[2] = int 3669 3669 l[3] = string 3670 3670 NOTE:  the procedure is also called recursively by itself, and 3671 if it is called in the first recursion, the list # is empty, 3671 if it is called in the first recursion, the list # is empty, 3672 3672 otherwise #[1] is an integer, one more than the number of true variables x_1,...,x_n, 3673 3673 and #[2] will contain the maximal ideal m in the variables X_1,...X_k … … 3739 3739 intvec tw=ww; // in case some variables are deleted, we have to store the old weight vector 3740 3740 deletedvariables[anzahlvariablen]=0; 3741 ideal I,LI; 3741 ideal I,LI; 3742 3742 i=i+m; // if a field extension was necessary, then i has to be extended by m 3743 3743 for (jj=anzahlvariablen1;jj>=1;jj) // the variable t is the last one !!! … … 3751 3751 if (size(LI)==0) // if no power of t is in lead(I) (where the X(i) are considered as field elements) 3752 3752 { 3753 // get rid of var(jj) 3753 // get rid of var(jj) 3754 3754 i=eliminate(I,var(jj)); 3755 3755 deletedvariables[jj]=1; … … 3775 3775 execute("ring NEURING=("+charstr(basering)+"),("+string(variablen)+"),(dp("+string(size(variablen)1)+"),lp(1));"); 3776 3776 ideal i=imap(BASERING,i); 3777 ideal gesamt_m=imap(BASERING,gesamt_m); 3777 ideal gesamt_m=imap(BASERING,gesamt_m); 3778 3778 } 3779 3779 // now we have to compute a point ww on the tropical variety of the transformed ideal i; … … 3784 3784 def PREGFANRING=basering; 3785 3785 if (nogfan!=1) 3786 { 3786 { 3787 3787 // pass to a ring which has variables which are suitable for gfan 3788 3788 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;"); 3789 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; 3789 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; 3790 3790 phiideal[nvars(PREGFANRING)]=a; // map t to a 3791 map phi=PREGFANRING,phiideal; 3791 map phi=PREGFANRING,phiideal; 3792 3792 ideal i=phi(i); 3793 // homogenise the ideal i with the first not yet used variable in our ring, since gfan 3793 // homogenise the ideal i with the first not yet used variable in our ring, since gfan 3794 3794 // only handles homogenous ideals; in principle for this one has first to compute a 3795 // standard basis of i and homogenise that, but for the tropical variety (says Anders) 3795 // standard basis of i and homogenise that, but for the tropical variety (says Anders) 3796 3796 // it suffices to homogenise an arbitrary system of generators 3797 // i=groebner(i); 3797 // i=groebner(i); 3798 3798 i=homog(i,maxideal(1)[nvars(PREGFANRING)+1]); 3799 3799 // if gfan version >= 0.3.0 is used and the characteristic … … 3804 3804 ringvariablen=ringvariablen[1..2*nvars(PREGFANRING)+1]; 3805 3805 write(":w /tmp/gfaninput","Z/"+string(char(GFANRING))+"Z["+ringvariablen+"]"); 3806 // write the ideal to a file which gfan takes as input and call gfan 3806 // write the ideal to a file which gfan takes as input and call gfan 3807 3807 write(":a /tmp/gfaninput","{"+string(i)+"}"); 3808 3808 } 3809 else 3810 { 3811 // write the ideal to a file which gfan takes as input and call gfan 3809 else 3810 { 3811 // write the ideal to a file which gfan takes as input and call gfan 3812 3812 write(":w /tmp/gfaninput","{"+string(i)+"}"); 3813 3813 } … … 3840 3840 ~ 3841 3841 // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY THE TROPICAL PREVARIETY 3842 // test, if wneu really is in the tropical variety 3842 // test, if wneu really is in the tropical variety 3843 3843 while (goon==0) 3844 3844 { … … 3873 3873 // if all variables were deleted, then i=0 and thus anzahlvariablen==0 3874 3874 if ((ordnung>1) and (anzahlvariablen>1)) 3875 { 3875 { 3876 3876 // we call the procedure with the transformed ideal i, the new weight vector, with the 3877 3877 // required order lowered by one, and with additional parameters, namely the number of … … 3884 3884 string PARAm=PARALIST[3]; 3885 3885 setring PARARing; 3886 // if some variables have been eliminated in before, then we have to insert zeros 3886 // if some variables have been eliminated in before, then we have to insert zeros 3887 3887 // into the parametrisation for those variables 3888 3888 if (numberdeletedvariables>0) … … 3912 3912 int tweight=tw[1]; 3913 3913 // if additional variables were necessary, we introduce them now as parameters; 3914 // in any case the parametrisation ring will have only one variable, namely t, 3914 // in any case the parametrisation ring will have only one variable, namely t, 3915 3915 // and its order will be local, so that it displays the lowest term in t first 3916 3916 if (anzahlvariablen+numberdeletedvariables<nvars(basering)) … … 3933 3933 list a=imap(BASERING,a); 3934 3934 if (defined(wneu)==0) // when tropicalparametriseNoabs is called for the last time, it does not 3935 { // enter the part, where wneu is defined and the variable t should have 3935 { // enter the part, where wneu is defined and the variable t should have 3936 3936 intvec wneu=1; // weight 1 3937 3937 } … … 3945 3945 // note, if all variables were deleted, then i==0 and thus testaufnull==0 3946 3946 if ((ordnung==1) or (anzahlvariablen==1)) 3947 { 3947 { 3948 3948 export(PARA); 3949 3949 } 3950 3950 // kill the gfan files in /tmp 3951 system("sh","cd /tmp; /bin/rm gfaninput; /bin/rm gfanoutput"); 3951 system("sh","cd /tmp; /bin/rm gfaninput; /bin/rm gfanoutput"); 3952 3952 // we return a list which contains the parametrisation ring (with the parametrisation ideal) 3953 3953 // and the string representing the maximal ideal describing the necessary field extension … … 3957 3957 static proc findzeros (ideal i,intvec w,list #) 3958 3958 "USAGE: findzeros(i,w[,#]); i ideal, w intvec, # an optional list 3959 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_n+1,...,X_m] and w=(w_0,...,w_n,0,...,0) 3959 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_n+1,...,X_m] and w=(w_0,...,w_n,0,...,0) 3960 3960 is in the tropical variety of i 3961 RETURN: list, l[1] = is polynomial ring containing an associated maximal ideal m of the winitial 3961 RETURN: list, l[1] = is polynomial ring containing an associated maximal ideal m of the winitial 3962 3962 ideal of i which does not contain any monomial and where the variables 3963 3963 which do not lead to a field extension have already been eliminated, … … 3969 3969 been eliminated 3970 3970 NOTE: the procedure is called from inside the recursive procedure tropicalparametriseNoabs; 3971 if it is called in the first recursion, the list #[1] contains the tinitial ideal 3972 of i w.r.t. w, otherwise #[1] is an integer, one more than the number of true 3971 if it is called in the first recursion, the list #[1] contains the tinitial ideal 3972 of i w.r.t. w, otherwise #[1] is an integer, one more than the number of true 3973 3973 variables x_1,...,x_n" 3974 3974 { 3975 def BASERING=basering; 3975 def BASERING=basering; 3976 3976 // set anzahlvariablen to the number of true variables 3977 3977 if (typeof(#[1])=="int") … … 3990 3990 ideal variablen; 3991 3991 for (int j=1;j<=nvars(basering)1;j++) 3992 { 3992 { 3993 3993 variablen=variablen+var(j); 3994 3994 } … … 4002 4002 intvec neuevariablen=maximalideals[1][3]; // the information which variable leads to a new one 4003 4003 list a=maximalideals[1][4]; // a_k is the kth component of a zero of m, if it is not zero 4004 // eliminate from m the superflous variables, that is those ones, which do not lead to 4004 // eliminate from m the superflous variables, that is those ones, which do not lead to 4005 4005 // a new variable 4006 4006 poly elimvars=1; … … 4012 4012 } 4013 4013 } 4014 m=eliminate(m,elimvars); 4015 export(a); 4014 m=eliminate(m,elimvars); 4015 export(a); 4016 4016 export(m); 4017 4017 list m_ring=INITIALRING,neuvar,neuevariablen; … … 4023 4023 static proc basictransformideal (ideal i,intvec w,list m_ring,list #) 4024 4024 "USAGE: basictransformideal(i,w,m_ring[,#]); i ideal, w intvec, m_ring list, # an optional list 4025 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], w=(w_0,...,w_n,0,...,0) 4025 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], w=(w_0,...,w_n,0,...,0) 4026 4026 is in the tropical variety of i, and m_ring contains a ring containing a maximal ideal m needed 4027 4027 to describe the field extension over which a corresponding associated maximal ideal of the … … 4034 4034 or l[1] = ring which contains the ideals i and m, and the list a 4035 4035 NOTE: the procedure is called from inside the recursive procedure tropicalparametriseNoabs; 4036 if it is called in the first recursion, the list # is empty, 4036 if it is called in the first recursion, the list # is empty, 4037 4037 otherwise #[1] is an integer, the number of true variables x_1,...,x_n; 4038 4038 during the procedure we check if a field extension is necessary to express 4039 4039 a zero (a_1,...,a_n) of m; if so, we have to introduce new variables and 4040 4040 a list containing a ring is returned, otherwise the list containing i, a and m 4041 is returned; 4041 is returned; 4042 4042 the ideal m will be changed during the procedure since all variables which reduce 4043 4043 to a polynomial in X_1,...,X_k modulo m will be eliminated, while the others are … … 4083 4083 // map i into the new ring 4084 4084 ideal i=imap(BASERING,i); 4085 // define a map phi which maps the true variables, which are not 4085 // define a map phi which maps the true variables, which are not 4086 4086 // reduced to polynomials in the additional variables modulo m, to 4087 // the corresponding newly introduced variables, and which maps 4087 // the corresponding newly introduced variables, and which maps 4088 4088 // the old additional variables to themselves 4089 4089 ideal phiideal; … … 4098 4098 else 4099 4099 { 4100 phiideal[j1]=0; 4100 phiideal[j1]=0; 4101 4101 } 4102 4102 } … … 4105 4105 phiideal=phiideal,X(1..nvars(BASERING)anzahlvariablen); 4106 4106 } 4107 map phi=MRING,phiideal; 4107 map phi=MRING,phiideal; 4108 4108 // map m and a to the new ring via phi, so that the true variables in m and a are replaced by 4109 4109 // the corresponding newly introduced variables … … 4115 4115 // moreover, substitute right away in the ideal i the true variable x_j by (a_j+x_j)*t^w_j 4116 4116 zaehler=nvars(BASERING)anzahlvariablen+1; 4117 for (j=1;j<=anzahlvariablen;j++) 4117 for (j=1;j<=anzahlvariablen;j++) 4118 4118 { 4119 4119 if ((a[j]==0) and (j!=1)) // a[1]=0, since t>t^w_0 4120 { 4120 { 4121 4121 a[j]=X(zaehler); 4122 4122 zaehler++; … … 4125 4125 { 4126 4126 if (j!=1) // corresponds to x_(j1)  note t is the last variable 4127 { 4127 { 4128 4128 i[k]=substitute(i[k],var(j1),(a[j]+var(j1))*t^(w[j])); 4129 4129 } … … 4138 4138 { 4139 4139 if (wdegs[j]<0) // if wdegs[j]==0 there is no need to divide, and we made sure that it is no positive 4140 { 4140 { 4141 4141 i[j]=i[j]/t^(wdegs[j]); 4142 4142 } … … 4164 4164 static proc testw (ideal i,intvec w,int anzahlvariablen,list #) 4165 4165 "USAGE: testw(i,w,n); i ideal, w intvec, n number 4166 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k] and w=(w_0,...,w_n,0,...,0) 4166 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k] and w=(w_0,...,w_n,0,...,0) 4167 4167 RETURN: int b, 0 if the tinitial ideal of i considered in Q(X_1,...,X_k)[t,x_1,...,x_n] 4168 4168 is monomial free, 1 else … … 4179 4179 ideal tin=tInitialIdeal(i,w,1); 4180 4180 } 4181 4181 4182 4182 int j; 4183 4183 ideal variablen; … … 4211 4211 def BASERING=basering; 4212 4212 if (anzahlvariablen<nvars(basering)) 4213 { 4213 { 4214 4214 execute("ring TINRING=("+charstr(basering)+","+string(Parameter)+"),("+string(variablen)+"),dp;"); 4215 4215 } … … 4221 4221 poly monom=imap(BASERING,monom); 4222 4222 return(radicalMemberShip(monom,tin)); 4223 } 4223 } 4224 4224 4225 4225 static proc simplifyToOrder (poly f) 4226 4226 "USAGE: simplifyToOrder(f); f a polynomial 4227 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 4227 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 4228 4228 RETURN: list, l[1] = torder of leading term of f 4229 4229 l[2] = the rational coefficient of the term of lowest torder … … 4246 4246 static proc scalarproduct (intvec w,intvec v) 4247 4247 "USAGE: scalarproduct(w,v); w,v intvec 4248 ASSUME: w and v are integer vectors of the same length 4248 ASSUME: w and v are integer vectors of the same length 4249 4249 RETURN: int, the scalarproduct of v and w 4250 4250 NOTE: the procedure is called by tropicalparametriseNoabs" … … 4304 4304 l[j][3] = intvec, if for the kth variable a new variable is needed to 4305 4305 define the corresponding zero of l[j][1], then the k+1st entry is one 4306 l[j][4] = list, if for the kth variable no new variable is needed to 4306 l[j][4] = list, if for the kth variable no new variable is needed to 4307 4307 define the corresponding zero of l[j][1], then its value is the k+1st entry 4308 4308 NOTE: if a maximal ideal contains a variable, it is removed from the list; … … 4320 4320 intvec testvariablen; // integer vector of length n=number of variables 4321 4321 // compute for each maximal ideal the number of new variables, which are needed to describe 4322 // its zeros  note, a new variable is needed if modulo the maximal ideal it does not reduce 4322 // its zeros  note, a new variable is needed if modulo the maximal ideal it does not reduce 4323 4323 // to something which only depends on the following variables; 4324 // if no new variable is needed, then store the value a variable reduces to in the list a; 4324 // if no new variable is needed, then store the value a variable reduces to in the list a; 4325 4325 for (j=size(minassi);j>=1;j) 4326 4326 { … … 4341 4341 { 4342 4342 if (l<=k) 4343 { 4343 { 4344 4344 testvariablen[l]=1; 4345 4345 } … … 4357 4357 a[k+1]=nf; // a_k is the normal form of the kth variable modulo m 4358 4358 neuevariablen[k+1]=0; // no new variable is needed 4359 } 4359 } 4360 4360 else 4361 4361 { … … 4367 4367 // if the maximal ideal contains a variable, we simply delete it 4368 4368 if (pruefer==0) 4369 { 4369 { 4370 4370 minassisort[j]=list(minassi[j],neuvar,neuevariablen,a); 4371 4371 } … … 4384 4384 l=j; 4385 4385 for (k=j1;k>=1;k) 4386 { 4386 { 4387 4387 if (minassisort[l][2]<minassisort[k][2]) 4388 4388 { … … 4400 4400 "USAGE: displaypoly(p,N,wj,w1); p poly, N, wj, w1 int 4401 4401 ASSUME: p is a polynomial in r=(0,X(1..k)),t,ls 4402 RETURN: string, the string of t^wj/w1*p(t^1/N) 4402 RETURN: string, the string of t^wj/w1*p(t^1/N) 4403 4403 NOTE: the procedure is called from displayTropicalLifting" 4404 4404 { … … 4418 4418 { 4419 4419 if (koeffizienten[jord(p)+1]!=0) 4420 { 4420 { 4421 4421 if ((j(N*wj)/w1)==0) 4422 4422 { … … 4534 4534 "USAGE: tropicalliftingresubstitute(i,L,N[,#]); i ideal, L list, N int, # string 4535 4535 ASSUME: i is an ideal and L[1] is a ring which contains the lifting of a point in the 4536 tropical variety of i computed with tropicalLifting; 4537 t has to be replaced by t^1/N in the lifting; #[1]=m is the string of the maximal 4536 tropical variety of i computed with tropicalLifting; 4537 t has to be replaced by t^1/N in the lifting; #[1]=m is the string of the maximal 4538 4538 ideal defining the necessary field extension as computed by tropicalLifting, 4539 4539 if #[1] is present … … 4559 4559 ideal i=imap(BASERING,i); 4560 4560 } 4561 } 4561 } 4562 4562 else 4563 4563 { … … 4588 4588 for (j=1;j<=ncols(i);j++) 4589 4589 { 4590 SUBSTTEST[j]=displaypoly(i[j],N,0,1); 4590 SUBSTTEST[j]=displaypoly(i[j],N,0,1); 4591 4591 } 4592 4592 return(SUBSTTEST); … … 4598 4598 ///  eliminatecomponents 4599 4599 ///  findzerosAndBasictransform 4600 ///  ordermaximalideals 4600 ///  ordermaximalideals 4601 4601 //////////////////////////////////////////////////////////////////////////////////// 4602 4602 4603 4603 static proc tropicalparametrise (ideal i,intvec ww,int ordnung,int gfanold,int findall,int nogfan,list #) 4604 4604 "USAGE: tropicalparametrise(i,tw,ord,gf,fa,ng[,#]); i ideal, tw intvec, ord int, gf,fa,ng int, # opt. list 4605 ASSUME:  i is an ideal in Q[t,x_1,...,x_n,@a], tw=(w_0,w_1,...,w_n,0) 4606 and (w_0,...,w_n,0) is in the tropical variety of i, 4607 and ord is the order up to which a point in V(i) over K{{t}} lying over w shall be computed; 4605 ASSUME:  i is an ideal in Q[t,x_1,...,x_n,@a], tw=(w_0,w_1,...,w_n,0) 4606 and (w_0,...,w_n,0) is in the tropical variety of i, 4607 and ord is the order up to which a point in V(i) over K{{t}} lying over w shall be computed; 4608 4608  moreover, @a should be not be there if the procedure is not called recursively; 4609 4609  the point in the tropical variety is supposed to lie in the NEGATIVE orthant; 4610 4610  the ideal is zerodimensional when considered in (K(t)[@a]/m)[x_1,...,x_n], 4611 where m=#[2] is a maximal ideal in K[@a]; 4611 where m=#[2] is a maximal ideal in K[@a]; 4612 4612  gf is 0 if version 2.2 or larger is used and it is 1 else 4613 4613  fa is 1 if all solutions should be found … … 4616 4616 l[2] = int 4617 4617 NOTE:  the procedure is also called recursively by itself, and 4618 if it is called in the first recursion, the list # is empty, 4618 if it is called in the first recursion, the list # is empty, 4619 4619 otherwise #[1] is an integer, one more than the number of true variables x_1,...,x_n, 4620 4620 and #[2] will contain the maximal ideal m in the variable @a … … 4651 4651 int anzahlvariablen=nvars(basering); 4652 4652 list zerolist; // will carry the zeros which are computed in the recursion steps 4653 4653 4654 4654 // the initial ideal of i has been handed over as #[1] 4655 4655 ideal ini=#[1]; … … 4660 4660 } 4661 4661 list wneulist; // carries all newly computed weight vector 4662 intvec wneu; // carries the newly computed weight vector 4662 intvec wneu; // carries the newly computed weight vector 4663 4663 int tweight; // carries the weight of t 4664 4664 list PARALIST; // carries the result when tropicalparametrise is recursively called … … 4695 4695 { 4696 4696 if (nogfan!=1) 4697 { 4697 { 4698 4698 // pass to a ring which has variables which are suitable for gfan 4699 4699 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;"); 4700 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; 4700 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; 4701 4701 phiideal[nvars(PREGFANRING)]=a; // map t to a 4702 map phi=PREGFANRING,phiideal; 4702 map phi=PREGFANRING,phiideal; 4703 4703 ideal II=phi(i); 4704 // homogenise the ideal II with the first not yet used variable in our ring, since gfan 4704 // homogenise the ideal II with the first not yet used variable in our ring, since gfan 4705 4705 // only handles homogenous ideals; in principle for this one has first to compute a 4706 // standard basis of II and homogenise that, but for the tropical variety (says Anders) 4706 // standard basis of II and homogenise that, but for the tropical variety (says Anders) 4707 4707 // it suffices to homogenise an arbitrary system of generators 4708 // II=groebner(II); 4708 // II=groebner(II); 4709 4709 II=homog(II,maxideal(1)[nvars(PREGFANRING)+1]); 4710 4710 // if gfan version >= 0.3.0 is used and the characteristic … … 4751 4751 ~ 4752 4752 // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY THE TROPICAL PREVARIETY 4753 // test, if wneu really is in the tropical variety 4753 // test, if wneu really is in the tropical variety 4754 4754 while (goon==0) 4755 4755 { … … 4796 4796 lll=0; 4797 4797 if ((ordnung>1) and (anzahlvariablen>1)) 4798 { 4798 { 4799 4799 partliftings=list(); // initialise partliftings 4800 4800 // we call the procedure with the transformed ideal i, the new weight vector, with the … … 4808 4808 // the maximal ideal that describes the necessary field extension 4809 4809 for (ll=1;ll<=size(PARALIST);ll++) 4810 { 4810 { 4811 4811 def PARARing=PARALIST[ll][1]; 4812 4812 tweight=ww[1]*PARALIST[ll][2]; 4813 4813 setring PARARing; 4814 // if some variables have been eliminated in before, then we have to insert zeros 4814 // if some variables have been eliminated in before, then we have to insert zeros 4815 4815 // into the parametrisation for those variables 4816 4816 if (numberdeletedvariables>0) … … 4844 4844 tweight=ww[1]; 4845 4845 // if additional variables were necessary, we introduce them now as parameters; 4846 // in any case the parametrisation ring will have only one variable, namely t, 4846 // in any case the parametrisation ring will have only one variable, namely t, 4847 4847 // and its order will be local, so that it displays the lowest term in t first 4848 4848 if (anzahlvariablen<nvars(basering)) … … 4872 4872 { 4873 4873 if (size(partliftings[lll])==2) // when tropicalparametrise is called for the last time, it does not 4874 { // enter the part, where wneu is defined and the variable t should have 4874 { // enter the part, where wneu is defined and the variable t should have 4875 4875 wneu=1; // weight 1 4876 4876 } … … 4904 4904 } 4905 4905 // kill the gfan files in /tmp 4906 system("sh","cd /tmp; /bin/rm gfaninput; /bin/rm gfanoutput"); 4906 system("sh","cd /tmp; /bin/rm gfaninput; /bin/rm gfanoutput"); 4907 4907 // we return a list which contains lists of the parametrisation rings (with the parametrisation ideal) 4908 4908 // and an integer N such that t should be replaced by t^1/N … … 4912 4912 static proc eliminatecomponents (ideal i,ideal m,int anzahlvariablen,int findall,int lastvar,intvec deletedvariables) 4913 4913 "USAGE: eliminatecomponents(i,m,n,a,v,d); i,m ideal, n,a,v int, d intvec 4914 ASSUME: i is an ideal in Q[x_1,...,x_n,@a,t] and w=(w_1/w_0,...,w_n/w_0) 4915 is in the tropical variety of i considered in Q[@a]/m{{t}}[x_1,...,x_n]; 4916 considered in this ring i is zerodimensional; @a need not be present 4914 ASSUME: i is an ideal in Q[x_1,...,x_n,@a,t] and w=(w_1/w_0,...,w_n/w_0) 4915 is in the tropical variety of i considered in Q[@a]/m{{t}}[x_1,...,x_n]; 4916 considered in this ring i is zerodimensional; @a need not be present 4917 4917 in which case m is zero; 1<=v<=n 4918 4918 RETURN: list, L of lists … … 4922 4922 NOTE:  the procedure is called from inside the recursive procedure tropicalparametrise 4923 4923  the procedure checks for solutions which have certain components zero; these are 4924 separated from the rest by elimination and saturation; the integer deletedvariables 4924 separated from the rest by elimination and saturation; the integer deletedvariables 4925 4925 records which variables have been eliminated; the integer anzahlvariablen records how 4926 4926 many true variables remain after the elimination … … 4933 4933 // if all solutions have to be found 4934 4934 if (findall==1) 4935 { 4935 { 4936 4936 list saturatelist,eliminatelist; // carry the solution of the two tests 4937 // we test first if there is a solution which has the component lastvar zero and 4937 // we test first if there is a solution which has the component lastvar zero and 4938 4938 // where the order of each component is strictly positive; 4939 4939 // if so, we add this variable to the ideal and eliminate it  which amounts to 4940 4940 // to projecting the solutions with this component zero to the hyperplane without this component; 4941 4941 // for the test we compute the saturation with respect to t and replace each variable 4942 // x_i and also t by zero  if the result is zero, then 1 is not in I:t^infty 4942 // x_i and also t by zero  if the result is zero, then 1 is not in I:t^infty 4943 4943 // (i.e. there is a solution which has the component lastvar zero) and 4944 // the result lives in the maximal ideal <t,x_1,...,[no x_lastvar],...,x_n> so that 4944 // the result lives in the maximal ideal <t,x_1,...,[no x_lastvar],...,x_n> so that 4945 4945 // there is a solution which has strictly positive valuation 4946 4946 /* … … 4954 4954 // equal to zero then this component has a valuation with all strictly positive values!!!!; 4955 4955 // for this we can either saturate the ideal after elimination with respect to <t,x_1,...,x_n> 4956 // and see if the saturated ideal is contained in <t,x_1,...x_n>+m, 4956 // and see if the saturated ideal is contained in <t,x_1,...x_n>+m, 4957 4957 // or ALTERNATIVELY we can pass to the ring 0,(t,x_1,...,x_n,@a),(ds(n+1),dp(1)), 4958 4958 // compute a standard basis of the elimination ideal (plus m) there and check if the dimension 1 … … 4989 4989 { 4990 4990 string elring="ring ELIMINATERING=("+charstr(basering)+"),("+string(simplify(reduce(maxideal(1),std(var(lastvar))),2))+"),("; 4991 } 4991 } 4992 4992 if (anzahlvariablen<nvars(basering)) // if @a was present, the ordersting needs an additional entry 4993 4993 { … … 4995 4995 } 4996 4996 elring=elring+"lp(1));"; 4997 execute(elring); 4997 execute(elring); 4998 4998 ideal i=imap(BASERING,I); // move the ideal I to the new ring 4999 4999 // if not yet all variables have been checked, then go on with the next smaller variable, … … 5011 5011 } 5012 5012 // next we have to test if there is also a solution which has the variable lastvar nonzero; 5013 // to do so, we saturate with respect to this variable; since when considered over K{{t}} 5013 // to do so, we saturate with respect to this variable; since when considered over K{{t}} 5014 5014 // the ideal is zero dimensional, this really removes all solutions with that component zero; 5015 5015 // the checking is then done as above 5016 5016 i=std(sat(i,var(lastvar))[1]); 5017 5017 I=reduce(i,std(m)); // "remove" m from i 5018 // test first, if i still is in the ideal <t,x_1,...,x_n>  if not, then 5018 // test first, if i still is in the ideal <t,x_1,...,x_n>  if not, then 5019 5019 // we know that i has no longer a point in the tropical variety with all components negative 5020 5020 LI=subst(I,var(nvars(basering)),0); … … 5024 5024 } 5025 5025 if (size(LI)==0) // the entries of i have not constant part 5026 { 5026 { 5027 5027 // check now, if the leading ideal of i contains an element which only depends on t 5028 5028 LI=lead(I); … … 5040 5040 } 5041 5041 else 5042 { 5042 { 5043 5043 execute("ring SATURATERING=("+charstr(basering)+"),("+varstr(basering)+"),("+ordstr(basering)+");"); 5044 5044 ideal i=imap(BASERING,i); … … 5069 5069 if (size(LI)==0) // if no power of t is in lead(I) (where the X(i) are considered as field elements) 5070 5070 { 5071 // get rid of var(j) 5071 // get rid of var(j) 5072 5072 i=eliminate(I,var(j)); 5073 5073 deletedvariables[j]=1; … … 5086 5086 } 5087 5087 // if there are variables left, then pass to a ring which only realises these variables 5088 // else we are done 5088 // else we are done 5089 5089 if (anzahlvariablen>1) 5090 5090 { … … 5094 5094 { 5095 5095 string elring="ring ELIMINATERING=("+charstr(basering)+"),("+string(variablen)+"),("; 5096 } 5096 } 5097 5097 if (size(deletedvariables)+1<nvars(basering)) // if @a was present, the ordersting needs an additional entry 5098 5098 { … … 5100 5100 } 5101 5101 elring=elring+"lp(1));"; 5102 execute(elring); 5102 execute(elring); 5103 5103 ideal i=imap(BASERING,i); 5104 5104 ideal m=imap(BASERING,m); … … 5111 5111 static proc findzerosAndBasictransform (ideal i,intvec w,list zerolist,int findall,list #) 5112 5112 "USAGE: findzerosAndBasictransform(i,w,z,f[,#]); i ideal, w intvec, z list, f int,# an optional list 5113 ASSUME: i is an ideal in Q[t,x_1,...,x_n,@a] and w=(w_0,...,w_n,0) 5113 ASSUME: i is an ideal in Q[t,x_1,...,x_n,@a] and w=(w_0,...,w_n,0) 5114 5114 is in the tropical variety of i; @a need not be present; 5115 5115 the list 'zero' contains the zeros computed in previous recursion steps; … … 5125 5125 list zero = zero[k+1] is the kth component of a zero the tinitial ideal of i 5126 5126 NOTE:  the procedure is called from inside the recursive procedure tropicalparametrise; 5127 if it is called in the first recursion, the list #[1] contains the tinitial ideal 5128 of i w.r.t. w, otherwise #[1] is an integer, one more than the number of true 5127 if it is called in the first recursion, the list #[1] contains the tinitial ideal 5128 of i w.r.t. w, otherwise #[1] is an integer, one more than the number of true 5129 5129 variables x_1,...,x_n 5130 5130  if #[2] is present, then it is an integer which tells whether ALL zeros should be … … 5154 5154 int anzahlvariablen=nvars(basering); 5155 5155 ideal ini=#[1]; // the tinitial ideal has been computed in before and was handed over 5156 } 5156 } 5157 5157 // collect the true variables x_1,...,x_n plus @a, if it is defined in BASERING 5158 5158 ideal variablen; 5159 5159 for (j=1;j<=nvars(basering)1;j++) 5160 { 5160 { 5161 5161 variablen=variablen+var(j); 5162 5162 } … … 5187 5187 // phi maps x_i to x_i, @a to @a (if present in the ring), and the additional variable 5188 5188 // for the field extension is mapped to @a as well  note that we only apply phi 5189 // to the list a, and in this list no @a is present; therefore, it does not matter 5189 // to the list a, and in this list no @a is present; therefore, it does not matter 5190 5190 // where this is mapped to 5191 5191 map phi=ABSRING,imap(BASERING,variablen),@a; … … 5197 5197 // for the field extension is mapped to @a as well respectively to 0, if no @a is present; 5198 5198 // note that we only apply phi to the list a and to the replacement rule for 5199 // the old variable @a, and in this list resp. replacement rule no @a is present; 5199 // the old variable @a, and in this list resp. replacement rule no @a is present; 5200 5200 // therefore, it does not matter where this is mapped to; 5201 5201 if (anzahlvariablen<nvars(EXTENSIONRING)) // @a is in EXTENSIONRING 5202 { 5202 { 5203 5203 map phi=ABSRING,imap(BASERING,variablen),@a; // additional variable is mapped to @a 5204 5204 } … … 5212 5212 poly m=maximalideals[j][1]; // extract m 5213 5213 list zeroneu=maximalideals[j][2]; // extract the new zero 5214 poly repl=maximalideals[j][3]; // extract the replacement rule 5214 poly repl=maximalideals[j][3]; // extract the replacement rule 5215 5215 // the list zero may very well exist as an EMPTY global list  in this case we have to remove it 5216 5216 // in order to avoid a redefining warning 5217 if (defined(zero)!=0) 5217 if (defined(zero)!=0) 5218 5218 { 5219 5219 if (size(zero)==0) … … 5227 5227 ideal i=imap(BASERING,i); 5228 5228 if (defined(zerolist)==0) // if zerolist is empty, it does not depend on BASERING ! 5229 { 5229 { 5230 5230 list zero=imap(BASERING,zerolist); 5231 5231 } 5232 else 5232 else 5233 5233 { 5234 5234 list zero=zerolist; 5235 5235 } 5236 5236 } 5237 else // in BASERING was @a present 5237 else // in BASERING was @a present 5238 5238 { 5239 5239 ideal variablen=imap(BASERING,variablen); … … 5247 5247 zero[size(zero)+1]=zeroneu; 5248 5248 // do now the basic transformation sending x_l > t^w_l*(zero_l+x_l) 5249 for (l=1;l<=anzahlvariablen;l++) 5249 for (l=1;l<=anzahlvariablen;l++) 5250 5250 { 5251 5251 for (k=1;k<=size(i);k++) 5252 5252 { 5253 5253 if (l!=1) // corresponds to x_(l1)  note t is the last variable 5254 { 5254 { 5255 5255 i[k]=substitute(i[k],var(l1),(zeroneu[l]+var(l1))*t^(w[l])); 5256 5256 } … … 5265 5265 { 5266 5266 if (wdegs[l]<0) // if wdegs[l]==0 there is no need to divide, and we made sure that it is no positive 5267 { 5267 { 5268 5268 i[l]=i[l]/t^(wdegs[l]); 5269 5269 } … … 5276 5276 export(i); 5277 5277 export(m); 5278 export(zero); 5278 export(zero); 5279 5279 extensionringlist[j]=EXTENSIONRING; 5280 5280 kill EXTENSIONRING; … … 5290 5290 polynomial of the last variable in the ring which is considered as a parameter 5291 5291 RETURN: list, the procedure orders the maximal ideals in minassi according to how many new 5292 variables are needed (namely none or one) to describe the zeros of the ideal, 5292 variables are needed (namely none or one) to describe the zeros of the ideal, 5293 5293 and accordingly to the degree of the corresponding minimal polynomial 5294 5294 l[j][1] = the minimal polynomial for the jth maximal ideal 5295 l[j][2] = list, the k+1st entry is the kth coordinate of the zero 5295 l[j][2] = list, the k+1st entry is the kth coordinate of the zero 5296 5296 described by the maximal ideal in terms of the last variable 5297 l[j][3] = poly, the replacement for the old variable @a 5297 l[j][3] = poly, the replacement for the old variable @a 5298 5298 NOTE: if a maximal ideal contains a variable, it is removed from the list; 5299 5299 the procedure is called by findzerosAndBasictransform" … … 5306 5306 list zero; // (a_1,...,a_n)=(zero[2],...,zero[n+1]) will be a common zero of the ideal m 5307 5307 poly nf; // normalform of a variable w.r.t. m 5308 poly minimalpolynomial; // minimal polynomial for the field extension 5308 poly minimalpolynomial; // minimal polynomial for the field extension 5309 5309 poly parrep; // the old variable @a possibly has to be replaced by a new one 5310 5310 // compute for each maximal ideal the number of new variables, which are needed to describe 5311 5311 // its zeros  note, a new variable is needed if the first entry of minassi[j][1] is not the last variable 5312 // store the value a variable reduces to in the list a; 5312 // store the value a variable reduces to in the list a; 5313 5313 for (j=size(minassi);j>=1;j) 5314 5314 { … … 5337 5337 // if the maximal ideal contains a variable, we simply delete it 5338 5338 if (pruefer==0) 5339 { 5339 { 5340 5340 minassisort[j]=list(minimalpolynomial,zero,parrep); 5341 5341 } … … 5354 5354 l=j; 5355 5355 for (k=j1;k>=1;k) 5356 { 5356 { 5357 5357 if (deg(minassisort[l][1])<deg(minassisort[k][1])) 5358 5358 { … … 5393 5393 l[i][2] = ycoordinate of the ith vertex 5394 5394 l[i][3] = a polynomial whose monimials mark the vertices in the Newton polygon 5395 corresponding to the entries in tp which take the common minimum 5395 corresponding to the entries in tp which take the common minimum 5396 5396 at the ith vertex 5397 NOTE:  the information in l[i][3] represents the subdivision of the Newton polygon of tp 5398 (respectively a polynomial which defines tp); 5399  if # is nonempty and #[1] is the string 'max', then in the computations minimum and 5400 maximum are exchanged; 5401  if # is nonempty and the #[1] is not a string, only the vertices will be computed 5397 NOTE:  the information in l[i][3] represents the subdivision of the Newton polygon of tp 5398 (respectively a polynomial which defines tp); 5399  if # is nonempty and #[1] is the string 'max', then in the computations minimum and 5400 maximum are exchanged; 5401  if # is nonempty and the #[1] is not a string, only the vertices will be computed 5402 5402 and the information on the Newton subdivision will be omitted; 5403 5403  here the tropical polynomial is supposed to be the MINIMUM of the linear forms in tp, … … 5406 5406 { 5407 5407 // if you insert a single polynomial instead of an ideal representing a tropicalised polynomial, 5408 // then we compute first the tropicalisation of this polynomial  this feature is not 5408 // then we compute first the tropicalisation of this polynomial  this feature is not 5409 5409 // documented in the above help string 5410 5410 if (typeof(tp)=="poly") … … 5485 5485 e++; 5486 5486 } 5487 } 5487 } 5488 5488 } 5489 5489 } … … 5511 5511 RETURN: list, see the procedure tropicalCurve for an explanation of the syntax of this list 5512 5512 NOTE:  the tropical curve defined by tp will consist of a bunch of parallel lines and 5513 throughout the procedure a list with the name bunchoflines is computed, which 5513 throughout the procedure a list with the name bunchoflines is computed, which 5514 5514 represents these lines and has the following interpretation: 5515 5515 list, each entry corresponds to a vertex in the tropical plane curve defined by tp 5516 5516 l[i][1] = the equation of the ith line in the tropical curve 5517 5517 l[i][2] = a polynomial whose monimials mark the vertices in the Newton polygon 5518 corresponding to the entries in tp which take the common minimum 5518 corresponding to the entries in tp which take the common minimum 5519 5519 at the ith vertex 5520  the information in l[i][2] represents the subdivision of the Newton polygon of tp 5521 (respectively a polynomial which defines tp); 5522  if # is nonempty and #[1] is the string 'max', then in the computations minimum and 5523 maximum are exchanged; 5524  if # is nonempty and the #[1] is not a string, only the vertices will be computed 5520  the information in l[i][2] represents the subdivision of the Newton polygon of tp 5521 (respectively a polynomial which defines tp); 5522  if # is nonempty and #[1] is the string 'max', then in the computations minimum and 5523 maximum are exchanged; 5524  if # is nonempty and the #[1] is not a string, only the vertices will be computed 5525 5525 and the information on the Newton subdivision will be omitted; 5526 5526  here the tropical polynomial is supposed to be the MINIMUM of the linear forms in tp, … … 5571 5571 { 5572 5572 vergleich=substitute(tp[l],var(1),px); 5573 if (vergleich==wert) 5573 if (vergleich==wert) 5574 5574 { 5575 5575 newton=newton+detropicalise(oldtp[l]); … … 5582 5582 e++; 5583 5583 } 5584 } 5584 } 5585 5585 } 5586 5586 // if a vertex appears several times, only its first occurence will be kept … … 5589 5589 for (j=i1;j>=1;j) 5590 5590 { 5591 if (bunchoflines[i][1]==bunchoflines[j][1]) 5591 if (bunchoflines[i][1]==bunchoflines[j][1]) 5592 5592 { 5593 5593 bunchoflines=delete(bunchoflines,i); … … 5630 5630 xc=substitute(bunchoflines[i][1]cc,var(2),0,var(1),1); 5631 5631 yc=substitute(bunchoflines[i][1]cc,var(2),1,var(1),0); 5632 5632 if (xc!=0) // then there is a point on the line with ycoordinate zero 5633 5633 { 5634 5634 gr[1]=cc/leadcoef(xc); … … 5650 5650 5651 5651 static proc clearintmat (intmat vv) 5652 "USAGE: clearintmat(vv); vv intmat 5652 "USAGE: clearintmat(vv); vv intmat 5653 5653 ASSUME: all entries of the first column of vv are nonnegative, not all entries are zero 5654 5654 unless vv has only one column 5655 RETURN: intmat, vv has been ordered in an ascending way by the entries of the first row; 5656 if an entry in the first row occurs several times, the entries in the 5655 RETURN: intmat, vv has been ordered in an ascending way by the entries of the first row; 5656 if an entry in the first row occurs several times, the entries in the 5657 5657 second row have been added and only one row has been kept; 5658 5658 colums with a zero in the first row have been removed unless vv has only one … … 5663 5663 for (int i=ncols(vv)1;i>=1;i) 5664 5664 { 5665 if (vv[1,i]==vv[1,i+1]) 5665 if (vv[1,i]==vv[1,i+1]) 5666 5666 { 5667 5667 vv[2,i]=vv[2,i]+vv[2,i+1]; … … 5693 5693 k++; 5694 5694 } 5695 else 5695 else 5696 5696 { 5697 5697 stop=1; … … 5768 5768 { 5769 5769 int m=nrows(M); 5770 5770 5771 5771 } 5772 5772 else … … 5890 5890 return(c); 5891 5891 } 5892 f=fc; 5892 f=fc; 5893 5893 if (k==1) 5894 5894 { 5895 5895 return(substitute(f,var(1),1,var(2),0)); 5896 } 5896 } 5897 5897 else 5898 5898 { 5899 5899 return(substitute(f,var(1),0,var(2),1)); 5900 } 5900 } 5901 5901 } 5902 5902 … … 5983 5983 ASSUME: f is a polynomial in Q[x_1,...,x_n], and # is either empty or #[1] is a positive integer 5984 5984 RETURN: string, a decimal expansion of the leading coefficient of f up to order two respectively #[1] 5985 NOTE: the procedure is called by texDrawTropical and conicWithTangents and 5985 NOTE: the procedure is called by texDrawTropical and conicWithTangents and 5986 5986 f will actually be a number" 5987 5987 { … … 6010 6010 } 6011 6011 for (j=i;j<=i+nachkomma;j++) 6012 { 6012 { 6013 6013 news=news+s[j]; 6014 6014 } … … 6040 6040 } 6041 6041 return(0); 6042 } 6042 } 6043 6043 6044 6044 static proc stringdelete (string w,int i) … … 6054 6054 { 6055 6055 return(""); 6056 6056 6057 6057 } 6058 6058 if (i==1) … … 6109 6109 k=j+2; 6110 6110 while (k<=size(F) and ((F[k]=="0") or (F[k]=="1") or (F[k]=="2") or (F[k]=="3") or 6111 (F[k]=="4") or (F[k]=="5") or (F[k]=="6") or (F[k]=="7") or (F[k]=="8") 6111 (F[k]=="4") or (F[k]=="5") or (F[k]=="6") or (F[k]=="7") or (F[k]=="8") 6112 6112 or (F[k]=="9"))) 6113 6113 { … … 6123 6123 k=j+2; 6124 6124 while (k<=size(F) and ((F[k]=="0") or (F[k]=="1") or (F[k]=="2") or (F[k]=="3") or 6125 (F[k]=="4") or (F[k]=="5") or (F[k]=="6") or (F[k]=="7") or (F[k]=="8") 6125 (F[k]=="4") or (F[k]=="5") or (F[k]=="6") or (F[k]=="7") or (F[k]=="8") 6126 6126 or (F[k]=="9"))) 6127 6127 { … … 6136 6136 F=stringdelete(F,j); 6137 6137 j; 6138 } 6138 } 6139 6139 } 6140 6140 short=altshort; 6141 6141 return(F); 6142 6142 } 6143 6143 6144 6144 static proc texcoefficient (poly f,list #) 6145 6145 "USAGE: texcoefficient(f[,#]); f poly, # optional list … … 6176 6176 } 6177 6177 if (size(koeffizient)>5) 6178 { 6178 { 6179 6179 string tfractest=koeffizient[2..6]; 6180 6180 if (tfractest=="tfrac") … … 6259 6259 static proc coordinatechange (poly f,intmat A,intvec v) 6260 6260 "USAGE: coordinatechange(f,A,v); f poly, A intmat, v intvec 6261 ASSUME: f is a polynomial in two variables, A is a 2x2 6261 ASSUME: f is a polynomial in two variables, A is a 2x2 6262 6262 integer matrix, and v is an integer vector with 2 entries 6263 6263 RETURN: poly, the polynomial transformed by (x,y)>A*(x,y)+v … … 6280 6280 ASSUME: poly is a cubic polynomial 6281 6281 RETURN: poly, the Weierstrass normal form of the cubic, 0 if poly is not a cubic 6282 NOTE:  the algorithm for the coefficients of the Weierstrass form is due to 6282 NOTE:  the algorithm for the coefficients of the Weierstrass form is due to 6283 6283 Fernando Rodriguez Villegas, villegas@math.utexas.edu 6284 6284  if an additional argument # is given, the simplified Weierstrass form … … 6294 6294 poly t0,s1,s0,r2,r1,r0,q3,q2,q1,q0=flatten(coeffs(f,ideal(var(2)^3,var(2)^2,var(2)^2*var(1),var(2),var(2)*var(1),var(2)*var(1)^2,1,var(1),var(1)^2,var(1)^3))); 6295 6295 // test, if f is already in Weierstrass form 6296 if ((t0==0) and (s1==1) and (s0==0) and (r0==0) and (q0==1) )6296 if ((t0==0) and (s1==1) and (s0==0) and (r0==0) and (q0==1) and (size(#)==0)) 6297 6297 { 6298 6298 return (f); … … 6304 6304 poly a4=((3*t0*r0+s0^2)*q1+(3*s1*s0*q0+s1*r0^2))*q3 6305 6305 +(t0*r0*q2^2+(s1*s0*q1+((3*t0*r2+s1^2)*q0+s0*r0*r2))*q2 6306 +(t0*r2*q1^2+s1*r0*r2*q1+s0*r2^2*q0)); 6306 +(t0*r2*q1^2+s1*r0*r2*q1+s0*r2^2*q0)); 6307 6307 poly a6=(27*t0^2*q0^2+(9*t0*s0*r0s0^3)*q0t0*r0^3)*q3^2+ 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6308 (((9*t0^2*q0t0*s0*r0)*q1+((3*t0*s0*r1+(3*t0*s1*r0+ 6309 2*s1*s0^2))*q0+(t0*r0^2*r1s1*s0*r0^2)))*q2+(t0^2*q1^3 6310 +(t0*s0*r1+(2*t0*s1*r0s1*s0^2))*q1^2+((3*t0*s0*r2+ 6311 (3*t0*s1*r1+2*s1^2*s0))*q0+((2*t0*r0^2s0^2*r0)*r2+ 6312 (t0*r0*r1^2+s1*s0*r0*r1s1^2*r0^2)))*q1+((9*t0*s1*r2 6313 s1^3)*q0^2+(((3*t0*r0+s0^2)*r1s1*s0*r0)*r2+(t0*r1^3 6314 s1*s0*r1^2+s1^2*r0*r1))*q0)))*q3+(t0^2*q0*q2^3+ 6315 (t0*s1*r0*q1+((2*t0*s0*r2+(t0*s1*r1s1^2*s0))*q0 6316 t0*r0^2*r2))*q2^2+(t0*s0*r2*q1^2+(t0*s1*r2*q0+ 6317 (t0*r0*r1s1*s0*r0)*r2)*q1+((2*t0*r0s0^2)*r2^2+ 6318 (t0*r1^2+s1*s0*r1s1^2*r0)*r2)*q0)*q2+ 6319 (t0*r0*r2^2*q1^2+(t0*r1s1*s0)*r2^2*q0*q1 6320 6320 t0*r2^3*q0^2)); 6321 6321 poly b2=a1^2+4*a2; … … 6365 6365 i.e. a polynomial of the form a+bx+cx2+dy+exy+fx2y+gy2+hxy2+ix2y2 6366 6366 RETURN: poly, a Weierstrass form of the elliptic curve defined by poly 6367 NOTE:  the algorithm is based on the paper Sang Yook An, Seog Young Kim, 6367 NOTE:  the algorithm is based on the paper Sang Yook An, Seog Young Kim, 6368 6368 David C. Marshall, Susan H. Marshall, William G. McCallum and Alexander R. Perlis: 6369 6369 Jacobians of Genus One Curves. Journal of Number Theory 90,2 (2001), 304315. … … 6388 6388 6389 6389 static proc jInvariantOfACubic (poly f,list #) 6390 "USAGE: jInvariantOfACubic(f[,#]); f poly, # list 6390 "USAGE: jInvariantOfACubic(f[,#]); f poly, # list 6391 6391 ASSUME: poly is a cubic polynomial defining an elliptic curve 6392 6392 RETURN: poly, the jinvariant of the elliptic curve defined by poly … … 6429 6429 6430 6430 static proc jInvariantOfA2x2Curve (poly f,list #) 6431 "USAGE: jInvariantOfA2x2Curve(f[,#]); f poly, # list 6431 "USAGE: jInvariantOfA2x2Curve(f[,#]); f poly, # list 6432 6432 ASSUME: poly, is a polynomial defining an elliptic curve of type (2,2) on P^1xP^1, 6433 6433 i.e. a polynomial of the form a+bx+cx2+dy+exy+fx2y+gy2+hxy2+ix2y2 … … 6475 6475 6476 6476 static proc jInvariantOfA4x2Curve (poly f,list #) 6477 "USAGE: jInvariantOfA4x2Curve(f[,#]); f poly, # list 6477 "USAGE: jInvariantOfA4x2Curve(f[,#]); f poly, # list 6478 6478 ASSUME: poly, is a polynomial defining an elliptic curve of type (4,2), 6479 6479 i.e. a polynomial of the form a+bx+cx2+dx3+ex4+fy+gxy+hx2y+iy2 … … 6515 6515 6516 6516 static proc jInvariantOfAPuiseuxCubic (poly f,list #) 6517 "USAGE: jInvariantOfAPuiseuxCubic(f[,#]); f poly, # list 6517 "USAGE: jInvariantOfAPuiseuxCubic(f[,#]); f poly, # list 6518 6518 ASSUME: poly is a cubic polynomial over Q(t) defining an elliptic curve and # is empty 6519 RETURN: list, containing two polynomials whose ratio is the jinvariant of the 6519 RETURN: list, containing two polynomials whose ratio is the jinvariant of the 6520 6520 elliptic curve defined by poly 6521 6521 ASSUME: poly is a cubic polynomial over Q(t) defining an elliptic curve and # is nonempty … … 6624 6624 // Example 3  the ideal is not zero dimensional 6625 6625 //  6626 ring r1=0,(t,x,y),dp; 6626 ring r1=0,(t,x,y),dp; 6627 6627 poly f=(9t2712t265t25+21t24+35t2351t2240t21+87t20+56t1994t1862t17+92t16+56t1570t1442t13+38t12+28t11+18t1050t948t8+40t7+36t616t512t4+4t2)*x2+(9t24+12t234t2242t20+28t19+30t1820t1754t16+16t15+48t1416t12+8t1118t1026t9+30t8+20t724t6+4t5+28t48t316t2+4)*xy+(6t1610t152t14+16t13+4t1218t1110t10+24t9+6t820t7+8t6+8t520t44t3+12t2+4t4)*y2+(9t28+3t27+8t264t2545t246t23+42t22+30t2194t2040t19+68t18+82t1738t1660t15+26t14+36t1322t1220t11+4t10+4t9+12t8+8t78t68t5+4t4)*x+(9t2721t26+16t25+14t24+12t2361t22+27t21+80t2019t19100t18+26t17+96t1624t1584t14+44t122t1118t10+2t9+40t8+4t732t612t5+4t3+12t24)*y+(9t2712t26+4t25+36t2318t2228t212t20+54t19+14t1852t1744t16+24t15+40t144t1312t12+4t114t104t9+4t8); 6628 6628 f; … … 6810 6810 poly f=t*(x7+y7+1)+1/t*(x4+y4+x2+y2+x3y+xy3)+1/t7*x2y2; 6811 6811 list graph=tropicalCurve(f); 6812 graph; 6812 graph; 6813 6813 size(graph)1; 6814 6814 drawTropicalCurve(graph);
Note: See TracChangeset
for help on using the changeset viewer.