Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168733
Image: ubuntu2004
# Polynomials over the field with 2 elements and variable 'X' R.<X>=GF(2)[]
P=X^2+X^4+X^5+X^8 PP1=P*X; print PP1 PP2=P*(X+1); print PP2
X^9 + X^6 + X^5 + X^3 X^9 + X^8 + X^6 + X^4 + X^3 + X^2
def pol2binary(poly): lst=list(poly) #for x in range(0,len(lst)): # print lst[x] lst.reverse() return lst
pol2binary(PP1)
[1, 0, 0, 1, 1, 0, 1, 0, 0, 0]
def interleaving(lst1,lst2): y=0 lst = [] for x in range(0,len(lst1)): lst.append(lst1[x]) lst.append(lst2[y]) if y<=len(lst2): y=y+1 print lst
interleaving(pol2binary(PP1),pol2binary(PP2))
[1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0]