Skip to content

jonbenronron/F2Polynomials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 

Repository files navigation

F2Polynomials

Description

Python file for polynomials over field Z/2Z.

Documentation

Class F2Polynomial

F2Polynomial class will inherit the Polynomial Class from numpy.polynomial.polynimal.

Parameters:

self
coef  # tuple or list

Methods:

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

Example:

p = F2Polynomial((1, 2, 3, 4, 5, 6, 7))
print(str(p))

will print out:

1 + D^2 + D^4 + D^6

State

  • F2Polynomial
    • __init__
    • __str__
    • degree
    • __add__
    • __iadd__
    • __mul__
    • __imul__
    • __pow__