Пример #1
0
##     + ( ( y + 2 ) * z**2 + ( y**2 + 2 * y + 1 ) * z + 2 * y**2 + y ) * x \
##     + ( y + 1 ) * z**3 + ( y + 1 ) * z**2 + ( y**3 + y**2 ) * z + y**3 + y**2;

# f = ( x + y * z + y + z + 1 ) * ( x**2 + ( y + z ) * x + y**2 + z**2 );
f = (x + y * z + y + z + 1) * (x ** 2 + (y + z) * x + y ** 2 + 1)

# f = ( x + y ) * ( x - y);


print "f = ", f
print

startLog()

t = System.currentTimeMillis()
G = r.factors(f)
t = System.currentTimeMillis() - t
print "#G = ", len(G)
# print "factor time =", t, "milliseconds";

g = one
for h, i in G.iteritems():
    print "h**i = (", h, ")**" + str(i)
    h = h ** i
    g = g * h
# print "g = ", g;

if cmp(f, g) == 0:
    print "factor time =", t, "milliseconds,", "isFactors(f,g): true"
else:
    print "factor time =", t, "milliseconds,", "isFactors(f,g): ", cmp(f, g)