Ask Your Question

dlucas's profile - activity

2015-11-11 23:34:54 +0200 received badge  Teacher (source)
2015-11-11 23:13:27 +0200 answered a question Generate all binary strings of length n

Hello,

Correct me if I'm wrong, but want you want to have is a list of all binary words of length 15. You can list all these words with the following commands:

sage: V = VectorSpace(GF(2), 15) #all binary words of length 15 live here
sage: l = V.list()
sage: v0 = l[0]
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
sage: l[42]
(0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0)

etc.

And then you can access any coordinate (=bit) by typing

sage: v0[i] #where i is the index of the coordinate you want
2015-07-03 21:51:15 +0200 answered a question Linear codes over finite ring

Hello,

Finite chain rings are not (yet) supported in Sage. Someone posted a patch on it on the updtae system (see: http://trac.sagemath.org/ticket/13398).

I know it's not exactly the issue here, but for now you can try the following:

sage: F = GF(2)
sage: R.<x> = F[]
sage: g = 1+x+x^2+x^3+x^4
sage: C = codes.CyclicCode(5, g)

to build your code (sorry about the bad formatting). Of course, it's over GF(2), not over a chain ring...