本文整理汇总了Python中jas.PolyRing.realRoots方法的典型用法代码示例。如果您正苦于以下问题:Python PolyRing.realRoots方法的具体用法?Python PolyRing.realRoots怎么用?Python PolyRing.realRoots使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jas.PolyRing
的用法示例。
在下文中一共展示了PolyRing.realRoots方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import realRoots [as 别名]
[one,A] = r3.gens();
plot={};
plotd={};
br = 1;
for i in range(1,30):
L = QQ(-1) + (i,10);
#L = QQ(9,10) + (i,100);
fr = QQ(5) * ( (1,5) ) * A**7 - ( (21,20) * L - (29,20) ) * A**6 - ( (21,10) * L ) * A**5 + ( (1,5) ) * A**2 - ( (1,20) * L - (9,20) ) * A - ( (1,10) * L );
print "L = " + str(DD(L));
#print "fr = " + str(fr);
#print;
t = System.currentTimeMillis();
R = r3.realRoots(fr);
t = System.currentTimeMillis() - t;
# print "R = " + str([ str(DD(r.elem.getRational())) for r in R ]);
print "R = " + str([ r.elem.decimalMagnitude() for r in R ]);
plot[float(DD(L))] = R;
#print "real roots time =", t, "milliseconds";
if len(R) != br:
br = len(R);
print "#(real roots) = %s" % br;
b = L - (11,100);
for j in range(1,12):
L = b + (j,100);
fri = QQ(5) * ( (1,5) ) * A**7 - ( (21,20) * L - (29,20) ) * A**6 - ( (21,10) * L ) * A**5 + ( (1,5) ) * A**2 - ( (1,20) * L - (9,20) ) * A - ( (1,10) * L );
R = r3.realRoots(fri);
print "L = %s, Ri = %s" %(DD(L),[ r.elem.decimalMagnitude() for r in R ]);
plot[float(DD(L))] = R;
示例2: startLog
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import realRoots [as 别名]
#f = f1 * f2 * f3;
f = f1 * f2;
#f = f1 * f3;
#f = f2 * f3;
#f = f3;
#f = ( x**2 - 2 );
print "f = ", f;
print;
startLog();
t = System.currentTimeMillis();
R = r.realRoots(f);
t = System.currentTimeMillis() - t;
#print "R = ", R;
print "R = ", [ a.elem.ring.getRoot() for a in R ];
print "real roots time =", t, "milliseconds";
eps = QQ(1,10) ** (DD().elem.DEFAULT_PRECISION-3);
print "eps = ", eps;
t = System.currentTimeMillis();
R = r.realRoots(f,eps);
t = System.currentTimeMillis() - t;
#print "R = ", [ str(r) for r in R ];
print "R = ", [ a.elem.decimalMagnitude() for a in R ];
print "real roots time =", t, "milliseconds";