Python file for polynomials over field Z/2Z.
F2Polynomial class will inherit the Polynomial Class from numpy.polynomial.polynimal.
self
coef # tuple or list
Initialization:
__init__(self, coef):
return F2Polynomial
String format:
__str__(self):
return String
Degree of the polynomial:
degree(self):
return int
Addition operator +
:
__add__(self, other):
return self + other
Addition operator +=
:
__iadd__(self, other):
return self + other
Multiplication operator *
:
__mul__(self, other):
return self * other
Multiplication operator *=
:
__imul__(self, other):
return self * other
Power operator **
:
__mul__(self, power):
return self ** power
p = F2Polynomial((1, 2, 3, 4, 5, 6, 7))
print(str(p))
will print out:
1 + D^2 + D^4 + D^6
-
F2Polynomial
-
__init__
-
__str__
-
degree
-
__add__
-
__iadd__
-
__mul__
-
__imul__
-
__pow__
-