本文整理汇总了Python中jas.PolyRing.factors方法的典型用法代码示例。如果您正苦于以下问题:Python PolyRing.factors方法的具体用法?Python PolyRing.factors怎么用?Python PolyRing.factors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jas.PolyRing
的用法示例。
在下文中一共展示了PolyRing.factors方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startLog
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import factors [as 别名]
# f = x**6 + x**5 + x**4 + x**3 + x**2 + x + 1;
# f = x**2 - i;
# f = x**3 - i;
# f = x**2 + 1;
# f = x**5 - 1;
# f = x**4 + x**3 + x**2 + x + (1,);
# f = ( x**2 - i - 1 ) * ( x**2 + i + 1 );
f = (x ** 2 - i) * (x ** 2 + i + 1)
print "f = ", f
print
# startLog();
t = System.currentTimeMillis()
G = r.factors(f)
t = System.currentTimeMillis() - t
# print "G = ", G;
# print "factor time =", t, "milliseconds";
f2 = one
for h, i in G.iteritems():
print "h**i = (", h, ")**" + str(i)
h = h ** i
f2 = f2 * h
# print "f2 = ", f2;
print
if cmp(f, f2) == 0:
print "factor time =", t, "milliseconds,", "isFactors(f,g): true"
else:
示例2: cmp
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import factors [as 别名]
#f = f1**2 * f2 * f3;
f = f1 * f2 * f3;
#f = f1 * f2;
#f = f1 * f3;
#f = f2 * f3;
#f = f3;
#f = f**3;
print "f = ", f;
print;
#startLog();
t = System.currentTimeMillis();
R = r.factors(f);
t = System.currentTimeMillis() - t;
#print "R = ", R;
#print "complex factor time =", t, "milliseconds";
g = one;
for h, i in R.iteritems():
print "h**i = "+ str(h) + "**" + str(i);
h = h**i;
g = g*h;
#print "g = ", g;
if cmp(f,g) == 0:
print "complex factor time =", t, "milliseconds,", "isFactors(f,g): true" ;
else:
print "complex factor time =", t, "milliseconds,", "isFactors(f,g): ", cmp(f,g);
示例3: startLog
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import factors [as 别名]
#f = ( y**2 - 2 );
#f = ( y**2 - x );
#f = ( w2 * y**2 - 1 );
#f = ( y**2 - 1/x );
#f = ( y**2 - (1,2) );
#f = ( y**2 - 1/x ) * ( y**2 - (1,2) );
print "f = ", f;
print;
#sys.exit();
startLog();
t = System.currentTimeMillis();
G = Yr.factors(f);
t = System.currentTimeMillis() - t;
#print "G = ", G;
#print "factor time =", t, "milliseconds";
#sys.exit();
print "f = ", f;
g = one;
for h, i in G.iteritems():
if i > 1:
print "h**i = ", h, "**" + str(i);
else:
print "h = ", h;
h = h**i;
g = g*h;
示例4: PolyRing
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import factors [as 别名]
# jython examples for jas.
# $Id$
#
import operator
from jas import PolyRing, QQ
from jas import startLog, terminate
# simple factorization example
r = PolyRing( QQ(), "x,y,z", PolyRing.lex); # or PolyRing.grad
print "PolyRing: " + str(r);
print;
p = (x+y+z)**11*(x+1)**5*(y+z)**3;
#print "p: " + str(p);
#print;
#startLog();
f = r.factors( p );
print "factors: " + ", ".join( [ str(k) + "**" + str(v) for k,v in f.items() ] );
print;
mp = reduce(operator.mul, [ k**v for k,v in f.items() ] );
#print str(mp);
print "p == mp: " + str(p == mp);
print;
startLog();
terminate();
示例5: str
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import factors [as 别名]
print "i = " + str(i);
print "w2 = " + str(w2);
print "x = " + str(x);
print;
#sys.exit();
f = ( x**2 + 1 ) * ( x**2 - 2 );
print "f = ", f;
print;
startLog();
t = System.currentTimeMillis();
G = Qiw2.factors(f);
t = System.currentTimeMillis() - t;
#print "G = ", 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);
示例6: startLog
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import factors [as 别名]
# f = ( y**2 - 2 );
# f = ( y**2 - x );
# f = ( w2 * y**2 - 1 );
# f = ( y**2 - 1/x );
# f = ( y**2 - (1,2) );
# f = ( y**2 - 1/x ) * ( y**2 - (1,2) );
print "f = ", f
print
# sys.exit();
startLog()
t = System.currentTimeMillis()
G = Yr.factors(f)
t = System.currentTimeMillis() - t
# print "G = ", G;
# print "factor time =", t, "milliseconds";
# sys.exit();
print "f = ", f
g = one
for h, i in G.iteritems():
if i > 1:
print "h**i = ", h, "**" + str(i)
else:
print "h = ", h
h = h ** i
g = g * h
示例7: str
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import factors [as 别名]
print "one = " + str(one);
print "i = " + str(i);
print "x = " + str(x);
#f = x**7 - 1;
f = x**6 + x**5 + x**4 + x**3 + x**2 + x + 1;
print "f = ", f;
print;
startLog();
t = System.currentTimeMillis();
G = r.factors(f);
t = System.currentTimeMillis() - t;
print "#G = ", str(len(G));
#print "factor time =", t, "milliseconds";
## f2 = one;
## for h, i in G.iteritems():
## print "h**i = (", h, ")**" + str(i);
## h = h**i;
## f2 = f2*h;
#print "f2 = ", f2;
print;
## if cmp(f,f2) == 0:
## print "factor time =", t, "milliseconds,", "isFactors(f,g): true" ;
## else: