Changeset a0192a in git
 Timestamp:
 Apr 17, 2013, 6:54:10 PM (10 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
 Children:
 0cfb6aa64026cb65330135543f21e703464c114d
 Parents:
 4740e8c847a5edf6f11b097ddc27bdabb94d3929
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/grobcov.lib
r4740e8 ra0192a 107 107 representation using extend. 108 108 109 locus2d: Special routine for determining the locus of points 110 of a two dimensional object. Given an ideal J with 111 two parameters (a,b) and so many variables as 112 needed, representing the system determining 113 the locus of points (a,b) who verify certain 114 geometrical properties, computing the grobcov of 115 J and applying to it locus2d, determines the locus. 116 117 locus2dto: Transforms the output of locus2d to a string that 118 can be reed from different computational systems. 109 locus(G): Special routine for determining the locus of points 110 of objects. Given a parametric ideal J with 111 parameters (a_1,..a_m) and variables (x_1,..,xn), 112 representing the system determining 113 the locus of points (a_1,..,a_m)) who verify certain 114 properties, computing the grobcov G of 115 J and applying to it locus, determines the different 116 classes of locus components. They can be 117 Normal, Special, Accumulation point, Degenerate. 118 The output are the components given in Pcanonical form 119 of at most 4 constructible sets: Normal, Special, Accumulation, 120 Degenerate. 121 The description of the algorithm and definitions will be 122 given in a forthcoming paper by Abanades, Botana, Montes Recio. 123 124 locusto: Transforms the output of locus to a string that 125 can be reed from different computational systems. 119 126 120 127 SEE ALSO: compregb_lib … … 147 154 defined as global variables. 148 155 NOTE: It is called internally by the fundamental routines of the 149 library grobcov, cgsdr, extend, pdivi, pnormalf, locus 2d, locus2dto,156 library grobcov, cgsdr, extend, pdivi, pnormalf, locus, locusto, 150 157 and killed before the output. 151 158 The user does not need to call it, except when it is interested … … 185 192 @P; 186 193 @RP; 187 ringlist( R);194 ringlist(@R); 188 195 ringlist(@P); 189 196 ringlist(@RP); … … 814 821 }; 815 822 816 // eliminates repeated elements form an ideal 817 proc elimrepeated( idealF)823 // eliminates repeated elements form an ideal or matrix or module or intmat or bigintmat 824 proc elimrepeated(F) 818 825 { 819 826 int i; 820 ideal FF;821 FF [1]=F[1];827 def FF=F; 828 FF=F[1]; 822 829 for (i=2;i<=ncols(F);i++) 823 830 { … … 829 836 return(FF); 830 837 } 838 839 proc elimrepeatedvl(F) 840 { 841 int i; 842 def FF=F; 843 FF=F[1]; 844 for (i=2;i<=size(F);i++) 845 { 846 if (not(memberpos(F[i],FF)[1])) 847 { 848 FF[size(FF)+1]=F[i]; 849 } 850 } 851 return(FF); 852 } 853 831 854 832 855 // equalideals … … 981 1004 } 982 1005 983 // eliminates the ith element from a list 984 proc elimfromlist(list l, int i) 985 { 986 list L; int j; 987 for(j=1;j<=i1;j++) 988 {L[j]=l[j];} 989 for(j=i+1;j<=size(l);j++) 990 {L[j1]=l[j];} 1006 // eliminates the ith element from a list or an intvec 1007 proc elimfromlist(l, int i) 1008 { 1009 if(typeof(l)=="list"){list L;} 1010 if (typeof(l)=="intvec"){intvec L;} 1011 if (typeof(l)=="ideal"){ideal L;} 1012 int j; 1013 if((size(l)==0) or (size(l)==1 and i!=1)){return(l);} 1014 if (size(l)==1 and i==1){return(L);} 1015 // L=l[1]; 1016 if(i==1) 1017 { 1018 for(j=2;j<=size(l);j++) 1019 { 1020 L[j1]=l[j]; 1021 } 1022 } 1023 else 1024 { 1025 for(j=1;j<=i1;j++) 1026 { 1027 L[j]=l[j]; 1028 } 1029 for(j=i+1;j<=size(l);j++) 1030 { 1031 L[j1]=l[j]; 1032 } 1033 } 991 1034 return(L); 992 1035 } … … 1164 1207 1165 1208 Options: 1166 "can",012: The default value is "can",2. In this case no1167 homogenization is done. With option ( "can",0) the given1168 basis is homogenized, and with option ( "can",1) the1209 \"can\",012: The default value is \"can\",2. In this case no 1210 homogenization is done. With option (\"can\",0) the given 1211 basis is homogenized, and with option (\"can\",1) the 1169 1212 whole given ideal is homogenized before computing the 1170 1213 cgs and dehomogenized after. 1171 with option ( "can",0) the homogenized basis is used1172 with option ( "can",1) the homogenized ideal is used1173 with option ( "can",2) the given basis is used1174 "null",ideal E: The default is ('null',ideal(0)).1175 "nonnull",ideal N: The default (nonnull,ideal(1)).1214 with option (\"can\",0) the homogenized basis is used 1215 with option (\"can\",1) the homogenized ideal is used 1216 with option (\"can\",2) the given basis is used 1217 \"null\",ideal E: The default is (\"null\",ideal(0)). 1218 \"nonnull\",ideal N: The default (\"nonnull\",ideal(1)). 1176 1219 When options 'null' and/or 'nonnull' are given, then 1177 1220 the parameter space is restricted to V(E)\V(N). 1178 "comment",01: The default is ('comment',0). Setting ('comment',1)1221 \"comment\",01: The default is (\"comment\",0). Setting (\"comment\",1) 1179 1222 will provide information about the development of the 1180 1223 computation. 1181 "out",01: 1 (default) the output segments are given as1224 \"out\",01: 1 (default) the output segments are given as 1182 1225 as difference of varieties. 1183 1226 0: the output segments are given in Prepresentation 1184 1227 and the segments grouped by lpp 1185 With options ( "can",0) and ("can",1) the option ("out",1)1186 is set to ( "out,0) because it is not compatible.1228 With options (\"can\",0) and (\"can\",1) the option (\"out\",1) 1229 is set to (out,0) because it is not compatible. 1187 1230 One can give none or whatever of these options. 1188 With the default options ( "can",2,"out",1), only the1231 With the default options (\"can\",2,\"out\",1), only the 1189 1232 KapurSunWang algorithm is computed. This is very effectif 1190 but is only the starting point for the grobcovcomputation.1233 but is only the starting point for the computation. 1191 1234 When grobcov is computed, the call to cgsdr inside uses 1192 1235 specific options that are more expensive ("can",01,"out",0). 1193 1236 RETURN: Returns a list T describing a reduced and disjoint 1194 1237 Comprehensive Groebner System (CGS), 1195 With option ( "out",0)1238 With option (\"out\",0) 1196 1239 the segments are grouped by 1197 1240 leading power products (lpp) of the reduced Groebner … … 1208 1251 The third element of each lpp segment is the lpp of the 1209 1252 used ideal in the CGS as a string: 1210 with option ( "can",0) the homogenized basis is used1211 with option ( "can",1) the homogenized ideal is used1212 with option ( "can",2) the given basis is used1213 1214 With option ( "out",1) (default)1253 with option (\"can\",0) the homogenized basis is used 1254 with option (\"can\",1) the homogenized ideal is used 1255 with option (\"can\",2) the given basis is used 1256 1257 With option (\"out\",1) (default) 1215 1258 only KSW is applied and segments are given as 1216 1259 difference of varieties and are not grouped … … 1276 1319 if(comment>=1) 1277 1320 { 1278 "Begin cgsdr with options: "+string(LL);1321 string("Begin cgsdr with options: ",LL); 1279 1322 } 1280 1323 int ish; … … 1282 1325 if (ish) 1283 1326 { 1284 if(comment>0){"The given system is homogneous";} 1285 can=0; 1286 } 1327 if(comment>0){string("The given system is homogneous");} 1328 def GS=KSW(B,LL); 1329 //can=0; 1330 } 1331 else 1332 { 1287 1333 // ACTING DEPENDING ON OPTIONS 1288 1334 if(can==2) 1289 1335 { 1290 1336 // WITHOUT HOMOHGENIZING 1291 if(comment>0){ "Option of cgsdr: do not homogenize";}1337 if(comment>0){string("Option of cgsdr: do not homogenize");} 1292 1338 def GS=KSW(B,LL); 1293 1339 setglobalrings(); … … 1298 1344 { 1299 1345 // COMPUTING THE HOMOGOENIZED IDEAL 1300 if(comment>0){ "Homogenizing the whole ideal: option can=1";}1346 if(comment>0){string("Homogenizing the whole ideal: option can=1");} 1301 1347 list RRL=ringlist(RR); 1302 1348 RRL[3][1][1]="dp"; … … 1319 1365 else 1320 1366 { // (can=0) 1321 if(comment>0){"Homogenizing the basis: option can=0";}1367 if(comment>0){string("Homogenizing the basis: option can=0");} 1322 1368 def B2=B; 1323 1369 } … … 1334 1380 BH[i]=homog(BH[i],@t); 1335 1381 } 1336 if (comment>=1){ "Homogenized system = "; BH;}1382 if (comment>=1){string("Homogenized system = "); BH;} 1337 1383 def GSH=KSW(BH,LH); 1338 1384 setglobalrings(); … … 1359 1405 setring(RR); 1360 1406 def GS=imap(RH,GSH); 1407 } 1408 1409 1361 1410 setglobalrings(); 1362 1411 if(out==0) … … 1714 1763 } 1715 1764 setring(RR); 1716 //if(used>0){ "addpartfine was ", used, " times used";}1765 //if(used>0){string("addpartfine was ", used, " times used");} 1717 1766 return(imap(@P,Q1)); 1718 1767 } … … 1887 1936 if(comment>=1) 1888 1937 { 1889 "Time in LCUnion + combine = ",timerstart;1890 if(comment>=2){ "lpp=",lpi};1938 string("Time in LCUnion + combine = ",timerstart); 1939 if(comment>=2){string("lpp=",lpi)}; 1891 1940 } 1892 1941 if(defined(@P)==1){kill @P; kill @RP; kill @R;} … … 1902 1951 // N is the null conditions ideal (if desired) 1903 1952 // W is the ideal of nonnull conditions (if desired) 1904 // The value of "can"is 1 by default and can be set to 0 if we do not1953 // The value of \"can\"i s 1 by default and can be set to 0 if we do not 1905 1954 // need to obtain the canonical GC, but only a GC. 1906 // The value of "ext" is 0 by default and so the generic representation1955 // The value of \"ext\" is 0 by default and so the generic representation 1907 1956 // of the bases is given. It can be set to 1, and then the full 1908 1957 // representation of the bases is given. 1909 // The value of "rep" is 0 by default, and then the segments1958 // The value of \"rep\" is 0 by default, and then the segments 1910 1959 // are given in canonical Prepresentation. It can be set to 1 1911 1960 // and then they are given in canonical Crepresentation. … … 1931 1980 1932 1981 Options: 1933 "null",ideal E: The default is ("null",ideal(0)).1934 "nonnull",ideal N: The default ("nonnull",ideal(1)).1935 When options "null" and/or "nonnull" are given, then1982 \"null\",ideal E: The default is (\"null\",ideal(0)). 1983 \"nonnull\",ideal N: The default (\"nonnull\",ideal(1)). 1984 When options \"null\" and/or \"nonnull\" are given, then 1936 1985 the parameter space is restricted to V(E)\V(N). 1937 "can",01: The default is ("can",1). With the default option1986 \"can\",01: The default is (\"can\",1). With the default option 1938 1987 the homogenized ideal is computed before obtaining the 1939 1988 Groebner cover, so that the result is the canonical 1940 Groebner cover. Setting ( "can",0) only homogenizes the1989 Groebner cover. Setting (\"can\",0) only homogenizes the 1941 1990 basis so the result is not exactly canonical, but the 1942 1991 computation is shorter. 1943 "ext",01: The default is ("ext",0). With the default1944 ( "ext",0), only the generic representation is computed1992 \"ext\",01: The default is (\"ext\",0). With the default 1993 (\"ext\",0), only the generic representation is computed 1945 1994 (single polynomials, but not specializing to nonzero at 1946 each point of the segment. With option ( "ext",1) the1995 each point of the segment. With option (\"ext\",1) the 1947 1996 full representation of the bases is computed (possible 1948 1997 shaves) and sometimes a simpler result is obtained. 1949 "rep",012: The default is ("rep",0) and then the segments1950 are given in canonical Prepresentation. Option ( "rep",1)1998 \"rep\",012: The default is (\"rep\",0) and then the segments 1999 are given in canonical Prepresentation. Option (\"rep\",1) 1951 2000 represents the segments in canonical Crepresentation, 1952 and option ( "rep",2) gives both representations.1953 "comment",03: The default is ("comment",0). Setting1954 "comment" higher will provide information about the2001 and option (\"rep\",2) gives both representations. 2002 \"comment\",03: The default is (\"comment\",0). Setting 2003 \"comment\" higher will provide information about the 1955 2004 development of the computation. 1956 2005 One can give none or whatever of these options. … … 1969 2018 1970 2019 Basis: to each element of lpp corresponds an Iregular function given 1971 in full representation (by option ( "ext",1)) or in1972 generic representation (default option ( "ext",0)). The2020 in full representation (by option (\"ext\",1)) or in 2021 generic representation (default option (\"ext\",0)). The 1973 2022 Iregular function is the corresponding element of the reduced 1974 2023 Groebner basis for each point of the segment with the given lpp. … … 1980 2029 function specializes to nonzero. 1981 2030 1982 With the default option ( "rep",0) the representation of the2031 With the default option (\"rep\",0) the representation of the 1983 2032 segment is the Prepresentation. 1984 With option ( "rep",1) the representation of the segment is2033 With option (\"rep\",1) the representation of the segment is 1985 2034 the Crepresentation. 1986 With option ( "rep",2) both representations of the segment are2035 With option (\"rep\",2) both representations of the segment are 1987 2036 given. 1988 2037 … … 2049 2098 if(not((canop==0) or (canop==1))) 2050 2099 { 2051 "Option can = ",canop," is not supported. It is changed to can = 1";2100 string("Option can = ",canop," is not supported. It is changed to can = 1"); 2052 2101 canop=1; 2053 2102 } … … 2067 2116 if (comment>=1) 2068 2117 { 2069 "Begin grobcov with options: ",string(LL);2118 string("Begin grobcov with options: ",LL); 2070 2119 } 2071 2120 kill S; … … 2116 2165 if (comment>=1) 2117 2166 { 2118 "Time in grobcov = ", timerstart;2119 "Number of segments of grobcov = ", size(S);2167 string("Time in grobcov = ", timerstart); 2168 string("Number of segments of grobcov = ", size(S)); 2120 2169 } 2121 2170 if(defined(@P)==1){kill @R; kill @P; kill @RP;} … … 2141 2190 proc extend(list GC, list #); 2142 2191 "USAGE: extend(GC); When the grobcov of an ideal has been computed 2143 with the default option ( "ext",0) and the explicit option2144 ( "rep",2) (which is not the default), then one can call2192 with the default option (\"ext\",0) and the explicit option 2193 (\"rep\",2) (which is not the default), then one can call 2145 2194 extend (GC) (and options) to obtain the full representation 2146 of the bases. With the default option ( "ext",0) only the2195 of the bases. With the default option (\"ext\",0) only the 2147 2196 generic representation of the bases are computed, and one can 2148 2197 obtain the full representation using extend. 2149 "rep",012: The default is ("rep",0) and then the segments2150 are given in canonical Prepresentation. Option ( "rep",1)2198 \"rep\",012: The default is (\"rep\",0) and then the segments 2199 are given in canonical Prepresentation. Option (\"rep\",1) 2151 2200 represents the segments in canonical Crepresentation, 2152 and option ( "rep",2) gives both representations.2153 "comment",01: The default is ("comment",0). Setting2154 "comment" higher will provide information about the2201 and option (\"rep\",2) gives both representations. 2202 \"comment\",01: The default is (\"comment\",0). Setting 2203 \"comment\" higher will provide information about the 2155 2204 time used in the computation. 2156 2205 One can give none or whatever of these options. … … 2179 2228 function specializes to nonzero. 2180 2229 2181 With the default option ( "rep",0) the segments are given2230 With the default option (\"rep\",0) the segments are given 2182 2231 in Prepresentation. 2183 With option ( "rep",1) the segments are given2232 With option (\"rep\",1) the segments are given 2184 2233 in Crepresentation. 2185 With option ( "rep",2) both representations of the segments are2234 With option (\"rep\",2) both representations of the segments are 2186 2235 given. 2187 2236 … … 2306 2355 } 2307 2356 } 2308 if(comment>=1){ "Time in extend = ",timerstart3;}2357 if(comment>=1){string("Time in extend = ",timerstart3);} 2309 2358 if(te==0){kill @R; kill @RP; kill @P;} 2310 2359 return(S); … … 2346 2395 option(redSB); 2347 2396 Pi=std(P[i]); 2348 //attrib(Pi,"isS T",1);2397 //attrib(Pi,"isSB",1); 2349 2398 if (reduce(g,Pi,1)==0){J[size(J)+1]=i;} 2350 2399 } … … 3358 3407 // F: parametric ideal to be discussed 3359 3408 // Options: 3360 // "out",0 Transforms the description of the segments into3409 // \"out\",0 Transforms the description of the segments into 3361 3410 // canonical Prepresentation form. 3362 // "out",1 Original KSW routine describing the segments as3411 // \"out\",1 Original KSW routine describing the segments as 3363 3412 // difference of varieties 3364 3413 // The ideal must be defined on C[parameters][variables] 3365 3414 // Output: 3366 // With option "out",0 :3415 // With option \"out\",0 : 3367 3416 // ((lpp, 3368 3417 // (1,B,((p_1,(p_11,..,p_1k_1)),..,(p_s,(p_s1,..,p_sk_s)))), … … 3375 3424 // ) 3376 3425 // ) 3377 // With option "out",1 ((default, original KSW) (shorter to be computed,3426 // With option \"out\",1 ((default, original KSW) (shorter to be computed, 3378 3427 // but without canonical description of the segments. 3379 3428 // ((B,E,N),..,(B,E,N)) … … 3407 3456 } 3408 3457 } 3409 if (comment>0){ "Begin KSW with null = ",string(E)," nonnull = ",string(N);}3458 if (comment>0){string("Begin KSW with null = ",E," nonnull = ",N);} 3410 3459 def CG=KSW0(F,E,N,comment); 3411 3460 if (comment>0) 3412 3461 { 3413 "Number of segments in KSW (total) = ",size(CG);3414 "Time in KSW = ",timerstart;3462 string("Number of segments in KSW (total) = ",size(CG)); 3463 string("Time in KSW = ",timerstart); 3415 3464 } 3416 3465 if(out==0) … … 3420 3469 if (comment>0) 3421 3470 { 3422 "Number of lpp segments = ",size(CG);3423 "Time in KSW + group + Prep = ",timerstart;3471 string("Number of lpp segments = ",size(CG)); 3472 string("Time in KSW + group + Prep = ",timerstart); 3424 3473 } 3425 3474 } … … 3460 3509 3461 3510 3462 3463 3511 // KSW0: KapurSunWang algorithm for computing a CGS, called by KSW 3464 3512 // Input: … … 3683 3731 3684 3732 //********************* End KapurSunWang ************************* 3685 ; 3686 //********************* Begin locus2d **************************** 3687 3688 // selfindimsols 3689 // auxilliary routine called by locus2d 3690 // input: L the list of the Grobner Cover 3691 // output: S the list of the union of segments where only a finite number 3692 // of solutions exists. 3693 // Supposed to be the set of points of the parameter space with 3694 // non degenerate solutions, for example in 3695 // automatic discovering of geometric theorems 3696 proc selfindimsols(list L) 3697 { 3698 int te=0; 3699 if (defined(@R)){te=1;} 3700 if(te==0){setglobalrings();} 3701 int i; int j; 3702 ideal v=variables(L[1][2]); 3703 ideal vv; 3704 for(i=2;i<=size(L);i++) 3705 { 3706 vv=variables(L[i][2]); 3707 for(j=1;j<=size(vv);j++) 3708 { 3709 if(memberpos(vv[j],v)[1]==0) 3710 { 3711 v[size(v)+1]=vv[j]; 3712 } 3713 } 3714 } 3715 v=elimintfromideal(v); 3716 int nvartot=size(v); 3717 ideal lpp; 3718 int isovarlpp; 3719 ideal empty; 3720 list LL; 3721 ideal B; 3722 list SL; 3723 for (i=1;i<=size(L);i++) 3724 { 3725 lpp=L[i][1]; 3726 isovarlpp=0; 3727 for (j=1;j<=size(lpp);j++) 3728 { 3729 if (size(variables(lpp[j]))==1) 3730 { 3731 isovarlpp=isovarlpp+1; 3732 } 3733 } 3734 if (isovarlpp==nvartot) 3735 { 3736 for(j=1;j<=size(L[i][3]);j++) 3737 { 3738 B=L[i][2],L[i][3][j][1]; 3739 if(size(L[i][3][j][1])==1) 3740 { 3741 if(indepparameters(B)) 3742 { 3743 SL=L[i][3][j]; 3744 SL[3]="Special"; 3745 LL[size(LL)+1]=SL; 3746 } 3747 else 3748 { 3749 LL[size(LL)+1]=L[i][3][j]; 3750 } 3751 } 3752 else 3753 { 3754 LL[size(LL)+1]=L[i][3][j]; 3755 } 3756 } 3757 } 3758 } 3759 if(te==0){kill @R; kill @P; kill @RP}; 3760 return(LL); 3761 } 3762 3763 // locus2d: Special routine for determining the locus of points 3764 // of a two dimensional object. Given an ideal J with two 3765 // parameters (a,b) and so many variables as needed, representing 3766 // the system determining the locus of points (a,b) who verify 3767 // certain geometrical properties, computing the grobcov of 3768 // J and applying to it locus2d, determines the locus. 3769 // input: 3770 // list GC, the output of grobcov 3771 // output: 3772 // list, the locus of points of the parameterspace 3773 // for which the number of solutions in the variables 3774 // is finite. 3775 // If some component corresponds to a fixed single 3776 // solution in the variables but to a curve of the 3777 // parametersapace, then "Special" stands as 3778 // the third element of the component 3779 // ((p1,(p11,..p1s_1)),..,(pk,(pk1,..pks_k)) 3780 // Possibly some component can be (p1,(p11,..p1s_1),"Special") 3781 // These components of the locus correspond to locus curves 3782 // determined by a single or a finite number of points of 3783 // the geometrical construction. 3784 proc locus2d(list GC) 3785 "USAGE: locus2d(G); 3786 The argument must be the grobcov of a two dimensional 3787 locus parametrical system with two parameters (a,b) 3788 and so many variables as needed, representing the locus 3789 points (a,b) who verify certain geometrical properties. 3790 Possibly some component can be (p1,(p11,..p1s_1),'Special') 3791 These components of the locus correspond to locus curves 3792 determined by a single or a finite number of points of 3793 the geometrical construction. 3794 RETURN: The two dimensional locus. 3795 NOTE: It can only be called after computing the grobcov of the 3796 parametrical ideal in generic representation ('ext',0), 3797 which is the default. 3798 The basering R, must be of the form Q[a,b][x,y,..]. 3799 KEYWORDS: geometrical locus, locus, loci. 3800 EXAMPLE: locus2d; shows an example" 3801 { 3802 def R=basering; 3803 setglobalrings(); 3804 def LL=selfindimsols(GC); 3805 setring(@P); 3806 def L=imap(R,LL); 3807 int i; int j; int k; int n; 3808 list LL; 3809 intvec Lprals; 3810 intvec Ldep; 3811 list empty; 3812 poly f; 3813 list Ladd; 3814 intvec Lp; 3815 ideal N; 3816 intvec si; 3817 intvec sj; 3818 intvec elimin; 3819 for(i=1;i<=size(L);i++) 3820 { 3821 if(size(L[i][1])==1) 3822 { 3823 if(Lprals==intvec(0)){Lprals=i;} 3824 else{Lprals=Lprals,i;} 3825 } 3826 else 3827 { 3828 if(Ldep==intvec(0)){Ldep=i;} 3829 else{Ldep=Ldep,i;} 3830 } 3831 } 3832 for(i=1;i<=size(Lprals);i++) 3833 { 3834 Lp=Lprals[i]; 3835 if(Ldep!=0) 3836 { 3837 for(j=1;j<=size(Ldep);j++) 3838 { 3839 N=L[Ldep[j]][1]; 3840 attrib(N,"isSB",1); 3841 f=reduce(L[Lprals[i]][1][1],N); 3842 if(f==0) 3843 { 3844 Lp=Lp,Ldep[j]; 3845 } 3846 } 3847 } 3848 Ladd[size(Ladd)+1]=Lp; 3849 } 3850 list Lfi; 3851 list La; 3852 list Lb; 3853 for (i=1;i<=size(Ladd);i++) 3854 { 3855 si=Ladd[i][1]; 3856 n=size(L[si[1]][2]); 3857 kill elimin; 3858 intvec elimin; 3859 for (j=2;j<=size(Ladd[i]);j++) 3860 { 3861 sj=Ladd[i][j]; 3862 for(k=1;k<=n;k++) 3863 { 3864 if (equalideals(L[sj][1],L[si[1]][2][k])==1) 3865 { 3866 if(elimin==intvec(0)){elimin=k;} 3867 else{elimin=elimin,k;} 3868 } 3869 } 3870 } 3871 kill Lb; list Lb; 3872 for (k=1;k<=n;k++) 3873 { 3874 if (not(memberpos(k,elimin)[1])) 3875 { 3876 Lb[size(Lb)+1]=L[si[1]][2][k]; 3877 } 3878 } 3879 if (size(Lb)==0){Lb=ideal(1);} 3880 La=list(L[si[1]][1],Lb); 3881 if(size(L[si[1]])==3){La[3]=L[si[1]][3];} 3882 Lfi[size(Lfi)+1]=La; 3883 } 3884 setring(R); 3885 list Lout=imap(@P,Lfi); 3886 kill @R; kill @RP; kill @P; 3887 return(Lout); 3888 } 3889 example 3890 {"EXAMPLE:"; echo = 2; 3891 ring R=(0,a,b),(x,y),dp; 3892 short=0; 3893 ideal H=x^2+y^24,(b2)*xa*y+2*a,(ax)^2+(by)^21; 3894 def G=grobcov(H); 3895 "grobcov(H)="; G; " "; 3896 def Gp=locus2d(G); 3897 "locus2d(G)="; Gp; 3898 } 3899 3900 // locus2dto: Transforms the output of locus2d to a string that 3901 // can be reed from different computational systems. 3902 // input: 3903 // list L: The output of locus2d 3904 // output: 3905 // string s: The output of locus2d converted to a string readable 3906 // by other programs 3907 proc locus2dto(list L) 3908 "USAGE: locus2dto(G); 3909 The argument must be the output of locus2d of a two dimensional 3910 locus parametrical system with two parameters (a,b) 3911 and so many variables as needed, representing the locus 3912 points (a,b) who verify certain geometrical properties. 3913 It transforms the output to a string in standard form 3914 readable in many languages (Geogebra). 3915 3916 RETURN: The two dimensional locus in string standard form 3917 NOTE: It can only be called after computing the locus2d(grobcov(F)) of the 3918 parametrical ideal. 3919 The basering R, must be of the form Q[a,b][x,y,..]. 3920 KEYWORDS: geometrical locus, locus, loci. 3921 EXAMPLE: locus2dto; shows an example" 3922 { 3923 int i; int j; int k; 3924 string s; 3925 s="["; 3926 ideal p; 3927 ideal q; 3928 for(i=1;i<=size(L);i++) 3929 { 3930 s=string(s,"[["); 3931 for (j=1;j<=size(L[i][1]);j++) 3932 { 3933 s=string(s,L[i][1][j],","); 3934 } 3935 s[size(s)]="]"; 3936 s=string(s,",["); 3937 for(j=1;j<=size(L[i][2]);j++) 3938 { 3939 s=string(s,"["); 3940 for(k=1;k<=size(L[i][2][j]);k++) 3941 { 3942 s=string(s,L[i][2][j][k],","); 3943 } 3944 s[size(s)]="]"; 3945 s=string(s,","); 3946 } 3947 s[size(s)]="]"; 3948 s=string(s,"],"); 3949 if(size(L[i])==3) 3950 { 3951 s[size(s)]=","; 3952 s=string(s,"[",L[i][3],"]],"); 3953 } 3954 } 3955 s[size(s)]="]"; 3956 return(s); 3957 } 3958 example 3959 {"EXAMPLE:"; echo = 2; 3960 ring R=(0,a,b),(x,y),dp; 3961 short=0; 3962 ideal H=x^2+y^24,(b2)*xa*y+2*a,(ax)^2+(by)^21; 3963 def G=grobcov(H); 3964 "grobcov(H)="; G; " "; 3965 def Gp=locus2d(G); 3966 "locus2d(G)="; Gp; 3967 def L=locus2dto(Gp); " "; 3968 "locus2dto(Gp)="; L; 3969 } 3733 3734 //******************** Begin locus ****************************** 3970 3735 3971 3736 // indepparameters 3972 // Auxiliary routine to detect "Special" components of the locus 2d3737 // Auxiliary routine to detect "Special" components of the locus 3973 3738 // Input: ideal B 3974 3739 // Output: … … 4013 3778 } 4014 3779 4015 // lsolve 4016 proc lsolve(ideal B) 4017 { 4018 int i; 4019 list L; 4020 matrix c; 4021 def v=variables(B); 4022 ideal vi; 4023 poly v0; 3780 // dimP0: Auxiliar routine 3781 // if the dimension in @P of an ideal in the parameters has dimension 0 then it returns 0 3782 // else it retuns 1 3783 proc dimP0(ideal N) 3784 { 3785 def R=basering; 3786 setring(@P); 4024 3787 int te=1; 4025 i=1; 4026 while ((i<=size(B)) and te==1) 4027 { 4028 vi=variables(B[i]); 4029 if (size(vi)==1) 4030 { 4031 v0=vi[1]; 4032 //"B[i]="; B[i]; 4033 c=coeffs(B[i],v0); 4034 if (size(c)==2) 4035 { 4036 L[size(L)+1]=list(v0,c[1,1]/c[2,1]); 4037 } 4038 else{te=0;} 4039 } 4040 else{te=0;} 3788 def NP=imap(R,N); 3789 attrib(NP,"IsSB",1); 3790 int d=dim(std(NP)); 3791 if(d==0){te=0;} 3792 setring(R); 3793 return(te); 3794 } 3795 3796 // Auxiliar routine. 3797 // input: ideals E and F (assumed in ring @P 3798 // returns: 1 if ideal E is contained in ideal F (assumed F is std basis) 3799 // 0 if not 3800 proc containedideal(ideal E, ideal F) 3801 { 3802 int i; int t; poly f; 3803 if(equalideals(F,ideal(0))) 3804 { 3805 if(equalideals(E,ideal(0))==0){return(0);} 3806 else(return(1)); 3807 } 3808 t=1; i=1; 3809 while((t==1) and (i<=size(E))) 3810 { 3811 attrib(F,"isSB",1); 3812 f=reduce(E[i],F); 3813 if(f!=0){t=0;} 4041 3814 i++; 4042 3815 } 4043 if(te==1){return(L);} 4044 } 3816 return(t); 3817 } 3818 3819 // AddCons: given a set of locally closed components of a selection of 3820 // segments of the Grobner cover, it builds the canonical Prepresentation 3821 // of the whole set. 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 Prepresentation 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 //"T_before first step L="; L; 3831 list Lend; 3832 for(i=1;i<=size(L);i++) 3833 { 3834 t=1; 3835 for(j=1;j<=size(L);j++) 3836 { 3837 if(i!=j) 3838 { 3839 if(containedideal(L[j][1],L[i][1])==1) 3840 {t=0; 3841 // "l'ideal "; L[j][1]; "esta contingut a l'ideal "; L[i][1]; 3842 j=size(L); 3843 } 3844 } 3845 } 3846 if(t==1){L1[size(L1)+1]=L[i];} 3847 else{L2[size(L2)+1]=L[i];} 3848 } 3849 // Second step: Adding segments to obtain a locally closed sets for each level 3850 int lev=1; 3851 if(size(L2)==0) 3852 { 3853 for(i=1;i<=size(L1);i++) 3854 { 3855 if(size(L1[i])>=3) 3856 {L1[i][3]=string(string(L1[i][3]),",",lev);} 3857 else{L1[i][3]=string(lev);} 3858 } 3859 return(L1); 3860 } 3861 while(size(L2)>0) 3862 { 3863 LL=addtolocalclosed(L1,L2); 3864 //"T_LL="; LL; 3865 for(i=1;i<=size(LL[1]);i++) 3866 { 3867 if(size(LL[1][i])>=3) 3868 {LL[1][i][3]=string(string(LL[1][i][3]),",",lev);} 3869 else{LL[1][i][3]=string(lev);} 3870 Lend[size(Lend)+1]=LL[1][i]; 3871 } 3872 L2=LL[2]; 3873 lev++; 3874 } 3875 return(Lend); 3876 } 3877 3878 // input: Two lists of Pcomponents to be added. 3879 // L1 contains the top components, and L2 the remaining components 3880 // each of the form ( (p_1,(p_11,..,p_1k_1).. (p_s,(p_s1,..,p_sk_s)) 3881 // output: A list of two lists: 3882 // The first one contains the Prepresentation of the top components added 3883 // The second contains the components that have not yet been added when 3884 // the total subset is not locally closed. If so addtolocalclosed is to be called 3885 // at new after separating the new top and remaining components in order 3886 // to compute the next level of the constructible set. 3887 // The input and the output must be in the ring @P of parameters. 3888 proc addtolocalclosed(list L1,list L2) 3889 { 3890 // Second step: Adding segments to obtain a locally closed set 3891 // L1 contains the top components (ideals and descendants) 3892 // L2 contains the nontop components (ideals and descendants) 3893 list LL; int i; int j; int t; intvec Added; int mesvoltes=1; intvec alreadyadded; list LN; 3894 int k; int l; int m; ideal top; ideal hole; ideal nhole; intvec nottoadd; int t0; list h; 3895 LL=L1; 3896 LN=L2; 3897 while(mesvoltes) 3898 { 3899 //"volta"; 3900 for(i=1;i<=size(L1);i++) 3901 { 3902 Added=Added,alreadyadded; 3903 Added=sort(elimrepeatedvl(Added))[1]; 3904 kill alreadyadded; intvec alreadyadded; 3905 top=LL[i][1][1]; 3906 j=1; 3907 while(j<=size(LL[i][2])) 3908 { 3909 kill nottoadd; intvec nottoadd; 3910 hole=LL[i][2][j]; 3911 t0=1; 3912 k=1; 3913 while(t0 and k<=size(LN)) 3914 { 3915 if (equalideals(hole,LN[k][1])==1) 3916 { 3917 t0=0; 3918 if(alreadyadded==intvec(0)){alreadyadded[1]=k;} 3919 else{alreadyadded[size(alreadyadded)+1]=k;} 3920 LL[i][2]=elimfromlist(LL[i][2],j); 3921 j=j1; 3922 for(l=1;l<=size(LN[k][2]);l++) 3923 { 3924 nhole=LN[k][2][l],LL[i][1]; 3925 nhole=std(nhole); 3926 t=1; m=1; 3927 while(t and m<=size(LL[i][2])) 3928 { 3929 if(containedideal(LL[i][2][m],nhole)==1) 3930 { 3931 t=0; 3932 } 3933 m++; 3934 } 3935 if(t==0){nottoadd[size(nottoadd)+1]=l;} 3936 } 3937 for(m=1;m<=size(LN[k][2]);m++) 3938 { 3939 if(memberpos(m,nottoadd)[1]==0) 3940 { 3941 LL[i][2][size(LL[i][2])+1]=LN[k][2][m]; 3942 } 3943 } 3944 } 3945 k++; 3946 3947 } 3948 j++; 3949 } 3950 if(size(LL[i][2])==0 and size(LL[i][1])>0){LL[i][2][1]=ideal(1);} 3951 } 3952 h=1,1; 3953 while((h[1]==1) and (alreadyadded!=intvec(0))) 3954 { 3955 h=memberpos(0,alreadyadded); 3956 if(h[1]==1){alreadyadded=elimfromlist(alreadyadded,h[2]);} 3957 } 3958 if(alreadyadded!=intvec(0)) 3959 {alreadyadded=sort(elimrepeatedvl(alreadyadded))[1];} 3960 if(Added==intvec(0)){Added=alreadyadded;} 3961 else{Added=sort(elimrepeatedvl(Added,alreadyadded))[1];} 3962 h=1,1; 3963 while((h[1]==1) and (Added!=intvec(0))) 3964 { 3965 h=memberpos(0,Added); 3966 if(h[1]==1){Added=elimfromlist(Added,h[2]);} 3967 } 3968 if (alreadyadded==intvec(0)) 3969 { 3970 mesvoltes=0; 3971 } 3972 } 3973 if(Added!=intvec(0)){Added=sort(elimrepeatedvl(Added))[1]; } 3974 if(Added!=intvec(0)) 3975 { 3976 for(i=1;i<=size(Added);i++) 3977 { 3978 if(size(LN)>0){LN=elimfromlist(LN,Added[size(Added)+1i]);} 3979 } 3980 } 3981 for (i=1;i<=size(LL);i++) 3982 { 3983 for(j=1;j<=size(LL[i][2]);j++) 3984 { 3985 hole=LL[i][2][j]; 3986 for (k=1;k<=size(LL);k++) 3987 { 3988 if(k!=i) 3989 { 3990 if(containedideal(LL[k][1],hole)) 3991 { 3992 LL[i][2]=elimfromlist(LL[i][2],j); 3993 for(l=1;l<=size(LL[k][2]);l++) 3994 { 3995 nhole=hole,LL[k][2][l]; 3996 nhole=std(nhole); 3997 if(equalideals(nhole,ideal(1))==0) 3998 { 3999 m=1; t=1; 4000 while(t and m<size(LL[i][2])) 4001 { 4002 if(containedideal(LL[i][2][m],nhole)){t=0;} 4003 m++; 4004 } 4005 if(t==1){LL[i][2][size(LL[i][2])+1]=nhole;} 4006 } 4007 } 4008 } 4009 } 4010 } 4011 } 4012 } 4013 LL[1]=LL; LL[2]=LN; 4014 return(LL); 4015 } 4016 4017 // locus(G): Special routine for determining the locus of points 4018 // of objects. Given a parametric ideal J with 4019 // parameters (a_1,..a_m) and variables (x_1,..,xn), 4020 // representing the system determining 4021 // the locus of points (a_1,..,a_m)) who verify certain 4022 // properties, computing the grobcov G of 4023 // J and applying to it locus, determines the different 4024 // classes of locus components. They can be 4025 // Normal, Special, Accumulation point, Degenerate. 4026 // The output are the components given in Pcanonical form 4027 // of at most 4 constructible sets: Normal, Special, Accumulation, 4028 // Degenerate. 4029 // The description of the algorithm and definitions will be 4030 // given in a forthcoming paper by Abanades, Botana, Montes Recio. 4031 4032 // input: 4033 // output: 4034 // list, the canonical Prepresentation of the 4 types of the locus: 4035 // Normal components: for each point in the component, 4036 // the number of solutions in the variables is finite, and 4037 // the solutions depend on the point in the component if the component is not 0dimensional. 4038 // Special components: for each point in the component, 4039 // the number of solutions in the variables is finite, 4040 // the component is not 0dimensional, but the solutions do not depend on the 4041 // values of the parameters in the component. 4042 // Accumlation points: are 0dimensional components for which it exist 4043 // an infinite number of solutions. 4044 // Degenerate components: are components of dimension greater than 0 for which 4045 // for every point in the component there exist infinite solutions. 4046 // The output components are given as 4047 // ((p1,(p11,..p1s_1),type_1,level_1),..,(pk,(pk1,..pks_k),type_k,level_k) 4048 // The components are given in four groups: normal, special, accumulation, degenerate 4049 // and each of these groups represent the canonical Prepresentation of the subset. 4050 // If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level 4051 // gives the depth of the component. 4052 proc locus(list G) 4053 "USAGE: locus(G); 4054 The input must be the grobcov of a parametrical ideal 4055 RETURN: The locus. 4056 The output components are given as a list of (pi,(pi1,..pis_i),type_i,level_i) varying i. 4057 NOTE: It can only be called after computing the grobcov of the 4058 parametrical ideal in generic representation ('ext',0), 4059 which is the default. 4060 The basering R, must be of the form Q[a_1,..,a_m][x_1,..,x_n]. 4061 KEYWORDS: geometrical locus, locus, loci. 4062 EXAMPLE: locus; shows an example" 4063 { 4064 int t1=1; int t2=1; 4065 def R=basering; 4066 setglobalrings(); 4067 string ty; 4068 list G1; list G2; 4069 int i; int d; int j; int k; 4070 for(i=1;i<=size(G);i++) 4071 { 4072 attrib(G[i][1],"IsSB",1); 4073 d=dim(std(G[i][1])); 4074 if(d==0){G1[size(G1)+1]=G[i];} 4075 else 4076 { 4077 if(d>0){G2[size(G2)+1]=G[i];} 4078 } 4079 } 4080 if(size(G1)==0){t1=0;} 4081 if(size(G2)==0){t2=0;} 4082 setring(@RP); 4083 if(t1) 4084 { 4085 list G1RP=imap(R,G1); 4086 } 4087 else {list G1RP;} 4088 list P1RP; 4089 ideal B; 4090 for(i=1;i<=size(G1RP);i++) 4091 { 4092 kill B; 4093 ideal B; 4094 for(k=1;k<=size(G1RP[i][3]);k++) 4095 { 4096 attrib(G1RP[i][3][k][1],"IsSB",1); 4097 G1RP[i][3][k][1]=std(G1RP[i][3][k][1]); //"T_G1RP[i][2]="; G1RP[i][2]; 4098 for(j=1;j<=size(G1RP[i][2]);j++) 4099 { 4100 B[j]=reduce(G1RP[i][2][j],G1RP[i][3][k][1]); 4101 } 4102 P1RP[size(P1RP)+1]=list(G1RP[i][3][k][1],G1RP[i][3][k][2],B); 4103 } 4104 } 4105 setring(R); 4106 if(t1) 4107 { 4108 def P1=imap(@RP,P1RP); 4109 } 4110 else{list P1;} 4111 for(i=1;i<=size(P1);i++) 4112 { 4113 if (indepparameters(P1[i][3])==1){P1[i][3]="Special";} 4114 else{P1[i][3]="Normal";} 4115 } 4116 list P2; 4117 for(i=1;i<=size(G2);i++) 4118 { 4119 for(k=1;k<=size(G2[i][3]);k++) 4120 { 4121 P2[size(P2)+1]=list(G2[i][3][k][1],G2[i][3][k][2]); // ,ty 4122 } 4123 } 4124 setring @P; 4125 if(t1==1) 4126 { 4127 def P1P=imap(R,P1); 4128 list CN; list CS; 4129 for(i=1;i<=size(P1P);i++) 4130 { 4131 d=dim(std(P1P[i][1])); 4132 if(d==0){P1P[i][3]="Normal";} 4133 if(P1P[i][3]=="Normal"){CN[size(CN)+1]=P1P[i];} 4134 else {CS[size(CS)+1]=P1P[i];} 4135 } 4136 def LN=AddCons(CN); 4137 def LS=AddCons(CS); 4138 } 4139 else{list P1P; list CN; list CS; list C2; list LN; list LS;} 4140 if(t2==1) 4141 { 4142 def C2=imap(R,P2); 4143 def L2=AddCons(C2); 4144 } 4145 else{list L2; list C2; list P2;} 4146 list LA; list LD; 4147 4148 for(i=1;i<=size(L2);i++) 4149 { 4150 d=dim(std(L2[i][1])); 4151 if(d==0) 4152 { 4153 L2[i][3]=string("Accumulation,",L2[i][3]); 4154 LA[size(LA)+1]=L2[i]; 4155 } 4156 else{L2[i][3]=string("Degenerate,",L2[i][3]); LD[size(LD)+1]=L2[i];} 4157 } 4158 4159 if(t1==0){list LN;} 4160 else{for(i=1;i<=size(LS);i++){LN[size(LN)+1]=LS[i];}} 4161 if(t2==1) 4162 { 4163 for(i=1;i<=size(LA);i++){LN[size(LN)+1]=LA[i];} 4164 for(i=1;i<=size(LD);i++){LN[size(LN)+1]=LD[i];} 4165 } 4166 setring(R); 4167 def L=imap(@P,LN); 4168 kill @R; kill @RP; kill @P; 4169 return(L); 4170 } 4171 example 4172 {"EXAMPLE:"; echo = 2; 4173 ring R=(0,a,b),(x,y),dp; 4174 short=0; 4175 ideal H=x^2+y^24,(b2)*xa*y+2*a,(ax)^2+(by)^21; 4176 def G=grobcov(H); 4177 "grobcov(H)="; G; " "; 4178 def Gp=locus(G); 4179 "locus(G)="; Gp; 4180 } 4181 4182 4183 // locusto: Transforms the output of locus to a string that 4184 // can be read by different computational systems. 4185 // input: 4186 // list L: The output of locus 4187 // output: 4188 // string s: The output of locus converted to a string readable by other programs 4189 proc locusto(list L) 4190 "USAGE: locusto(G); 4191 The argument must be the output of locus of a parametrical ideal 4192 It transforms the output into a string in standard form 4193 readable in many languages (Geogebra). 4194 4195 RETURN: The locus in string standard form 4196 NOTE: It can only be called after computing the locus(grobcov(F)) of the 4197 parametrical ideal. 4198 The basering R, must be of the form Q[a,b,..][x,y,..]. 4199 KEYWORDS: geometrical locus, locus, loci. 4200 EXAMPLE: locusto; shows an example" 4201 { 4202 int i; int j; int k; 4203 string s; 4204 s="["; 4205 ideal p; 4206 ideal q; 4207 for(i=1;i<=size(L);i++) 4208 { 4209 s=string(s,"[["); 4210 for (j=1;j<=size(L[i][1]);j++) 4211 { 4212 s=string(s,L[i][1][j],","); 4213 } 4214 s[size(s)]="]"; 4215 s=string(s,",["); 4216 for(j=1;j<=size(L[i][2]);j++) 4217 { 4218 s=string(s,"["); 4219 for(k=1;k<=size(L[i][2][j]);k++) 4220 { 4221 s=string(s,L[i][2][j][k],","); 4222 } 4223 s[size(s)]="]"; 4224 s=string(s,","); 4225 } 4226 s[size(s)]="]"; 4227 s=string(s,"]"); 4228 if(size(L[i])>=3) 4229 { 4230 s[size(s)]=","; 4231 s=string(s,string(L[i][3]),"]"); 4232 } 4233 if(size(L[i])>=4) 4234 { 4235 s[size(s)]=","; 4236 s=string(s,string(L[i][4]),"],"); 4237 } 4238 s[size(s)]="]"; 4239 s=string(s,","); 4240 } 4241 s[size(s)]="]"; 4242 return(s); 4243 } 4244 example 4245 {"EXAMPLE:"; echo = 2; 4246 ring R=(0,a,b),(x,y),dp; 4247 short=0; 4248 ideal H=x^2+y^24,(b2)*xa*y+2*a,(ax)^2+(by)^21; 4249 def G=grobcov(H); 4250 "grobcov(H)="; G; " "; 4251 def Gp=locus(G); 4252 "locus(G)="; Gp; 4253 def L=locusto(Gp); " "; 4254 "locusto(Gp)="; L; 4255 } 4256 4257 //********************* End locus **************************** 4258 ;
Note: See TracChangeset
for help on using the changeset viewer.