Thanks a lot,
I also write something simplier
def Grob(G):
S=[1]
while not(S==[]):
S=[];
for i in range(0,len(G)):
for j in range(i,len(G)):
r= AlgoDivis(spol(G[i],G[j]),G)[1];
if not(r == 0):
S=S+[r];
G=G + S;
return G;
Le mardi 18 mars 2014 23:23:17 UTC+1, Martin Albrecht a écrit :
>
> You'd write it like this:
>
> sage: sage.rings.polynomial.toy_buchberger.buchberger??
>
> G = set(F.gens())
> B = set(filter(lambda (x,y): x!=y, [(g1,g2) for g1 in G for g2 in G]))
>
> while B!=set():
> g1,g2 = select(B)
> B.remove( (g1,g2) )
>
> h = spol(g1,g2).reduce(G)
> if h != 0:
> B = B.union( [(g,h) for g in G] )
> G.add( h )
>
> if get_verbose() >= 1:
> print "%d reductions to zero."%(reductions_to_zero)
>
> return Sequence(G)
>
> :)
>
> On Tuesday 18 Mar 2014 14:07:23 etienne mann wrote:
> > I want to program the Buchberger algo to compute a grobner basis. I know
> it
> > is already in sage but for my students, I want them to rewrite it.
> > The loop is something like
> > repeat:
> > S=[];
> > for i in range(1,len(G)):
> > for j in range(1,len(G)):
> > r= AlgoDivision(SPolynomial(G[i],G[j]),G)[2];
> > if not(r==0):
> > Append(~S,r)
> > G=G + S;
> > until S==[];
> >
> > Le mardi 18 mars 2014 22:01:17 UTC+1, projetmbc a écrit :
> > > Hello,
> > > you have to learn Python a little before using Sage.
> > >
> > > In Python you just have while and for loops.
> > >
> > > What kind of repeat loop do you want to do ?
> > >
> > > Christophe BAL
> > >
> > >
> > > 2014-03-18 21:57 GMT+01:00 etienne mann <[email protected]<javascript:>
> > >
> > >> Hi,
> > >>
> > >> I did not find a reference for programing a repeat loop in sage?
> > >> Of course, I can also use a while loop but it seems strange that
> there is
> > >> no repeat loop :)
> > >>
> > >> thx for a clue
> > >> Etienne
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.