本文整理汇总了Python中jas.PolyRing.squarefreeFactors方法的典型用法代码示例。如果您正苦于以下问题:Python PolyRing.squarefreeFactors方法的具体用法?Python PolyRing.squarefreeFactors怎么用?Python PolyRing.squarefreeFactors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jas.PolyRing
的用法示例。
在下文中一共展示了PolyRing.squarefreeFactors方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startLog
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import squarefreeFactors [as 别名]
print "f = ", f;
print;
#g = ( y**2 + ( c0 + c1 * wx + c2 * wx**2 ) );
#print "g = ", g;
#g = g**5;
#print "g = ", g;
#print;
#sys.exit();
startLog();
t = System.currentTimeMillis();
#ok: G = Yr.factors(f);
G = Yr.squarefreeFactors(f);
t = System.currentTimeMillis() - t;
print "#G = ", len(G);
#print "factor time =", t, "milliseconds";
#sys.exit();
print "f = ", f;
g = e;
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;
示例2: PolyRing
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import squarefreeFactors [as 别名]
from jas import terminate, startLog
# polynomial examples: factorization over Z_p, with p-th root
p = 5;
cr = PolyRing(GF(p),"u",PolyRing.lex );
print "Ring cr: " + str(cr);
#[one,u] = cr.gens();
fu = (u**2+u+1)**p;
print "fu = ", fu;
print;
t = System.currentTimeMillis();
G = cr.squarefreeFactors(fu);
t = System.currentTimeMillis() - t;
#print "G = ", G; #.toScript();
print "factor time =", t, "milliseconds";
for h, i in G.iteritems():
print "h**i = (", h, ")**" + str(i);
h = h**i;
print;
qcr = RF(cr);
print "Ring qcr: " + str(qcr.factory());
#not ok#r = PolyRing(cr,"x",PolyRing.lex );
r = PolyRing(qcr,"x",PolyRing.lex );
print "Ring r: " + str(r);
示例3: startLog
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import squarefreeFactors [as 别名]
b = r.random(k=2, l=3)
c = r.random(k=1, l=3)
if a.isZERO():
a = x
if b.isZERO():
b = y
if c.isZERO():
c = z
f = a ** 10 * b ** 5 * c
print "a = ", a
print "b = ", b
print "c = ", c
print "f = ", f
print
t = System.currentTimeMillis()
F = r.squarefreeFactors(f)
t = System.currentTimeMillis() - t
print "factors:"
for g in F.keys():
i = F[g]
print "g = %s**%s" % (g, i)
print
print "factor time =", t, "milliseconds"
# startLog();
terminate()
示例4: str
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import squarefreeFactors [as 别名]
print "frl = " + str(frl);
print;
t = System.currentTimeMillis();
R = r5.realRoots(frl);
t = System.currentTimeMillis() - t;
print "R = " + str([ r.elem.decimalMagnitude() for r in R ]);
print "real roots time =", t, "milliseconds";
t = System.currentTimeMillis();
R = r5.realRoots(frl,eps);
t = System.currentTimeMillis() - t;
print "R = " + str([ r.elem.decimalMagnitude() for r in R ]);
print "real roots time =", t, "milliseconds";
t = System.currentTimeMillis();
fk = r5.squarefreeFactors(frl);
#fk = r5.factors(frl);
t = System.currentTimeMillis() - t;
#print "fk = " + str(fk);
#print "factor time =", t, "milliseconds";
g = one;
for h, i in fk.iteritems():
print "h**i = (", h, ")**" + str(i);
h = h**i;
g = g*h;
#startLog();
terminate();