Singular https://www.singular.uni-kl.de/forum/ |
|
select polynomials including given variables from set of pol https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1807 |
Page 1 of 1 |
Author: | gepo [ Tue Mar 16, 2010 12:27 am ] |
Post subject: | select polynomials including given variables from set of pol |
Since I cannot put all the words in the subject frame, I leave it here: how to choose polynomials containing given variables from a list of polynomials? Hi, all, I have a list of polynomials and then I want to get What I want are polynomials only containing all subsets of the set of given variables (including the whole set itself, but without empty subset). For example, I have a list: L:=[a+b+c,x+ab+d^3,y+c]; and I am only interested in polynomials which include varaibles "a", "b", "c", which is finally "a+b+c". Which command can implement this? thanks Gepo |
Author: | gorzel [ Wed Mar 17, 2010 11:04 pm ] |
Post subject: | Re: select polynomials including given variables from set of pol |
First, you should use the data type ideal, when working with a collection of polynomials; it offers more functionality than the data type list, which must be used when objects of different type should grouped together. As I understand, you want to define a set of variables, and then select those polynomials, which depend on all, but only on, these variables. Is this what you want to do? Some ingredients how to do this. There is a command variables which, applied to a polynomial, returns an ideal of the variables which occur in the polynomial. To check if this coincides with those you want to consider, you have to verify equality of ideals. You do this with the command reduce by vice versa checking the inclusion. Best you define a reference polynmial, which is built on the variables you want to have. Then call this Code: proc dependent(ideal I,poly f) " USAGE: dependent(I,f); I ideal, f poly RETURN: ideal, entries of I which contain the same variables as f 0 if no such entry exist " { ideal refvars = variables(f); ideal J; int i,j; for (i=1;i<=ncols(I);i++) { if ((reduce(I[i],std(refvars))+0 == 0) and (reduce(refvars,std(I[i]))+0 == 0) ) { j++; J[j]=I[i]; } } return(J); } Be aware, I don't have tested but just coded it. Your example then should work as follows: Code: > ring r =0,(a,b,c,d,x,y),dp;
> ideal I = a+b+c,x+ab+d^3,y+c; > dependent(I,abc); _[1] = a+b+c |
Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |