/* There are some functions for finding polynomials from a database list. You must load the file panayi.gp first. */ /* Provide a polynomial and a database (in lis), and optionally the discriminant exponent, and this function finds it in the list. Output is the first matching polynomial for the correct entry, or 0 if there are no matches. In reality, this finds the first field in the database containing a root of the given polynomial, so it can be used for other purposes as well. */ findinlist(poly, lis,mydisc= -1) = { for(j=1,length(lis), if(((mydisc== -1) || (mydisc==lis[j][2])), if(countroots(poly, lis[j][6], lis[j][1], lis[j][12], lis[j][13],1)>0, return(lis[j][6])))); return(0) } /* Given a polynomial from the database, and the database (as lis), get its index in the list */ indexofpoly(poly, lis) = for(j=1,length(lis),if(lis[j][6]==poly,return(j))); 0 /* Given a polynomial from the database, get its entry. You need to supply the database as lis. */ getpolyent(poly, lis) = lis[indexofpoly(poly,lis)]