Changeset f9fc81 in git for Singular/LIB/grobcov.lib
- Timestamp:
- Dec 6, 2013, 4:57:24 PM (10 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- f1a309fae2b1e4366fb7ead1dac3f33dbfc042a5
- Parents:
- bdda288ddec3d88538ca426b802f82d49d384caa9e8a6c3b0f4b1814c8ea54b2bf5679f4c3e9591d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/grobcov.lib
r9e8a6c3 rf9fc81 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="version grobcov.lib 4 .0.0.0 Jun_2013 "; // $Id$2 version="version grobcov.lib 4-0-0-0 Dec_2013 "; 3 3 category="General purpose"; 4 4 info=" … … 15 15 The locus algorithm and definitions will be 16 16 published in a forthcoming paper by Abanades, Botana, Montes, Recio: 17 \''Geometrical locus of points using the Groebner cover\''. 18 17 \''An Algebraic Taxonomy for Locus Computation in Dynamic Geometry\''. 19 18 20 19 The central routine is grobcov. Given a parametric … … 69 68 PROCEDURES: 70 69 71 grobcov(F); 72 73 74 75 76 77 cgsdr(F); 78 79 is used in grobcov, but that canbe used80 81 82 83 70 grobcov(F); Is the basic routine giving the canonical 71 Groebner cover of the parametric ideal F. 72 This routine accepts many options, that 73 allow to obtain results even when the canonical 74 computation does not finish in reasonable time. 75 76 cgsdr(F); Is the procedure for obtaining a first disjoint, 77 reduced Comprehensive Groebner System that 78 is used in grobcov, that can also be used 79 independently if only the CGS is required. 80 It is a more efficient routine than buildtree 81 (the own routine that is no more used). It uses 82 now KSW algorithm. 84 83 85 84 setglobalrings(); Generates the global rings @R, @P and @PR that are 86 respectively the rings Q[a][x], Q[a], Q[x,a]. 87 It is called inside each of the fundamental routines 88 of the library: grobcov, cgsdr and killed before 89 the output. 90 If the user want to use some other internal routine, 91 then setglobalrings() is to be called before, as 92 the rings @R, @P and @RP are needed in most of them. 93 globally, and more internal routines can be used, but 94 these rings are killed by the call to any of the 95 basic routines. 96 97 pdivi(f,F); Performs a pseudodivision of a parametric polynomial 98 by a parametric ideal. 85 respectively the rings Q[a][x], Q[a], Q[x,a]. 86 It is called inside each of the fundamental routines 87 of the library: grobcov, cgsdr, locus, locusdg and killed before 88 the output. 89 So, if the user want to use some other internal routine, 90 then setglobalrings() is to be called before, as most of them use 91 these rings. 92 93 pdivi(f,F); Performs a pseudodivision of a parametric polynomial 94 by a parametric ideal. 95 Can be used without calling presiouly setglobalrings(), 99 96 100 97 pnormalf(f,E,N); Reduces a parametric polynomial f over V(E) \ V(N) 101 E is the null ideal and N the non-null ideal 102 over the parameters. 98 E is the null ideal and N the non-null ideal 99 over the parameters. 100 Can be used without calling presiouly setglobalrings(), 101 102 Prep(N,M); Computes the P-representation of V(N) \ V(M). 103 Can be used without calling previously setglobalrings(). 103 104 104 105 extend(GC); When the grobcov of an ideal has been computed 105 with the default option ('ext',0) and the explicit 106 option ('rep',2) (which is not the default), then 107 one can call extend (GC) (and options) to obtain the 108 full representation of the bases. With the default 109 option ('ext',0) only the generic representation of 110 the bases are computed, and one can obtain the full 111 representation using extend. 112 113 locus(G): Special routine for determining the locus of points 114 of objects. Given a parametric ideal J with 115 parameters (a_1,..a_m) and variables (x_1,..,xn), 116 representing the system determining 117 the locus of points (a_1,..,a_m)) who verify certain 118 properties, computing the grobcov G of 119 J and applying to it locus, determines the different 120 classes of locus components. They can be 121 Normal, Special, Accumulation point, Degenerate. 122 The output are the components given in P-canonical form 123 of two constructible sets: Normal, and Non-Normal 124 The Normal Set has Normal and Special components 125 The Non-Normal set has Accumulation and Degenerate components. 126 The description of the algorithm and definitions will be 127 given in a forthcoming paper by Abanades, Botana, Montes, Recio: 128 ''Geometrical locus of points using the Groebner cover'' 129 130 locusdg(G): Is a special routine for computing the locus in dinamical geometry. 131 It detects automatically a possible point that is to be avoided by the mover, 132 whose coordinates must be the last two coordinates in the definition of the ring. 133 If such a point is detected, then it eliminates the segments of the grobcov 134 depending on the point that is to be avoided. 135 Then it calls locus. 136 137 locusto(L): Transforms the output of locus to a string that 138 can be reed from different computational systems. 106 with the default option ('ext',0) and the explicit 107 option ('rep',2) (which is not the default), then 108 one can call extend (GC) (and options) to obtain the 109 full representation of the bases. With the default 110 option ('ext',0) only the generic representation of 111 the bases are computed, and one can obtain the full 112 representation using extend. 113 Can be used without calling presiouly setglobalrings(), 114 115 locus(G); Special routine for determining the locus of points 116 of objects. Given a parametric ideal J with 117 parameters (a_1,..a_m) and variables (x_1,..,xn), 118 representing the system determining 119 the locus of points (a_1,..,a_m)) who verify certain 120 properties, computing the grobcov G of 121 J and applying to it locus, determines the different 122 classes of locus components. They can be 123 Normal, Special, Accumulation point, Degenerate. 124 The output are the components given in P-canonical form 125 of two constructible sets: Normal, and Non-Normal 126 The Normal Set has Normal and Special components 127 The Non-Normal set has Accumulation and Degenerate components. 128 The description of the algorithm and definitions will be 129 given in a forthcoming paper by Abanades, Botana, Montes, Recio: 130 ''An Algebraic Taxonomy for Locus Computation in Dynamic Geometry''. 131 Can be used without calling presiouly setglobalrings(), 132 133 locusdg(G); Is a special routine for computing the locus in dinamical geometry. 134 It detects automatically a possible point that is to be avoided by the mover, 135 whose coordinates must be the last two coordinates in the definition of the ring. 136 If such a point is detected, then it eliminates the segments of the grobcov 137 depending on the point that is to be avoided. 138 Then it calls locus. 139 Can be used without calling presiouly setglobalrings(), 140 141 locusto(L); Transforms the output of locus to a string that 142 can be reed from different computational systems. 143 Can be used without calling presiouly setglobalrings(), 144 145 addcons(L); Given a disjoint set of locally closed subsets in P-representation, 146 it returns the canonical P-representation of the constructible 147 set formed by the union of them. 148 Can be used without calling presiouly setglobalrings(), 139 149 140 150 SEE ALSO: compregb_lib … … 154 164 // Initial data: 6-9-2009 155 165 // Final data: 25-10-2011 156 // Release 3: (this release, public)166 // Release 3: 157 167 // Initial data: 1-7-2012 158 168 // Final data: 4-9-2012 169 // Release 4: (this release, public) 170 // Initial data: 4-9-2012 171 // Final data: 21-11-2013 159 172 // basering Q[a][x]; 160 173 … … 166 179 RETURN: After its call the rings @R=Q[a][x], @P=Q[a], @RP=Q[x,a] are 167 180 defined as global variables. 168 NOTE: 169 library grobcov, cgsdr, extend, pdivi, pnormalf, locus, locus to,181 NOTE: It is called internally by the fundamental routines of the 182 library grobcov, cgsdr, extend, pdivi, pnormalf, locus, locusdg, locusto, 170 183 and killed before the output. 171 184 The user does not need to call it, except when it is interested … … 210 223 } 211 224 212 //*************Auxil liary routines**************225 //*************Auxiliary routines************** 213 226 214 227 // cld : clears denominators of an ideal and normalizes to content 1 215 // can be used in @R or @P or @RP228 // can be used in @R or @P or @RP 216 229 // input: 217 // ideal J (J can be also poly), but the output is an ideal;230 // ideal J (J can be also poly), but the output is an ideal; 218 231 // output: 219 // ideal Jc (the new form of ideal J without denominators and220 // normalized to content 1)232 // ideal Jc (the new form of ideal J without denominators and 233 // normalized to content 1) 221 234 proc cld(ideal J) 222 235 { … … 369 382 //"USAGE: subset(J,K); 370 383 // (J,K) expected (ideal,ideal) 371 // 384 // or (list, list) 372 385 //RETURN: 1 if all the elements of J are in K, 0 if not. 373 386 //EXAMPLE: subset; shows an example;" … … 419 432 } 420 433 421 // pdivi : pseudodivision of a p olyf by a parametric ideal F in Q[a][x].434 // pdivi : pseudodivision of a parametric polynomial f by a parametric ideal F in Q[a][x]. 422 435 // input: 423 // poly f (in the parametric ring @R)424 // ideal F (in the parametric ring @R)436 // poly f 437 // ideal F 425 438 // output: 426 439 // list (poly r, ideal q, poly mu) … … 438 451 EXAMPLE: pdivi; shows an example" 439 452 { 453 int i; 454 int j; 455 // string("T_f=",f); 456 poly v=1; 457 for(i=1;i<=nvars(basering);i++){v=v*var(i);} 440 458 int te=0; 459 def R=basering; 441 460 if (defined(@P)==1){te=1;} 442 461 else{setglobalrings();} 443 def R=basering;444 int i;445 int j;446 462 poly r=0; 447 463 poly mu=1; … … 476 492 rho=qlc[1]*qlm; 477 493 p=nu*p-rho*F[i]; 494 // string("i=",i," coef(p,v)=",coef(p,v)); 478 495 r=nu*r; 479 496 for (j=1;j<=size(F);j++){q[j]=nu*q[j];} … … 487 504 r=r+lcp*lpp; 488 505 p=p-lcp*lpp; 506 // string("pasa al rem p=",p); 489 507 } 490 508 } … … 845 863 { 846 864 int i; 865 int nt; 866 if (typeof(F)=="ideal"){nt=ncols(F);} 867 else{nt=size(F);} 868 847 869 def FF=F; 848 870 FF=F[1]; 849 for (i=2;i<=n cols(F);i++)871 for (i=2;i<=nt;i++) 850 872 { 851 873 if (not(memberpos(F[i],FF)[1])) … … 979 1001 poly g; int i; 980 1002 ideal Nb; ideal Na=N; 981 982 // begins incquotient983 1003 if (size(Na)==1) 984 1004 { … … 1055 1075 } 1056 1076 1077 // Auxiliary routine to define an order for ideals 1078 // Returns 1 if the ideal a is shoud precede ideal b by sorting them in idbefid order 1079 // 2 if the the contrary happen 1080 // 0 if the order is not relevant 1057 1081 proc idbefid(ideal a, ideal b) 1058 1082 { … … 1086 1110 } 1087 1111 1112 // sort a list of ideals using idbefid 1088 1113 proc sortlistideals(list L) 1089 1114 { … … 1139 1164 // the Prep of V(N)\V(M) 1140 1165 // Assumed to work in the ring @P of the parameters 1166 // Can be used without calling previously setglobalrings(). 1141 1167 proc Prep(ideal N, ideal M) 1142 1168 { 1169 int te; 1143 1170 if (N[1]==1) 1144 1171 { … … 1146 1173 } 1147 1174 def RR=basering; 1175 if(defined(@P)){te=1;} 1176 else{te=0; setglobalrings();} 1148 1177 setring(@P); 1149 1178 ideal Np=imap(RR,N); … … 1175 1204 if (size(prep)==0){prep=list(list(ideal(1),list(ideal(1))));} 1176 1205 setring(RR); 1177 return(imap(@P,prep)); 1206 def pprep=imap(@P,prep); 1207 if(te==0){kill @P; kill @R; kill @RP;} 1208 return(pprep); 1178 1209 } 1179 1210 … … 1187 1218 // the C-representaion of V(N)\V(M) = V(ida)\V(idb) 1188 1219 // Assumed to work in the ring @P of the parameters 1220 // If the routine is to be called from the top, a previous call to 1221 // setglobalrings() is needed. 1189 1222 proc PtoCrep(list L) 1190 1223 { … … 1293 1326 EXAMPLE: cgsdr; shows an example" 1294 1327 { 1328 int te; 1295 1329 def RR=basering; 1296 setglobalrings(); 1330 if(defined(@P)){te=1;} 1331 else{te=0; setglobalrings();} 1297 1332 // INITIALIZING OPTIONS 1298 1333 int i; int j; … … 1452 1487 } 1453 1488 } 1454 if( defined(@P)){kill @P; kill @R; kill @RP;}1489 if(te==0){kill @P; kill @R; kill @RP;} 1455 1490 return(GS); 1456 1491 } … … 1469 1504 1470 1505 // input: internal routine called by cgsdr at the end to group the 1471 // lpp segments and improve the output1506 // lpp segments and improve the output 1472 1507 // output: grouped segments by lpp obtained in cgsdr 1473 1508 proc grsegments(list T) … … 1505 1540 // input: ideal p, ideal q 1506 1541 // output: 1 if p contains q, 0 otherwise 1542 // If the routine is to be called from the top, a previous call to 1543 // setglobalrings() is needed. 1507 1544 proc idcontains(ideal p, ideal q) 1508 1545 { … … 1530 1567 // input: L (list of ideals) 1531 1568 // output: the list of integers corresponding to the minimal ideals in L 1569 // If the routine is to be called from the top, a previous call to 1570 // setglobalrings() is needed. 1532 1571 proc selectminideals(list L) 1533 1572 { … … 1568 1607 1569 1608 // LCUnion 1570 // Given a list of the P-representations of locally closed segments1609 // Given a list of the P-representations of disjoint locally closed segments 1571 1610 // for which we know that the union is also locally closed 1572 1611 // it returns the P-representation of its union … … 1576 1615 // output: P-representation of the union 1577 1616 // ((P_j,(P_j1,...,P_jk_j | j=1..t))) 1617 // If the routine is to be called from the top, a previous call to 1618 // setglobalrings() is needed. 1619 // Auxiliary routine called by grobcov and addcons 1620 // A previous call to setglobarings() is needed if it is to be used at the top. 1578 1621 proc LCUnion(list LL) 1579 1622 { 1580 1623 def RR=basering; 1581 1624 setring(@P); 1625 int care; 1582 1626 def L=imap(RR,LL); 1583 1627 int i; int j; int k; list H; list C; list T; 1584 list L0; list P0; list P; list Q0; list Q; 1628 list L0; list P0; list P; list Q0; list Q; intvec Qi; 1629 if(not(defined(@Q2))){list @Q2;} 1630 else{kill @Q2; list @Q2;} 1631 exportto(Top,@Q2); 1585 1632 for (i=1;i<=size(L);i++) 1586 1633 { … … 1592 1639 } 1593 1640 Q0=selectminideals(P0); 1641 //"T_3Q0="; Q0; 1642 kill P; list P; 1594 1643 for (i=1;i<=size(Q0);i++) 1595 1644 { 1596 Q[i]=L0[Q0[i]]; 1597 P[i]=L[Q[i][1]][Q[i][2]]; 1645 Qi=L0[Q0[i]]; 1646 Q[size(Q)+1]=Qi; 1647 P[size(P)+1]=L[Qi[1]][Qi[2]]; 1648 } 1649 @Q2=Q; 1650 if(size(P)==0) 1651 { 1652 setring(RR); 1653 list TT; 1654 return(TT); 1598 1655 } 1599 1656 // P is the list of the maximal components of the union … … 1611 1668 { 1612 1669 C[size(C)+1]=L[i][j]; 1670 C[size(C)][3]=intvec(i,j); 1613 1671 } 1614 1672 } 1615 1673 } 1616 T[size(T)+1]=list(Q[k],P[k][1],addpart(H,C)); 1617 } 1674 if(size(P[k])>=3){T[size(T)+1]=list(Q[k],P[k][1],addpart(H,C),P[k][3]);} 1675 else{T[size(T)+1]=list(Q[k],P[k][1],addpart(H,C));} 1676 } 1677 @Q2=sortpairs(@Q2); 1618 1678 setring(RR); 1619 1679 def TT=imap(@P,T); … … 1621 1681 } 1622 1682 1623 // Called by LCUnion to modify the holes of a primepart of the union 1683 // Auxiliary routine 1684 // called by LCUnion to modify the holes of a primepart of the union 1624 1685 // by the addition of the segments that do not correspond to that part 1625 1686 // Works on @P ring. … … 1627 1688 // H=(p_i1,..,p_is) the holes of a component to be transformed by the addition of 1628 1689 // the segments C that do not correspond to that component 1629 // C=((q_1,(q_11,..,q_1l_1)),..,(q_k,(q_k1,..,q_kl_k))) 1690 // C=((q_1,(q_11,..,q_1l_1),pos1),..,(q_k,(q_k1,..,q_kl_k),posk)) 1691 // posi=(i,j) position of the component 1630 1692 // the list of segments to be added to the holes 1631 1693 proc addpart(list H, list C) … … 1633 1695 list Q; int i; int j; int k; int l; int t; int t1; 1634 1696 Q=H; intvec notQ; list QQ; list addq; 1697 // @Q2=list of (i,j) positions of the components that have been aded to some hole of the maximal ideals 1698 // plus those of the components added to the holes. 1635 1699 ideal q; 1636 1700 i=1; … … 1645 1709 if (equalideals(q,C[j][1])) 1646 1710 { 1711 @Q2[size(@Q2)+1]=C[j][3]; 1647 1712 t=0; 1648 1713 for (k=1;k<=size(C[j][2]);k++) … … 1666 1731 { 1667 1732 addq[size(addq)+1]=C[j][2][k]; 1733 @Q2[size(@Q2)+1]=C[j][3]; 1668 1734 } 1669 1735 } … … 1697 1763 } 1698 1764 1699 // Called by addpart to finish the modification of the holes of a primepart1765 // Auxiliary routine called by addpart to finish the modification of the holes of a primepart 1700 1766 // of the union by the addition of the segments that do not correspond to 1701 1767 // that part. … … 1787 1853 } 1788 1854 1789 // specswellCrep 1790 // input: 1791 // given two corresponding polynomials g1 and g2 with the same lpp 1792 // g1 belonging to the basis in the segment ida1,idb1 1793 // g2 belonging to the basis in the segment ida2,idb2 1794 // output: 1795 // 1 if g1 spezializes well to g2 on the whole (ida2,idb2) segment 1796 // 0 if not 1797 proc specswellCrep(poly g1, poly g2, ideal ida2) 1798 { 1799 poly S; 1800 S=leadcoef(g2)*g1-leadcoef(g1)*g2; 1801 def RR=basering; 1802 setring(@RPt); 1803 def SR=imap(RR,S); 1804 def ida2R=imap(RR,ida2); 1805 attrib(ida2R,"isSB",1); 1806 poly S2R=reduce(SR,ida2R); 1807 setring(RR); 1808 def S2=imap(@RPt,S2R); 1809 if (S2==0){return(1);} // and (nonnullCrep(leadcoef(g1),ida2,idb2)) 1810 else {return(0);} 1811 } 1812 1855 // Auxiliary routine for grobcov: ideal F is assumed to be homogeneous 1813 1856 // gcover 1814 1857 // input: ideal F: a generating set of a homogeneous ideal in Q[a][x] … … 1881 1924 LCU=LCUnion(pairspP); 1882 1925 kill prep; list prep; 1926 kill crep; list crep; 1883 1927 for(k=1;k<=size(LCU);k++) 1884 1928 { … … 1945 1989 for(j=1;j<=size(B);j++) 1946 1990 { 1947 B[j]=pnormalf(B[j],crep[1], N);1991 B[j]=pnormalf(B[j],crep[1],crep[2]); 1948 1992 } 1949 1993 S[i]=list(lpp,B,prep,crep,lpph); … … 2015 2059 each point of the segment. With option (\"ext\",1) the 2016 2060 full representation of the bases is computed (possible 2017 sh aves) and sometimes a simpler result is obtained.2061 sheaves) and sometimes a simpler result is obtained. 2018 2062 \"rep\",0-1-2: The default is (\"rep\",0) and then the segments 2019 2063 are given in canonical P-representation. Option (\"rep\",1) … … 2204 2248 } 2205 2249 2206 // input. GC the grobcov of an ideal in generic representation of the2250 // Input. GC the grobcov of an ideal in generic representation of the 2207 2251 // bases computed with option option ("rep",2). 2208 // output The grobcov in full representation. 2209 // option ("comment",1) shows the time. 2252 // Output The grobcov in full representation. 2253 // Option ("comment",1) shows the time. 2254 // Can be called from the top 2210 2255 proc extend(list GC, list #); 2211 2256 "USAGE: extend(GC); When the grobcov of an ideal has been computed … … 2394 2439 } 2395 2440 2396 2441 // Auxiliary routine 2397 2442 // nonzerodivisor 2398 2443 // input: … … 2435 2480 } 2436 2481 2482 // Auxiliary routine 2437 2483 // deltai 2438 2484 // input: … … 2475 2521 } 2476 2522 2523 // Auxiliary routine 2477 2524 // combine 2478 2525 // input: a list of pairs ((p1,P1),..,(pr,Pr)) where … … 2498 2545 } 2499 2546 2547 // Auxiliary routine 2500 2548 // elimconstfac: eliminate the factors in the polynom f that are in K[a] 2501 2549 // input: … … 2523 2571 }; 2524 2572 2573 //Auxiliary routine 2525 2574 // nullin 2526 2575 // input: … … 2544 2593 } 2545 2594 2595 // Auxiliary routine 2546 2596 // monoms 2597 // Input: A polynomial f 2598 // Output: The list of leading terms 2547 2599 proc monoms(poly f) 2548 2600 { … … 2563 2615 } 2564 2616 2617 // Auxiliary routine called by extend 2565 2618 // extend0 2566 2619 // input: … … 2622 2675 } 2623 2676 2677 // Auxiliary routine 2624 2678 // findindexpolys 2625 2679 // input: … … 2670 2724 } 2671 2725 2726 // Auxiliary routine 2672 2727 // extendcoef: given Q,P in K[a] where P/Q specializes on an open and dense subset 2673 2728 // of the whole V(p1 int...int pr), it returns a basis of the module … … 2698 2753 } 2699 2754 2755 // Auxiliary routine 2700 2756 // selectregularfun 2701 2757 // input: … … 2755 2811 } 2756 2812 2813 // Auxiliary routine 2757 2814 // searchinlist 2758 2815 // input: … … 2776 2833 } 2777 2834 2835 // Auxiliary routine 2778 2836 // comb: the list of combinations of elements (1,..n) of order p 2779 2837 proc comb(int n, int p) … … 2812 2870 } 2813 2871 2872 // Auxiliary routine 2814 2873 // selectminsheaves 2815 2874 // Input: L=((v_11,..,v_1k_1),..,(v_s1,..,v_sk_s)) … … 2834 2893 } 2835 2894 2895 // Auxiliary routine 2836 2896 // smsheaves 2837 2897 // Input: … … 2868 2928 } 2869 2929 2930 // Auxiliary routine 2870 2931 // allsheaves 2871 2932 // Input: L=((v_11,..,v_1k_1),..,(v_s1,..,v_sk_s)) … … 2910 2971 } 2911 2972 2973 // Auxiliary routine 2912 2974 // numones 2913 2975 // Input: … … 2926 2988 } 2927 2989 2990 // Auxiliary routine 2928 2991 // pos 2929 2992 // Input: intvec p of zeros and ones … … 2940 3003 } 2941 3004 3005 // Auxiliary routine 2942 3006 // actualize: actualizes zeroes of p 2943 3007 // Input: … … 2957 3021 } 2958 3022 3023 // Auxiliary routine 2959 3024 // combrep 2960 3025 // Input: V=(n_1,..,n_i) … … 2990 3055 } 2991 3056 3057 // Auxiliary routine 2992 3058 proc reducemodN(poly f,ideal E) 2993 3059 { … … 3005 3071 } 3006 3072 3073 // Auxiliary routine 3007 3074 // intersp: computes the intersection of the ideals in S in @P 3008 3075 proc intersp(list S) … … 3017 3084 } 3018 3085 3086 // Auxiliary routine 3019 3087 // radicalmember 3020 3088 proc radicalmember(poly f,ideal ida) … … 3039 3107 } 3040 3108 3109 // Auxiliary routine 3041 3110 // NonNull: returns 1 if the poly f is nonnull on V(E)\V(N), 0 otherwise. 3042 3111 proc NonNull(poly f, ideal E, ideal N) … … 3059 3128 } 3060 3129 3130 // Auxiliary routine 3061 3131 // selectextendcoef 3062 3132 // input: … … 3117 3187 } 3118 3188 3189 // Auxiliary routine 3119 3190 // input: 3120 3191 // ideal E1: in some basering (depends only on the parameters) … … 3133 3204 } 3134 3205 3206 // Auxiliary routine 3135 3207 // reform 3136 3208 // input: … … 3216 3288 } 3217 3289 3290 // Auxiliary routine 3218 3291 // nonnullCrep 3219 3292 proc nonnullCrep(poly f0,ideal ida0,ideal idb0) … … 3238 3311 } 3239 3312 3313 // Auxiliary routine 3240 3314 // precombint 3241 3315 // input: L: list of ideals (works in @P) … … 3284 3358 } 3285 3359 3286 // precombinediscussion 3287 // not used, can be deleted 3288 // input: list L: the LCU segment with bases for each pi component 3289 // output: intvec vv: vv[1]=(1 if the generic polynomial of the vv[2] 3290 // component already specializes well, 3291 // 0 if combine is to be used) 3292 // vv[2]=selind, the index for which the generic basis 3293 // already specializes well if combine is not to be used (vv[1]=1). 3294 proc precombinediscussion(L,crep) 3295 { 3296 int tes=1; int selind; int i1; int j1; poly p; poly lcp; intvec vv; 3297 if (size(L)==1){vv=1,1; return(vv);} 3298 for (i1=1;i1<=size(L);i1++) 3299 { 3300 tes=1; 3301 p=L[i1][2]; 3302 lcp=leadcoef(p); 3303 3304 3305 if(nonnullCrep(lcp,crep[1],crep[2])) 3306 { 3307 for(j1=1;j1<=size(L);j1++) 3308 { 3309 if(i1!=j1) 3310 { 3311 if(specswellCrep(p,L[j1][2],L[j1][1])==0){tes=0; break;} 3312 } 3313 } 3314 } 3315 else{tes=0;} 3316 if(tes){selind=i1; break;} 3317 } 3318 vv=tes,selind; 3319 return(vv); 3320 } 3321 3360 3361 // Auxiliary routine 3322 3362 // minAssGTZ eliminating denominators 3323 3363 proc minGTZ(ideal N); … … 3337 3377 //********************* Begin KapurSunWang ************************* 3338 3378 3379 // Auxiliary routine 3339 3380 // inconsistent 3340 3381 // Input: … … 3372 3413 } 3373 3414 3415 // Auxiliary routine 3374 3416 // MDBasis: Minimal Dickson Basis 3375 3417 proc MDBasis(ideal G) … … 3397 3439 } 3398 3440 3441 // Auxiliary routine 3399 3442 // primepartZ 3400 3443 proc primepartZ(poly f); … … 3497 3540 } 3498 3541 3542 // Auxiliary routine 3499 3543 // sqf 3500 3544 // This is for releases of Singular before 3-5-1 … … 3516 3560 // } 3517 3561 3562 // Auxiliary routine 3518 3563 // sqf 3519 3564 proc sqf(poly f) … … 3529 3574 3530 3575 3576 // Auxiliary routine 3531 3577 // KSW0: Kapur-Sun-Wang algorithm for computing a CGS, called by KSW 3532 3578 // Input: … … 3575 3621 { 3576 3622 if(comment>1){"Basis 1 is found"; E; N;} 3577 return(E0,N0,ideal(1)); 3578 } 3623 list KK; KK[1]=list(E0,N0,ideal(1)); 3624 return(KK); 3625 } 3579 3626 ideal Gr; ideal Gm; ideal GM; 3580 3627 for (i=1;i<=size(G);i++) … … 3654 3701 } 3655 3702 3703 // Auxiliary routine 3656 3704 // KSWtocgsdr 3657 3705 proc KSWtocgsdr(list L) … … 3672 3720 } 3673 3721 3722 // Auxiliary routine 3674 3723 // KtoPrep 3675 3724 // Computes the P-representaion of a K-representation (N,W) of a set … … 3720 3769 } 3721 3770 3771 // Auxiliary routine 3722 3772 // groupKSWsegments 3723 3773 // input: the list of vertices of KSW … … 3754 3804 3755 3805 //******************** Begin locus ****************************** 3756 3757 3806 3758 3807 // indepparameters … … 3777 3826 } 3778 3827 3779 3780 // dimP0: Auxiliar routine 3828 // dimP0: Auxiliary routine 3781 3829 // if the dimension in @P of an ideal in the parameters has dimension 0 then it returns 0 3782 3830 // else it retuns 1 … … 3794 3842 } 3795 3843 3796 // Auxiliar routine.3844 // Auxiliary routine. 3797 3845 // input: ideals E and F (assumed in ring @P 3798 3846 // returns: 1 if ideal E is contained in ideal F (assumed F is std basis) … … 3817 3865 } 3818 3866 3819 // AddCons: given a set of locally closed components of a selection of 3820 // segments of the Grobner cover, it builds the canonical P-representation 3821 // of the corresponding constructible set, including levels it they are 3822 // input: a list L of a selection of segments of the Groebner cover 3823 // given a a set of components of the form 3824 // ( (p_1,(p_11,..,p_1k_1).. (p_s,(p_s1,..,p_sk_s)) 3825 // output: The canonical P-representation of adding the given components. 3826 proc AddCons(list L) 3827 { 3828 // First step: Selecting the top varieties 3829 list L1; list L2; list LL; int i; int j; int t; 3830 list Lend; 3867 // addcons: given a set of locally closed sets given in P-representation, 3868 // (particularly a subset of components of a selection of segments 3869 // of the Grobner cover), it builds the canonical P-representation 3870 // of the corresponding constructible set, of its union, including levels it they are. 3871 // input: a list L of disjoint segments (for exmple a selection of segments of the Groebner cover) 3872 // of the form 3873 // ( ( (p1_1,(p1_11,..,p1_1k_1).. (p1_s,(p1_s1,..,p1_sk_s)),.., 3874 // ( (pn_1,(pn_11,..,pn_1j_1).. (pn_s,(pn_s1,..,pn_sj_s)) ) 3875 // output: The canonical P-representation of the constructible set resulting by 3876 // adding the given components. 3877 // The first element of each component can be ignored. It is only for internal use. 3878 // The fifth element of each component is the level of the constructible set 3879 // of the component. 3880 // It is no need a previous call to setglobalrings() 3881 proc addcons(list L) 3882 "USAGE: addcons( ( ( (p1_1,(p1_11,..,p1_1k_1).. (p1_s,(p1_s1,..,p1_sk_s)),.., 3883 ( (pn_1,(pn_11,..,pn_1j_1).. (pn_s,(pn_s1,..,pn_sj_s)) ) ) 3884 a list L of locally closed sets in P-representation 3885 RETURN: the canonical P-representation of the constructible set of the union. 3886 NOTE: It is called internally by the routines locus, locusdg, 3887 3888 KEYWORDS: P-representation, constructible set 3889 EXAMPLE: adccons; shows an example" 3890 { 3891 int te; 3892 if(defined(@P)){te=1;} 3893 else{setglobalrings();} 3894 list notadded; list P0; 3895 int i; int j; int k; int l; 3896 intvec v; intvec v1; intvec v0; 3897 ideal J; list K; 3831 3898 for(i=1;i<=size(L);i++) 3832 3899 { 3833 t=1; 3834 for(j=1;j<=size(L);j++) 3835 { 3836 if(i!=j) 3837 { 3838 if(containedideal(L[j][1],L[i][1])==1) 3839 {t=0; 3840 // "the ideal "; L[j][1]; "is contained in ideal "; L[i][1]; 3841 j=size(L); 3842 } 3843 } 3844 } 3845 if(t==1){L1[size(L1)+1]=L[i];} 3846 else{L2[size(L2)+1]=L[i];} 3847 } 3848 // Second step: Adding segments to obtain a locally closed sets for each level 3849 int lev=1; 3850 if(size(L2)==0) 3851 { 3852 for(i=1;i<=size(L1);i++) 3900 for(j=1;j<=size(L[i]);j++) 3901 { 3902 v=i,j; 3903 notadded[size(notadded)+1]=v; 3904 } 3905 } 3906 //"T_notadded="; notadded; 3907 int level=1; 3908 list P=L; 3909 list LL; 3910 list Ln; 3911 //int cont=0; 3912 while(size(notadded)>0) 3913 { 3914 kill notadded; list notadded; 3915 for(i=1;i<=size(P);i++) 3916 { 3917 for(j=1;j<=size(P[i]);j++) 3918 { 3919 v=i,j; 3920 notadded[size(notadded)+1]=v; 3921 } 3922 } 3923 //"T_notadded="; notadded; 3924 //cont++; 3925 P0=P; 3926 Ln=LCUnion(P); 3927 //"T_Ln="; Ln; 3928 notadded=minuselements(notadded,@Q2); 3929 //"T_@Q2="; @Q2; 3930 //"T_notadded="; notadded; 3931 for(i=1;i<=size(Ln);i++) 3853 3932 { 3854 if(size(L1[i])>=3)3855 {L1[i][3]=string(string(L1[i][3]),",",lev);}3856 else{L1[i][3]=string(lev);}3933 //Ln[i][4]= ; JA HAURIA DE VENIR DE LCUnion 3934 Ln[i][5]=level; 3935 LL[size(LL)+1]=Ln[i]; 3857 3936 } 3858 return(L1); 3859 } 3860 while(size(L2)>0) 3861 { 3862 LL=addtolocalclosed(L1,L2); 3863 for(i=1;i<=size(LL[1]);i++) 3937 i=0;j=0; 3938 v=0,0; 3939 v0=0,0; 3940 kill P; list P; 3941 for(l=1;l<=size(notadded);l++) 3864 3942 { 3865 if(size(LL[1][i])>=3) 3866 {LL[1][i][3]=string(string(LL[1][i][3]),",",lev);} 3867 else{LL[1][i][3]=string(lev);} 3868 Lend[size(Lend)+1]=LL[1][i]; 3943 v1=notadded[l]; 3944 if(v1[1]<>v0[1]){i++;j=1; P[i]=K;} // list P[i]; 3945 else 3946 { 3947 if(v1[2]<>v0[2]) 3948 { 3949 j=j+1; 3950 } 3951 } 3952 v=i,j; 3953 //"T_v1="; v1; 3954 P[i][j]=K; P[i][j][1]=J; P[i][j][2]=K; 3955 P[i][j][1]=P0[v1[1]][v1[2]][1]; 3956 //"T_P0[v1[1]][v1[2]][2]="; P0[v1[1]][v1[2]][2]; 3957 //"T_size(P0[v1[1]][v1[2]][2])="; size(P0[v1[1]][v1[2]][2]); 3958 for(k=1;k<=size(P0[v1[1]][v1[2]][2]);k++) 3959 { 3960 P[i][j][2][k]=P0[v1[1]][v1[2]][2][k]; 3961 //string("T_P[",i,"][",j,"][2][",k,"]="); P[i][j][2][k]; 3962 } 3963 v0=v1; 3964 //"T_P_1="; P; 3869 3965 } 3870 L2=LL[2]; 3871 lev++; 3872 } 3873 return(Lend); 3874 } 3875 3876 // input: Two lists of P-components to be added. 3877 // L1 contains the top components, and L2 the remaining components 3878 // each of the form ( (p_1,(p_11,..,p_1k_1).. (p_s,(p_s1,..,p_sk_s)) 3879 // output: A list of two lists: 3880 // The first one contains the P-representation of the top components added 3881 // The second contains the components that have not yet been added when 3882 // the total subset is not locally closed. If so addtolocalclosed is to be called 3883 // at new after separating the new top and remaining components in order 3884 // to compute the next level of the constructible set. 3885 // The input and the output must be in the ring @P of parameters. 3886 proc addtolocalclosed(list L1,list L2) 3887 { 3888 // Second step: Adding segments to obtain a locally closed set 3889 // L1 contains the top components (ideals and descendants) 3890 // L2 contains the nontop components (ideals and descendants) 3891 list LL; int i; int j; int t; intvec Added; int mesvoltes=1; intvec alreadyadded; list LN; 3892 int k; int l; int m; ideal top; ideal hole; ideal nhole; intvec nottoadd; int t0; list h; 3893 LL=L1; 3894 LN=L2; 3895 while(mesvoltes) 3896 { 3897 //"volta"; 3898 for(i=1;i<=size(L1);i++) 3899 { 3900 Added=Added,alreadyadded; 3901 Added=sort(elimrepeatedvl(Added))[1]; 3902 kill alreadyadded; intvec alreadyadded; 3903 top=LL[i][1][1]; 3904 j=1; 3905 while(j<=size(LL[i][2])) 3906 { 3907 kill nottoadd; intvec nottoadd; 3908 hole=LL[i][2][j]; 3909 t0=1; 3910 k=1; 3911 while(t0 and k<=size(LN)) 3912 { 3913 if (equalideals(hole,LN[k][1])==1) 3914 { 3915 t0=0; 3916 if(alreadyadded==intvec(0)){alreadyadded[1]=k;} 3917 else{alreadyadded[size(alreadyadded)+1]=k;} 3918 LL[i][2]=elimfromlist(LL[i][2],j); 3919 j=j-1; 3920 for(l=1;l<=size(LN[k][2]);l++) 3921 { 3922 nhole=LN[k][2][l],LL[i][1]; 3923 nhole=std(nhole); 3924 t=1; m=1; 3925 while(t and m<=size(LL[i][2])) 3926 { 3927 if(containedideal(LL[i][2][m],nhole)==1) 3928 { 3929 t=0; 3930 } 3931 m++; 3932 } 3933 if(t==0){nottoadd[size(nottoadd)+1]=l;} 3934 } 3935 for(m=1;m<=size(LN[k][2]);m++) 3936 { 3937 if(memberpos(m,nottoadd)[1]==0) 3938 { 3939 LL[i][2][size(LL[i][2])+1]=LN[k][2][m]; 3940 } 3941 } 3942 } 3943 k++; 3944 3945 } 3946 j++; 3947 } 3948 if(size(LL[i][2])==0 and size(LL[i][1])>0){LL[i][2][1]=ideal(1);} 3949 } 3950 h=1,1; 3951 while((h[1]==1) and (alreadyadded!=intvec(0))) 3952 { 3953 h=memberpos(0,alreadyadded); 3954 if(h[1]==1){alreadyadded=elimfromlist(alreadyadded,h[2]);} 3955 } 3956 if(alreadyadded!=intvec(0)) 3957 {alreadyadded=sort(elimrepeatedvl(alreadyadded))[1];} 3958 if(Added==intvec(0)){Added=alreadyadded;} 3959 else{ 3960 Added=Added,alreadyadded; 3961 Added=sort(elimrepeatedvl(Added))[1]; 3962 } 3963 h=1,1; 3964 while((h[1]==1) and (Added!=intvec(0))) 3965 { 3966 h=memberpos(0,Added); 3967 if(h[1]==1){Added=elimfromlist(Added,h[2]);} 3968 } 3969 if (alreadyadded==intvec(0)) 3970 { 3971 mesvoltes=0; 3972 } 3973 } 3974 if(Added!=intvec(0)){Added=sort(elimrepeatedvl(Added))[1]; } 3975 if(Added!=intvec(0)) 3976 { 3977 for(i=1;i<=size(Added);i++) 3978 { 3979 if(size(LN)>0){LN=elimfromlist(LN,Added[size(Added)+1-i]);} 3980 } 3981 } 3982 for (i=1;i<=size(LL);i++) 3983 { 3984 for(j=1;j<=size(LL[i][2]);j++) 3985 { 3986 hole=LL[i][2][j]; 3987 for (k=1;k<=size(LL);k++) 3988 { 3989 if(k!=i) 3990 { 3991 if(containedideal(LL[k][1],hole)) 3992 { 3993 LL[i][2]=elimfromlist(LL[i][2],j); 3994 for(l=1;l<=size(LL[k][2]);l++) 3995 { 3996 nhole=hole,LL[k][2][l]; 3997 nhole=std(nhole); 3998 if(equalideals(nhole,ideal(1))==0) 3999 { 4000 m=1; t=1; 4001 while(t and m<size(LL[i][2])) 4002 { 4003 if(containedideal(LL[i][2][m],nhole)){t=0;} 4004 m++; 4005 } 4006 if(t==1){LL[i][2][size(LL[i][2])+1]=nhole;} 4007 } 4008 } 4009 } 4010 } 4011 } 4012 } 4013 } 4014 LL[1]=LL; LL[2]=LN; 3966 //"T_P="; P; 3967 level++; 3968 //if(cont>3){break;} 3969 //kill notadded; list notadded; 3970 } 3971 kill @Q2; 3972 if(te==0){kill @P; kill @R; kill @RP;} 3973 //"T_LL_sortida addcons="; LL; "Fi sortida"; 4015 3974 return(LL); 4016 3975 } 4017 4018 // locus(G): Special routine for determining the locus of points 4019 // of objects. Given a parametric ideal J with 4020 // parameters (a_1,..a_m) and variables (x_1,..,xn), 4021 // representing the system determining 4022 // the locus of points (a_1,..,a_m)) who verify certain 4023 // properties, computing the grobcov G of 4024 // J and applying to it locus, determines the different 4025 // classes of locus components. They can be 4026 // Normal, Special, Accumulation point, Degenerate. 4027 // The output are the components given in P-canonical form 4028 // of at most 4 constructible sets: Normal, Special, Accumulation, 4029 // Degenerate. 4030 // The description of the algorithm and definitions will be 4031 // given in a forthcoming paper by Abanades, Botana, Montes Recio. 4032 4033 // input: The output G of the grobcov (in generic representation, which is the default) 3976 example 3977 { 3978 "EXAMPLE:"; echo = 2; 3979 ring R=(0,a,b),(x1,y1,x2,y2,p,r),dp; 3980 ideal S93=(a+1)^2+b^2-(p+1)^2, 3981 (a-1)^2+b^2-(1-r)^2, 3982 a*y1-b*x1-y1+b, 3983 a*y2-b*x2+y2-b, 3984 -2*y1+b*x1-(a+p)*y1+b, 3985 2*y2+b*x2-(a+r)*y2-b, 3986 (x1+1)^2+y1^2-(x2-1)^2-y2^2; 3987 short=0; 3988 "System S93="; S93; " "; 3989 def GC93=grobcov(S93); 3990 "grobcov(S93)="; GC93; " "; 3991 int i; 3992 list H; 3993 for(i=1;i<=size(GC93);i++){H[i]=GC93[i][3];} 3994 "H="; H; 3995 "addcons(H)="; addcons(H); 3996 } 3997 3998 // Takes a list of intvec and sorts it and eliminates repeated elements. 3999 // Auxiliary routine used in addcons 4000 proc sortpairs(L) 4001 { 4002 def L1=sort(L); 4003 def L2=elimrepeated(L1[1]); 4004 return(L2); 4005 } 4006 4007 // Eliminates the pairs of L1 that are also in L2. 4008 // Auxiliary routine used in addcons 4009 proc minuselements(list L1,list L2) 4010 { 4011 int i; 4012 list L3; 4013 for (i=1;i<=size(L1);i++) 4014 { 4015 if(not(memberpos(L1[i],L2)[1])){L3[size(L3)+1]=L1[i];} 4016 } 4017 return(L3); 4018 } 4019 4020 // locus0(G): Private routine used by locus (the public routine), that 4021 // builds the diferent components. 4022 // input: The output G of the grobcov (in generic representation, which is the default option) 4034 4023 // output: 4035 4024 // list, the canonical P-representation of the Normal and Non-Normal locus: 4036 4025 // The Normal locus has two kind of components: Normal and Special. 4037 4026 // The Non-normal locus has two kind of components: Accumulation and Degenerate. 4038 // Normal components: for each point in the component, 4039 // the number of solutions in the variables is finite, and 4040 // the solutions depend on the point in the component if the component is not 0-dimensional. 4041 // Special components: for each point in the component, 4042 // the number of solutions in the variables is finite, 4043 // the component is not 0-dimensional, but the solutions do not depend on the 4044 // values of the parameters in the component. 4045 // Accumlation points: are 0-dimensional components for which it exist 4046 // an infinite number of solutions. 4047 // Degenerate components: are components of dimension greater than 0 for which 4048 // for every point in the component there exist infinite solutions. 4027 // This routine is compemented by locus that calls it in order to eliminate problems 4028 // with degenerate points of the mover. 4049 4029 // The output components are given as 4050 4030 // ((p1,(p11,..p1s_1),type_1,level_1),..,(pk,(pk1,..pks_k),type_k,level_k) … … 4052 4032 // If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level 4053 4033 // gives the depth of the component. 4054 proc locus(list GG, list #) 4055 "USAGE: locus(G); 4056 The input must be the grobcov of a parametrical ideal 4057 RETURN: The locus. 4058 The output are the components of two constructible subsets of the locus 4059 of the parametrical system.: Normal and Non-normal. 4060 These components are 4061 given as a list of (pi,(pi1,..pis_i),type_i,level_i) varying i, 4062 where the p's are prime ideals, the type can be: Normal, Special, 4063 Accumulation, Degenerate. 4064 NOTE: It can only be called after computing the grobcov of the 4065 parametrical ideal in generic representation ('ext',0), 4066 which is the default. 4067 The basering R, must be of the form Q[a_1,..,a_m][x_1,..,x_n]. 4068 KEYWORDS: geometrical locus, locus, loci. 4069 EXAMPLE: locus; shows an example" 4034 proc locus0(list GG, list #) 4070 4035 { 4071 4036 int t1=1; int t2=1; 4072 4037 def R=basering; 4073 4038 int moverdim=nvars(R); 4039 list HHH; 4040 if (GG[1][1][1]==1 and GG[1][2][1]==1 and GG[1][3][1][1][1]==0 and GG[1][3][1][2][1]==1){return(HHH);} 4074 4041 list Lop=#; 4075 4042 if(size(Lop)>0){moverdim=Lop[1];} … … 4077 4044 list G1; list G2; 4078 4045 def G=GG; 4046 list Q1; list Q2; 4079 4047 int i; int d; int j; int k; 4080 4048 t1=1; … … 4082 4050 { 4083 4051 attrib(G[i][1],"IsSB",1); 4084 //d=dim(std(G[i][1]));4085 // ULL4086 4052 d=locusdim(G[i][2],moverdim); 4087 4053 if(d==0){G1[size(G1)+1]=G[i];} … … 4131 4097 P1[i][3][j]=P1[i][3][j]*h[k]; 4132 4098 } 4133 //P1[i][3][j]=normalize(P1[i][3][j]);4134 4099 } 4135 4100 } 4136 4101 } 4137 4102 else{list P1;} 4103 ideal BB; 4138 4104 for(i=1;i<=size(P1);i++) 4139 4105 { … … 4149 4115 } 4150 4116 } 4117 list l; 4118 for(i=1;i<=size(P1);i++){Q1[i]=l; Q1[i][1]=P1[i];} P1=Q1; 4119 for(i=1;i<=size(P2);i++){Q2[i]=l; Q2[i][1]=P2[i];} P2=Q2; 4120 4151 4121 setring @P; 4152 // CANVIAR4122 ideal J; 4153 4123 if(t1==1) 4154 4124 { 4155 4125 def C1=imap(R,P1); 4156 def L1= AddCons(C1);4126 def L1=addcons(C1); 4157 4127 } 4158 4128 else{list C1; list L1; kill P1; list P1;} … … 4160 4130 { 4161 4131 def C2=imap(R,P2); 4162 def L2= AddCons(C2);4132 def L2=addcons(C2); 4163 4133 } 4164 4134 else{list L2; list C2; kill P2; list P2;} 4165 4135 for(i=1;i<=size(L2);i++) 4166 4136 { 4167 d=dim(std(L2[i][1])); 4137 J=std(L2[i][2]); 4138 d=dim(J); // AQUI 4168 4139 if(d==0) 4169 4140 { 4170 L2[i][ 3]=string("Accumulation,",L2[i][3]);4171 } 4172 else{L2[i][ 3]=string("Degenerate,",L2[i][3]);}4141 L2[i][4]=string("Accumulation",L2[i][4]); 4142 } 4143 else{L2[i][4]=string("Degenerate",L2[i][4]);} 4173 4144 } 4174 4145 list LN; … … 4185 4156 for(i=1;i<=size(L);i++){if(size(L[i][2])==0){L[i][2]=ideal(1);}} 4186 4157 kill @R; kill @RP; kill @P; 4187 return(L); 4188 } 4189 example 4190 {"EXAMPLE:"; echo = 2; 4191 ring R=(0,a,b),(x,y),dp; 4192 short=0; 4193 "Concoid"; 4194 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4195 "System="; S96; " "; 4196 locus(grobcov(S96)); 4197 } 4198 4199 4200 // locusto: Transforms the output of locus to a string that 4201 // can be read by different computational systems. 4202 // input: 4203 // list L: The output of locus 4158 list LL; 4159 for(i=1;i<=size(L);i++) 4160 { 4161 LL[i]=l; 4162 LL[i]=elimfromlist(L[i],1); 4163 } 4164 return(LL); 4165 } 4166 4167 // locus0dg(G): Private routine used by locusdg (the public routine), that 4168 // builds the diferent components used in Dynamical Geometry 4169 // input: The output G of the grobcov (in generic representation, which is the default option) 4204 4170 // output: 4205 // string s: The output of locus converted to a string readable by other programs 4206 proc locusto(list L) 4207 "USAGE: locusto(G); 4208 The argument must be the output of locus of a parametrical ideal 4209 It transforms the output into a string in standard form 4210 readable in many languages (Geogebra). 4211 4212 RETURN: The locus in string standard form 4213 NOTE: It can only be called after computing the locus(grobcov(F)) of the 4214 parametrical ideal. 4215 The basering R, must be of the form Q[a,b,..][x,y,..]. 4216 KEYWORDS: geometrical locus, locus, loci. 4217 EXAMPLE: locusto; shows an example" 4218 { 4219 int i; int j; int k; 4220 string s; 4221 s="["; 4222 ideal p; 4223 ideal q; 4171 // list, the canonical P-representation of the Relevant components of the locus in Dynamical Geometry, 4172 // i.e. the Normal and Accumulation components. 4173 // This routine is compemented by locusdg that calls it in order to eliminate problems 4174 // with degenerate points of the mover. 4175 // The output components are given as 4176 // ((p1,(p11,..p1s_1),type_1,level_1),..,(pk,(pk1,..pks_k),type_k,level_k) 4177 // whwre type_i is always "Relevant". 4178 // The components are given in canonical P-representation of the subset. 4179 // If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level 4180 // gives the depth of the component. 4181 proc locus0dg(list GG, list #) 4182 { 4183 int t1=1; int t2=1; 4184 def R=basering; 4185 int moverdim=nvars(R); 4186 list HHH; 4187 if (GG[1][1][1]==1 and GG[1][2][1]==1 and GG[1][3][1][1][1]==0 and GG[1][3][1][2][1]==1){return(HHH);} 4188 list Lop=#; 4189 if(size(Lop)>0){moverdim=Lop[1];} 4190 setglobalrings(); 4191 list G1; list G2; 4192 def G=GG; 4193 list Q1; list Q2; 4194 int i; int d; int j; int k; 4195 t1=1; 4196 for(i=1;i<=size(G);i++) 4197 { 4198 attrib(G[i][1],"IsSB",1); 4199 d=locusdim(G[i][2],moverdim); 4200 if(d==0){G1[size(G1)+1]=G[i];} 4201 else 4202 { 4203 if(d>0){G2[size(G2)+1]=G[i];} 4204 } 4205 } 4206 if(size(G1)==0){t1=0;} 4207 if(size(G2)==0){t2=0;} 4208 setring(@RP); 4209 if(t1) 4210 { 4211 list G1RP=imap(R,G1); 4212 } 4213 else {list G1RP;} 4214 list P1RP; 4215 ideal B; 4216 for(i=1;i<=size(G1RP);i++) 4217 { 4218 kill B; 4219 ideal B; 4220 for(k=1;k<=size(G1RP[i][3]);k++) 4221 { 4222 attrib(G1RP[i][3][k][1],"IsSB",1); 4223 G1RP[i][3][k][1]=std(G1RP[i][3][k][1]); 4224 for(j=1;j<=size(G1RP[i][2]);j++) 4225 { 4226 B[j]=reduce(G1RP[i][2][j],G1RP[i][3][k][1]); 4227 } 4228 P1RP[size(P1RP)+1]=list(G1RP[i][3][k][1],G1RP[i][3][k][2],B); 4229 } 4230 } 4231 setring(R); 4232 ideal h; 4233 if(t1) 4234 { 4235 def P1=imap(@RP,P1RP); 4236 for(i=1;i<=size(P1);i++) 4237 { 4238 for(j=1;j<=size(P1[i][3]);j++) 4239 { 4240 h=factorize(P1[i][3][j],1); 4241 P1[i][3][j]=h[1]; 4242 for(k=2;k<=size(h);k++) 4243 { 4244 P1[i][3][j]=P1[i][3][j]*h[k]; 4245 } 4246 } 4247 } 4248 } 4249 else{list P1;} 4250 ideal BB; 4251 for(i=1;i<=size(P1);i++) 4252 { 4253 if (indepparameters(P1[i][3])==1){P1[i][3]="Special";} 4254 else{P1[i][3]="Relevant";} 4255 } 4256 list P2; 4257 for(i=1;i<=size(G2);i++) 4258 { 4259 for(k=1;k<=size(G2[i][3]);k++) 4260 { 4261 P2[size(P2)+1]=list(G2[i][3][k][1],G2[i][3][k][2]); 4262 } 4263 } 4264 list l; 4265 for(i=1;i<=size(P1);i++){Q1[i]=l; Q1[i][1]=P1[i];} P1=Q1; 4266 for(i=1;i<=size(P2);i++){Q2[i]=l; Q2[i][1]=P2[i];} P2=Q2; 4267 4268 setring @P; 4269 ideal J; 4270 if(t1==1) 4271 { 4272 def C1=imap(R,P1); 4273 def L1=addcons(C1); 4274 } 4275 else{list C1; list L1; kill P1; list P1;} 4276 if(t2==1) 4277 { 4278 def C2=imap(R,P2); 4279 def L2=addcons(C2); 4280 } 4281 else{list L2; list C2; kill P2; list P2;} 4282 for(i=1;i<=size(L2);i++) 4283 { 4284 J=std(L2[i][2]); 4285 d=dim(J); // AQUI 4286 if(d==0) 4287 { 4288 L2[i][4]=string("Relevant",L2[i][4]); 4289 } 4290 else{L2[i][4]=string("Degenerate",L2[i][4]);} 4291 } 4292 list LN; 4293 list ll; list l0; 4294 if(t1==1) 4295 { 4296 for(i=1;i<=size(L1);i++) 4297 { 4298 if(L1[i][4]=="Relevant") 4299 { 4300 LN[size(LN)+1]=l0; 4301 LN[size(LN)][1]=L1[i]; 4302 } 4303 } 4304 } 4305 if(t2==1) 4306 { 4307 for(i=1;i<=size(L2);i++) 4308 { 4309 if(L2[i][4]=="Relevant") 4310 { 4311 LN[size(LN)+1]=l0; 4312 LN[size(LN)][1]=L2[i]; 4313 } 4314 } 4315 } 4316 list LNN; 4317 kill ll; list ll; list lll; list llll; 4318 for(i=1;i<=size(LN);i++) 4319 { 4320 LNN[size(LNN)+1]=l0; 4321 ll=LN[i][1]; lll[1]=ll[2]; lll[2]=ll[3]; lll[3]=ll[4]; LNN[size(LNN)][1]=lll; 4322 } 4323 kill LN; list LN; 4324 LN=addcons(LNN); 4325 setring(R); 4326 def L=imap(@P,LN); 4327 for(i=1;i<=size(L);i++){if(size(L[i][2])==0){L[i][2]=ideal(1);}} 4328 kill @R; kill @RP; kill @P; 4329 list LL; 4224 4330 for(i=1;i<=size(L);i++) 4225 4331 { 4226 s=string(s,"[["); 4227 for (j=1;j<=size(L[i][1]);j++) 4228 { 4229 s=string(s,L[i][1][j],","); 4230 } 4231 s[size(s)]="]"; 4232 s=string(s,",["); 4233 for(j=1;j<=size(L[i][2]);j++) 4234 { 4235 s=string(s,"["); 4236 for(k=1;k<=size(L[i][2][j]);k++) 4237 { 4238 s=string(s,L[i][2][j][k],","); 4239 } 4240 s[size(s)]="]"; 4241 s=string(s,","); 4242 } 4243 s[size(s)]="]"; 4244 s=string(s,"]"); 4245 if(size(L[i])>=3) 4246 { 4247 s[size(s)]=","; 4248 s=string(s,string(L[i][3]),"]"); 4249 } 4250 if(size(L[i])>=4) 4251 { 4252 s[size(s)]=","; 4253 s=string(s,string(L[i][4]),"],"); 4254 } 4255 s[size(s)]="]"; 4256 s=string(s,","); 4257 } 4258 s[size(s)]="]"; 4259 return(s); 4260 } 4261 example 4262 {"EXAMPLE:"; echo = 2; 4263 ring R=(0,a,b),(x,y),dp; 4264 short=0; 4265 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4266 "System="; S96; " "; 4267 locusto(locus(grobcov(S96))); 4268 } 4269 4270 // locusdg is the routine for computing the locus in dinamical geometry. 4271 // It detects automatically a possible point that is to be avoided by the mover, 4272 // whose coordinates must be the last coordinates in the definition of the ring (2 last by default, 4273 // or the dd last if the option locusdg(G,dd) is specified). 4274 // If such a point is detected, then it eliminates the segments of the grobcov that 4275 // have this point as solution. 4276 // Then it calls locus. 4277 proc locusdg(list GG,list #) 4278 "USAGE: locusdg(GG) ; 4279 The argument must be the output of grobcov 4280 RETURN: The components of the locus of points in dinamical geometry 4281 NOTE: The basering R, must be of the form Q[a][x], a=parameters, 4282 x=variables, and the mover coordinates must be the two last variables in the 4283 definition of the ring. 4284 KEYWORDS: ring, locus, grobcov 4285 EXAMPLE: locusdg(GG); shows an example" 4332 LL[i]=l; 4333 LL[i]=elimfromlist(L[i],1); 4334 } 4335 return(LL); 4336 } 4337 4338 4339 // locus(G): Special routine for determining the locus of points 4340 // of geometrical constructions. Given a parametric ideal J with 4341 // parameters (a_1,..a_m) and variables (x_1,..,xn), 4342 // representing the system determining 4343 // the locus of points (a_1,..,a_m) who verify certain 4344 // properties, computing the grobcov G of 4345 // J and applying to it locus, determines the different 4346 // classes of locus components. The components can be 4347 // Normal, Special, Accumulation, Degenerate. 4348 // The output are the components given in P-canonical form 4349 // of at most 4 constructible sets: Normal, Special, Accumulation, 4350 // Degenerate. 4351 // The description of the algorithm and definitions is 4352 // given in a forthcoming paper by Abanades, Botana, Montes, Recio. 4353 // Usually locus problems have mover coordinates, variables and tracer coordinates. 4354 // The mover coordinates are to be placed as the last variables, and by default, 4355 // its number is 2. If one consider locus problems in higer dimensions, the number of 4356 // mover coordinates (placed as the last variables) is to be given as an option. 4357 // 4358 // input: The output G of the grobcov (in generic representation, which is the default option for grobcov) 4359 // output: 4360 // list, the canonical P-representation of the Normal and Non-Normal locus: 4361 // The Normal locus has two kind of components: Normal and Special. 4362 // The Non-normal locus has two kind of components: Accumulation and Degenerate. 4363 // Normal components: for each point in the component, 4364 // the number of solutions in the variables is finite, and 4365 // the solutions depend on the point in the component if the component is not 0-dimensional. 4366 // Special components: for each point in the component, 4367 // the number of solutions in the variables is finite, 4368 // the component is not 0-dimensional, but the solutions do not depend on the 4369 // values of the parameters in the component. 4370 // Accumlation points: are 0-dimensional components for which it exist 4371 // an infinite number of solutions. 4372 // Degenerate components: are components of dimension greater than 0 for which 4373 // for every point in the component there exist infinite solutions. 4374 // The output components are given as 4375 // ((p1,(p11,..p1s_1),type_1,level_1),..,(pk,(pk1,..pks_k),type_k,level_k) 4376 // The components are given in canonical P-representation of the subset. 4377 // If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level 4378 // gives the depth of the component of the constructible set. 4379 proc locus(list GG, list #) 4380 "USAGE: locus(G); 4381 The input must be the grobcov of a parametrical ideal 4382 RETURN: The locus. 4383 The output are the components of four constructible subsets of the locus 4384 of the parametrical system: Normal , Special, Accumulation and Degenerate. 4385 These components are 4386 given as a list of (pi,(pi1,..pis_i),type_i,level_i) varying i, 4387 where the p's are prime ideals, the type can be: Normal, Special, 4388 Accumulation, Degenerate. 4389 NOTE: It can only be called after computing the grobcov of the 4390 parametrical ideal in generic representation ('ext',0), 4391 which is the default. 4392 The basering R, must be of the form Q[a_1,..,a_m][x_1,..,x_n]. 4393 KEYWORDS: geometrical locus, locus, loci. 4394 EXAMPLE: locus; shows an example" 4286 4395 { 4287 4396 def R=basering; … … 4294 4403 if (equalideals(B0,ideal(1))) 4295 4404 { 4296 return(locus (GG));4405 return(locus0(GG)); 4297 4406 } 4298 4407 else … … 4325 4434 if(te) 4326 4435 { 4327 string("locus dg detected that the mover must avoid point (",N,") in order to obtain thelocus");4328 // eliminate segments of GG where N is contained in the basis4436 string("locus detected that the mover must avoid point (",N,") in order to obtain the correct locus"); 4437 // eliminates segments of GG where N is contained in the basis 4329 4438 list nGP; 4330 4439 def GP=GG; … … 4343 4452 } 4344 4453 } 4345 //"T_nGP="; nGP;4346 4454 kill @RP; kill @P; kill @R; 4347 return(locus(nGP,dd)); 4348 } 4349 // // Now eliminate components for which the basis has dim>0, and all elements non reducing to 0 4350 // // modulo N do not contain the mover coordinates 4351 // list nnGP; poly r; 4352 // for(j=1; j<=size(nGP);j++) 4353 // { 4354 // if(not(indepparameters(nGP[j][2]))) 4355 // { 4356 // if(dim(std(nGP[j][1]))==0){nnGP[size(nnGP)+1]=nGP[j];} 4357 // else 4358 // { 4359 // te=1; k=1; 4360 // while(te and k<=size(nGP[2])) 4361 // { 4362 // r=pdivi(nGP[j][2][k],N)[1]; 4363 // if(r==0){k++;} 4364 // else 4365 // { 4366 // if(not(subset(variables(nGP[j][2][k]),vmov ))) 4367 // { 4368 // te=0; 4369 // } 4370 // else{k++;} 4371 // } 4372 // } 4373 // if(te==1){nnGP[size(nnGP)+1]=nGP[j];} 4374 // } 4375 // } 4376 // } 4377 // 4378 // } 4379 // kill @RP; kill @P; kill @R; 4380 // return(locus(nnGP)); 4381 // } 4382 //} 4455 return(locus0(nGP,dd)); 4456 } 4383 4457 example 4384 4458 {"EXAMPLE:"; echo = 2; … … 4390 4464 (a-x1)^2+(b-x2)^2-(x1-x3)^2-(x2-x4)^2; 4391 4465 short=0; 4392 locusdg(grobcov(S)); 4393 } 4394 4466 locus(grobcov(S)); " "; 4467 kill R; 4468 ring R=(0,a,b),(x,y),dp; 4469 short=0; 4470 "Concoid"; 4471 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4472 "System="; S96; " "; 4473 locus(grobcov(S96)); 4474 kill R; ring R=(0,x,y),(x1,x2),dp; 4475 ideal S=-(x - 5)*(x1 - 1) - (x2 - 2)*(y - 2), 4476 (x1 - 5)^2 + (x2 - 2)^2 - 4, 4477 -2*(x - 5)*(x2 - 2) + 2*(x1 - 5)*(y - 2); 4478 "System="; S; 4479 locus(grobcov(S)); " "; 4480 ideal S1=-(x - x1)*(x1 - 4) + (x2 - y)*(x2 - 4), 4481 (x1 - 4)^2 + (x2 - 2)^2 - 4, 4482 -2*(x1 - 4)*(2*x2 - y - 4) - 2*(x - 2*x1 + 4)*(x2 - 2); 4483 "System="; S1; 4484 locus(grobcov(S1)); 4485 } 4486 4487 // locusdg(G): Special routine for determining the locus of points 4488 // of geometrical constructions. Given a parametric ideal J with 4489 // parameters (a_1,..a_m) and variables (x_1,..,xn), 4490 // representing the system determining 4491 // the locus of points (a_1,..,a_m) who verify certain 4492 // properties, computing the grobcov G of 4493 // J and applying to it locus, determines the different 4494 // classes of locus components. The components can be 4495 // Normal, Special, Accumulation point, Degenerate. 4496 // The output are the components given in P-canonical form 4497 // of at most 4 constructible sets: Normal, Special, Accumulation, 4498 // Degenerate. 4499 // The description of the algorithm and definitions is 4500 // given in a forthcoming paper by Abanades, Botana, Montes, Recio. 4501 // Usually locus problems have mover coordinates, variables and tracer coordinates. 4502 // The mover coordinates are to be placed as the last variables, and by default, 4503 // its number is 2. If onw consider locus problems in higer dimensions, the number of 4504 // mover coordinates (placed as the last variables) is to be given as an option. 4505 // 4506 // input: The output G of the grobcov (in generic representation, which is the default option for grobcov) 4507 // output: 4508 // list, the canonical P-representation of the Normal and Non-Normal locus: 4509 // The Normal locus has two kind of components: Normal and Special. 4510 // The Non-normal locus has two kind of components: Accumulation and Degenerate. 4511 // Normal components: for each point in the component, 4512 // the number of solutions in the variables is finite, and 4513 // the solutions depend on the point in the component if the component is not 0-dimensional. 4514 // Special components: for each point in the component, 4515 // the number of solutions in the variables is finite, 4516 // the component is not 0-dimensional, but the solutions do not depend on the 4517 // values of the parameters in the component. 4518 // Accumlation points: are 0-dimensional components for which it exist 4519 // an infinite number of solutions. 4520 // Degenerate components: are components of dimension greater than 0 for which 4521 // for every point in the component there exist infinite solutions. 4522 // The output components are given as 4523 // ((p1,(p11,..p1s_1),type_1,level_1),..,(pk,(pk1,..pks_k),type_k,level_k) 4524 // The components are given in canonical P-representation of the subset. 4525 // If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level 4526 // gives the depth of the component of the constructible set. 4527 proc locusdg(list GG, list #) 4528 "USAGE: locus(G); 4529 The input must be the grobcov of a parametrical ideal 4530 RETURN: The locus. 4531 The output are the components of two constructible subsets of the locus 4532 of the parametrical system.: Normal and Non-normal. 4533 These components are 4534 given as a list of (pi,(pi1,..pis_i),type_i,level_i) varying i, 4535 where the p's are prime ideals, the type can be: Normal, Special, 4536 Accumulation, Degenerate. 4537 NOTE: It can only be called after computing the grobcov of the 4538 parametrical ideal in generic representation ('ext',0), 4539 which is the default. 4540 The basering R, must be of the form Q[a_1,..,a_m][x_1,..,x_n]. 4541 KEYWORDS: geometrical locus, locus, loci. 4542 EXAMPLE: locusdg; shows an example" 4543 { 4544 def R=basering; 4545 int dd=2; int comment=0; 4546 list DD=#; 4547 if (size(DD)>1){comment=1;} 4548 if(size(DD)>0){dd=DD[1];} 4549 int i; int j; int k; 4550 def B0=GG[1][2]; 4551 if (equalideals(B0,ideal(1))) 4552 { 4553 return(locus0dg(GG)); 4554 } 4555 else 4556 { 4557 int n=nvars(R); 4558 ideal vmov=var(n-1),var(n); 4559 ideal N; 4560 intvec xw; intvec yw; 4561 for(i=1;i<=n-1;i++){xw[i]=0;} 4562 xw[n]=1; 4563 for(i=1;i<=n;i++){yw[i]=0;} 4564 yw[n-1]=1; 4565 poly px; poly py; 4566 int te=1; 4567 i=1; 4568 while( te and i<=size(B0)) 4569 { 4570 if((deg(B0[i],xw)==1) and (deg(B0[i])==1)){px=B0[i]; te=0;} 4571 i++; 4572 } 4573 i=1; te=1; 4574 while( te and i<=size(B0)) 4575 { 4576 if((deg(B0[i],yw)==1) and (deg(B0[i])==1)){py=B0[i]; te=0;} 4577 i++; 4578 } 4579 N=px,py; 4580 setglobalrings(); 4581 te=indepparameters(N); 4582 if(te) 4583 { 4584 string("locus detected that the mover must avoid point (",N,") in order to obtain the correct locus"); 4585 // eliminates segments of GG where N is contained in the basis 4586 list nGP; 4587 def GP=GG; 4588 ideal BP; 4589 for(j=1;j<=size(GP);j++) 4590 { 4591 te=1; k=1; 4592 BP=GP[j][2]; 4593 while((te==1) and (k<=size(N))) 4594 { 4595 if(pdivi(N[k],BP)[1]!=0){te=0;} 4596 k++; 4597 } 4598 if(te==0){nGP[size(nGP)+1]=GP[j];} 4599 } 4600 } 4601 } 4602 //"T_nGP="; nGP; 4603 kill @RP; kill @P; kill @R; 4604 return(locus0dg(nGP,dd)); 4605 } 4606 example 4607 {"EXAMPLE:"; echo = 2; 4608 ring R=(0,a,b),(x4,x3,x2,x1),dp; 4609 ideal S=(x1-3)^2+(x2-1)^2-9, 4610 (4-x2)*(x3-3)+(x1-3)*(x4-1), 4611 (3-x1)*(x3-x1)+(4-x2)*(x4-x2), 4612 (4-x4)*a+(x3-3)*b+3*x4-4*x3, 4613 (a-x1)^2+(b-x2)^2-(x1-x3)^2-(x2-x4)^2; 4614 short=0; 4615 locus(grobcov(S)); " "; 4616 kill R; 4617 ring R=(0,a,b),(x,y),dp; 4618 short=0; 4619 "Concoid"; 4620 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4621 "System="; S96; " "; 4622 locusdg(grobcov(S96)); 4623 kill R; ring R=(0,x,y),(x1,x2),dp; 4624 ideal S=-(x - 5)*(x1 - 1) - (x2 - 2)*(y - 2), 4625 (x1 - 5)^2 + (x2 - 2)^2 - 4, 4626 -2*(x - 5)*(x2 - 2) + 2*(x1 - 5)*(y - 2); 4627 "System="; S; 4628 locusdg(grobcov(S)); " "; 4629 ideal S1=-(x - x1)*(x1 - 4) + (x2 - y)*(x2 - 4), 4630 (x1 - 4)^2 + (x2 - 2)^2 - 4, 4631 -2*(x1 - 4)*(2*x2 - y - 4) - 2*(x - 2*x1 + 4)*(x2 - 2); 4632 "System="; S1; 4633 locusdg(grobcov(S1)); 4634 } 4635 4636 // locusto: Transforms the output of locus to a string that 4637 // can be read by different computational systems. 4638 // input: 4639 // list L: The output of locus 4640 // output: 4641 // string s: The output of locus converted to a string readable by other programs 4642 proc locusto(list L) 4643 "USAGE: locusto(L); 4644 The argument must be the output of locus of a parametrical ideal 4645 It transforms the output into a string in standard form 4646 readable in many languages (Geogebra). 4647 RETURN: The locus in string standard form 4648 NOTE: It can only be called after computing the locus(grobcov(F)) of the 4649 parametrical ideal. 4650 The basering R, must be of the form Q[a,b,..][x,y,..]. 4651 KEYWORDS: geometrical locus, locus, loci. 4652 EXAMPLE: locusto; shows an example" 4653 { 4654 int i; int j; int k; 4655 string s="["; string sf="]"; string st=s+sf; 4656 if(size(L)==0){return(st);} 4657 ideal p; 4658 ideal q; 4659 for(i=1;i<=size(L);i++) 4660 { 4661 s=string(s,"[["); 4662 for (j=1;j<=size(L[i][1]);j++) 4663 { 4664 s=string(s,L[i][1][j],","); 4665 } 4666 s[size(s)]="]"; 4667 s=string(s,",["); 4668 for(j=1;j<=size(L[i][2]);j++) 4669 { 4670 s=string(s,"["); 4671 for(k=1;k<=size(L[i][2][j]);k++) 4672 { 4673 s=string(s,L[i][2][j][k],","); 4674 } 4675 s[size(s)]="]"; 4676 s=string(s,","); 4677 } 4678 s[size(s)]="]"; 4679 s=string(s,"]"); 4680 if(size(L[i])>=3) 4681 { 4682 s[size(s)]=","; 4683 s=string(s,string(L[i][3]),"]"); 4684 } 4685 if(size(L[i])>=4) 4686 { 4687 s[size(s)]=","; 4688 s=string(s,string(L[i][4]),"],"); 4689 } 4690 s[size(s)]="]"; 4691 s=string(s,","); 4692 } 4693 s[size(s)]="]"; 4694 return(s); 4695 } 4696 example 4697 {"EXAMPLE:"; echo = 2; 4698 ring R=(0,a,b),(x,y),dp; 4699 short=0; 4700 ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1; 4701 "System="; S96; " "; 4702 locusto(locus(grobcov(S96))); 4703 } 4704 4705 // Auxiliary routione 4395 4706 // locusdim 4396 4707 // input: … … 4437 4748 } 4438 4749 4750 // locusdgto: Transforms the output of locus to a string that 4751 // can be read by different computational systems. 4752 // input: 4753 // list L: The output of locus 4754 // output: 4755 // string s: The output of locus converted to a string readable by other programs 4756 // Outputs only the relevant dynamical geometry components. 4757 // Without unnecessary parenthesis 4758 proc locusdgto(list LL) 4759 { 4760 def RR=basering; 4761 int i; int j; int k; int short0=short; 4762 int te=0; 4763 if(defined(@P)){te=1;} 4764 else{setglobalrings();} 4765 setring @P; 4766 short=0; 4767 def L=imap(RR,LL); 4768 string s="["; string sf="]"; string st=s+sf; 4769 if(size(L)==0){return(st);} 4770 ideal p; 4771 ideal q; 4772 for(i=1;i<=size(L);i++) 4773 { 4774 if(L[i][3]=="Relevant") 4775 { 4776 s=string(s,"[["); 4777 for (j=1;j<=size(L[i][1]);j++) 4778 { 4779 s=string(s,L[i][1][j],","); 4780 } 4781 s[size(s)]="]"; 4782 s=string(s,",["); 4783 for(j=1;j<=size(L[i][2]);j++) 4784 { 4785 s=string(s,"["); 4786 for(k=1;k<=size(L[i][2][j]);k++) 4787 { 4788 s=string(s,L[i][2][j][k],","); 4789 } 4790 s[size(s)]="]"; 4791 s=string(s,","); 4792 } 4793 s[size(s)]="]"; 4794 s=string(s,"]"); 4795 s[size(s)]="]"; 4796 s=string(s,","); 4797 } 4798 } 4799 if(s=="["){s="[]";} 4800 else{s[size(s)]="]";} 4801 setring(RR); 4802 short=short0; 4803 if(te==0){kill @P; kill @R; kill @RP;} 4804 return(s); 4805 } 4439 4806 4440 4807 //********************* End locus ****************************
Note: See TracChangeset
for help on using the changeset viewer.