OK, I got a little addicted to thinking about this and did a slightly better job. The following function will return the weight vectors as Sage QQ vectors:
from subprocess import Popen, PIPE def weight_vectors(a_groebner_fan): """ Returns the weight vectors corresponding to the reduced Groebner bases of a groebner_fan object. """ gfan_processes = Popen(['gfan','_weightvector','-m'],stdin = PIPE, stdout=PIPE, stderr=PIPE) ans, err = gfan_processes.communicate(input = a_groebner_fan.gfan()) ans = eval(ans.replace('{','').replace('}','').replace('\n','')) ans = [vector(QQ,x) for x in ans] return ans -M. Hampton On Oct 23, 3:19 pm, Marshall Hampton <[EMAIL PROTECTED]> wrote: > OK, this is now trac #4352. I should be able to do this in the next > couple of months at the latest. > > -Marshall Hampton > > On Oct 23, 3:15 pm, Marshall Hampton <[EMAIL PROTECTED]> wrote: > > > Hi Ursula, > > > This is not currently supported by Sage in an easy way. Since you are > > interested (and I am too now), I will file a ticket for an > > enhancement, but I don't have time to work on it right away. > > > I can give you an example of how to do it in a crude way: > > > r.<x,y> = PolynomialRing(QQ,2) > > fg = r.ideal([x^2-y,y^4-x]).groebner_fan() > > from subprocess import * > > gfan_processes = Popen(['gfan','_weightvector','-m'],stdin = PIPE, > > stdout=PIPE, stderr=PIPE) > > ans, err = gfan_processes.communicate(input = fg.gfan()) > > print ans > > > will return > > > { > > (5,1), > > (3,1), > > (1,3)} > > > which I presume are the weight vectors corresponding to the three > > reduced Groebner bases in this example. > > > On Oct 23, 2:18 pm, Ursula Whitcher <[EMAIL PROTECTED]> > > wrote: > > > > I asked Anders Jensen, "I would like to compute the weight vectors > > > corresponding to each reduced Groebner basis in gfan's output. Is > > > there a way to tell gfan to do this?" > > > > He replied: > > > > "There is a command "weightvector" that does exactly this. The command > > > is hidden (does not show up in the manual or the file system). To run > > > it type "gfan _weightvector" in your shell. MIND THE SPACE BEFORE '_'. > > > According to the --help text the correct thing to do would be to run > > > "gfan _weightvector -m" with the gfan output as input. > > > > For example > > > gfan | gfan _weightvector -m > > > Q[x,y] > > > {x-y} > > > > will produce a list of two vectors. > > > I hope this works out for you. > > > Best regards, > > > Anders" > > > > Is there a way to access the weightvector command from the Sage > > > implementation of gfan? > > > > Thanks! > > > Ursula --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---