You could work in the polynomial ring generated by the ak, modulo the
relation ak**2 = ak:
P=PolynomialRing(GF(2),["a%d" % i for i in (0,..,5)])
I=P.ideal([u*u-u for u in P.gens()])
Q=P.quotient(I)
@cached_function
def z(k):
if k < 6: return Q.gens()[k]
return z(k-6)+z(k-3)+z(k-2)*z(k-1)
for z(40) you then get
sage: Q.lift(z(40))
a0*a1*a2*a3*a4 + a0*a1*a3*a4*a5 + a1*a2*a3*a4*a5 + a0*a1*a2*a3 +
a0*a1*a2*a4 + a0*a1*a3*a4 + a0*a1*a3*a5 + a0*a2*a3*a5 + a1*a2*a3*a5 +
a0*a2*a4*a5 + a0*a3*a4*a5 + a1*a3*a4*a5 + a2*a3*a4*a5 + a0*a1*a2 +
a0*a2*a3 + a0*a3*a4 + a0*a1*a5 + a0*a2*a5 + a1*a2*a5 + a1*a3*a5 +
a1*a4*a5 + a0*a1 + a0*a2 + a1*a3 + a2*a3 + a0*a5 + a1*a5 + a4*a5 + a4
Hope this helps,
C.
On 03/11/2014 07:02 PM, Prakash Dey wrote:
Thanks. But
x= polygen(GF(2), "a")
y= polygen(GF(2), "b")
print x+y
-----------------------> gives error
How to do this symbolic algebra in GF(2)={0,1} ?
My need is the following:
I have a recurrence relation like z[t+6]=z[t]+z[t+3]+z[t+4]*z[t+5] in GF(2)
taking z[0]=a0,z[1]=a1,...,z[5]=a5
i want to find the value of z[40] in a0,a1,..,a5
--
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.