This commit is contained in:
Ata Deniz Aydın 2017-05-14 18:03:14 +03:00 committed by GitHub
parent 0cfc2d3066
commit 87662b3399

18
poly.py Normal file
View file

@ -0,0 +1,18 @@
# Finding roots of polynomials in p-adic integers using Hensel's lemma
from padic import *
from collections import defaultdict
class Poly:
'Polynomial class.'
def __init__(self, coeffs = None):
self.coeffs = defaultdict(int, coeffs or {})
self.deg = 0
# TODO arithmetic
X = Poly({1:1})
class ConstPoly(Poly):
'Constant polynomial.'
def __init__(self, coeff):
Poly.__init__(self, {0:coeff})