示例#1
0
文件: boolean_cgb.py 项目: rjolly/jas
print "a   = " + str(a);
print "x   = " + str(x);
print "y   = " + str(y);

#brel = [ a**2 - a, x**2 - x, y**2 - y ]; 
brel = [ x**2 - x, y**2 - y ]; 

#print "brel = " + str(brel[0]) + ", " + str(brel[1]) + ", " + str(brel[2]);
print "brel = " + str(brel[0]) + ", " + str(brel[1]);

pl = [ ( one + s1 + s2 ) * ( x*y + x + y ), s1 * x + s1, a * y + a, x * y ];


pl = pl + brel;


startLog();

f = ParamIdeal(r,list=pl);
print "Ideal: " + str(f);

gb = f.regularGB();
print "boolean GB: " + str(gb);

#ss = gb.stringSlice();
#print "regular string slice: " + str(ss);

terminate();
#sys.exit();

示例#2
0
f4 = a * b * c * d + b * c * d * e + c * d * e * a + d * e * a * b + e * a * b * c
f5 = a * b * c * d * e - 1

print "f1 = ", f1
print "f2 = ", f2
print "f3 = ", f3
print "f4 = ", f4
print "f5 = ", f5
print

F = r.ideal(list=[f1, f2, f3, f4, f5])

print "F = ", F
print

startLog()

t = System.currentTimeMillis()
R = F.realRoots()
t = System.currentTimeMillis() - t
print
print "R = ", R
print
print "real roots: "
F.realRootsPrint()
print "real roots time =", t, "milliseconds"
print

print "F = ", F
print
f3 = a*b*c + b*c*d + c*d*e + d*e*a + e*a*b;
f4 = a*b*c*d + b*c*d*e + c*d*e*a + d*e*a*b + e*a*b*c;
f5 = a*b*c*d*e - 1;

print "f1 = ", f1;
print "f2 = ", f2;
print "f3 = ", f3;
print "f4 = ", f4;
print "f5 = ", f5;
print;

F = r.ideal( list=[f1,f2,f3,f4,f5] );
print "F = ", F;
print;

startLog();

t = System.currentTimeMillis();
R = F.complexRoots();
#R = F.realRoots();
t = System.currentTimeMillis() - t;
print;
print "R = ", R;
print;
print "complex roots: ";
F.complexRootsPrint()
print "complex roots time =", t, "milliseconds";
print;

print "F = ", F;
print;
f2 = z ** 2 - y ** 2

print "w1 = ", w1
print "w2 = ", w2
print "f1 = ", f1
print "f2 = ", f2
print

F = Q.ideal(list=[w1, w2, f1, f2])

print "F = ", F
print

# sys.exit();

startLog()

t = System.currentTimeMillis()
P = F.primeDecomp()
# P = F.primaryDecomp();
t1 = System.currentTimeMillis() - t
print "P = ", P
print
print "prime/primary decomp time =", t1, "milliseconds"
print

print "F = ", F
print

# startLog();
terminate()