Rozwiązanie zadania "Ilorazy pierścienia wielomianów" #35
25
main.py
25
main.py
@ -270,12 +270,12 @@ class PolyIntField:
|
||||
nilpotents = []
|
||||
|
||||
for e in self.elements:
|
||||
if not e.is_empty():
|
||||
for f in self.elements:
|
||||
if not f.is_empty():
|
||||
if (e ** f) % self.poly_modulo == e:
|
||||
nilpotents.append(e)
|
||||
for n in range(1, self.int_modulo):
|
||||
if ((e ** n) % self.poly_modulo).elements == {}:
|
||||
nilpotents.append(list(reversed(list(e.elements.values()))))
|
||||
break
|
||||
|
||||
nilpotents[nilpotents.index([])] = [0]
|
||||
return nilpotents
|
||||
|
||||
def idempotents(self):
|
||||
@ -304,22 +304,21 @@ class PolyIntField:
|
||||
str_form = "[\n\t"
|
||||
str_form += str([]) + "\n\t"
|
||||
str_form += str([]) + "\n\t"
|
||||
str_form += str([]) + "\n\t"
|
||||
str_form += str(self.nilpotents()) + "\n\t"
|
||||
str_form += str(self.idempotents()) + "\n"
|
||||
str_form += "]\n"
|
||||
return str_form
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
pf = PolyIntField(2, [1, 1, 1])
|
||||
print(pf)
|
||||
|
||||
poly_field = PolyIntField(3, [1, 1, 2, 2])
|
||||
print(poly_field)
|
||||
# x = poly_field.idempotents()
|
||||
# for e in x:
|
||||
# print(e)
|
||||
#
|
||||
# print()
|
||||
pf = PolyIntField(2, [1, 1, 1])
|
||||
print(pf)
|
||||
# print(poly_field)
|
||||
# y = pf.idempotents()
|
||||
# for i in y:
|
||||
# print(i)
|
||||
|
Loading…
Reference in New Issue
Block a user