Rozwiązanie zadania "Ilorazy pierścienia wielomianów" #35
42
main.py
42
main.py
@ -1,4 +1,6 @@
|
|||||||
import itertools
|
import itertools
|
||||||
|
import ast
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class Poly:
|
class Poly:
|
||||||
@ -313,39 +315,23 @@ class PolyIntField:
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
str_form = "[\n\t"
|
str_form = "[\n\t"
|
||||||
str_form += str(self.invertibles()) + ",\n\t"
|
str_form += str(self.invertibles()) + ", # odwracalne\n\t"
|
||||||
str_form += str(self.zero_divisors()) + ",\n\t"
|
str_form += str(self.zero_divisors()) + ", # dzielniki zera\n\t"
|
||||||
str_form += str(self.nilpotents()) + ",\n\t"
|
str_form += str(self.nilpotents()) + ", # nilpotenty\n\t"
|
||||||
str_form += str(self.idempotents()) + "\n"
|
str_form += str(self.idempotents()) + " # idempotenty\n"
|
||||||
str_form += "]\n"
|
str_form += "]\n"
|
||||||
return str_form
|
return str_form
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# print(phi(36))
|
|
||||||
|
|
||||||
# a = Poly(5, [1])
|
if len(sys.argv) < 3:
|
||||||
# b = Poly(5, [3, 5])
|
print("Niepoprawny input")
|
||||||
# # print(a == )
|
exit(1)
|
||||||
# p = Poly(2, [1, 1, 1])
|
|
||||||
# c = Poly(2, [1, 1])
|
|
||||||
# d = Poly(2, [1])
|
|
||||||
# print(c * Poly(2, [0, 1]) % p)
|
|
||||||
# print(d)
|
|
||||||
# print((c * Poly(2, [0, 1]) % p) == d)
|
|
||||||
# pf = PolyIntField(2, [1, 1, 1])
|
|
||||||
# print(pf.invertibles())
|
|
||||||
# a = pf.invertibles()
|
|
||||||
# for i in a:
|
|
||||||
# print(i)
|
|
||||||
|
|
||||||
# a = Poly(5, [1, 1])
|
if sys.argv[1].find(",") != -1:
|
||||||
# print(a.elements == {"x1": 1, "x0": 1})
|
print(f"Proszę użyć spacji, nie przecinków: '{sys.argv[1]}'")
|
||||||
# [[1], [2], [0, 1], [0, 2], [0, 0, 1], [1, 0, 1], [2, 1, 1], [2, 2, 1], [0, 0, 2], [2, 0, 2], [1, 1, 2], [1, 2, 2]], # odwracalne
|
exit(1)
|
||||||
# [ ],
|
|
||||||
|
|
||||||
# [[0, 0, 1], [0, 0, 2], [0, 1], [0, 1, 1], [0, 1, 2], [0, 2], [0, 2, 1], [0, 2, 2], [1], [1, 0, 1], [1, 0, 2], [1, 1], [1, 1, 1], [1, 1, 2], [1, 2], [1, 2, 1], [1, 2, 2], [2], [2, 0, 1], [2, 0, 2], [2, 1], [2, 1, 1], [2, 1, 2], [2, 2], [2, 2, 1], [2, 2, 2]
|
field = PolyIntField(int(sys.argv[1]), ast.literal_eval(sys.argv[2]))
|
||||||
d = [[1], [2], [0, 1], [0, 2], [0, 0, 1], [1, 0, 1], [2, 1, 1], [2, 2, 1], [0, 0, 2], [2, 0, 2], [1, 1, 2], [1, 2, 2]]
|
print(field)
|
||||||
print(len(d))
|
|
||||||
poly_field = PolyIntField(3, [1, 1, 2, 2])
|
|
||||||
print(poly_field)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user