本文整理汇总了Python中jas.PolyRing.random方法的典型用法代码示例。如果您正苦于以下问题:Python PolyRing.random方法的具体用法?Python PolyRing.random怎么用?Python PolyRing.random使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jas.PolyRing
的用法示例。
在下文中一共展示了PolyRing.random方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PolyRing
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import random [as 别名]
from jas import PolyRing, QQ, ZM, ZZ
from jas import terminate
from jas import startLog
# polynomial examples: squarefree: characteristic 0
#r = PolyRing(PolyRing(QQ(),"u,v",PolyRing.lex),"x, y",PolyRing.lex)
#r = PolyRing(PolyRing(ZZ(),"u,v",PolyRing.lex),"x, y",PolyRing.lex)
r = PolyRing(PolyRing(ZM(7),"u,v",PolyRing.lex),"x, y",PolyRing.lex)
print "Ring: " + str(r);
print;
[one,u,v,x,y] = r.gens();
a = r.random(k=1,l=3);
b = r.random(k=1,l=3);
c = r.random(k=1,l=3);
if a.isZERO():
a = x;
if b.isZERO():
b = y;
if c.isZERO():
c = y;
f = a**2 * c**3 * b;
print "a = ", a;
print "b = ", b;
print "c = ", c;
示例2: Ring
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import random [as 别名]
from jas import Ring, PolyRing, QQ, ZZ, GF
from jas import terminate, startLog
# polynomial examples: gcd
#r = Ring( "Mod 1152921504606846883 (x,y,z) L" );
#r = Ring( "Rat(x,y,z) L" );
#r = Ring( "C(x,y,z) L" );
#r = Ring( "Z(x,y,z) L" );
r = PolyRing( QQ(), "x,y,z", PolyRing.lex );
print "Ring: " + str(r);
print;
#[one,x,y,z] = r.gens();
a = r.random();
b = r.random();
c = abs(r.random());
#c = 1;
#a = 0;
print "a = ", a;
print "b = ", b;
print "c = ", c;
print;
ac = a * c;
bc = b * c;
print "ac = ", ac;
示例3: PolyRing
# 需要导入模块: from jas import PolyRing [as 别名]
# 或者: from jas.PolyRing import random [as 别名]
from jas import PolyRing, QQ, ZM
from jas import terminate
from jas import startLog
# polynomial examples: squarefree: characteristic p, finite
# r = PolyRing(QQ(),"x, y, z",PolyRing.lex)
r = PolyRing(ZM(5, field=True), "x, y, z", PolyRing.lex)
print "Ring: " + str(r)
print
[one, x, y, z] = r.gens()
a = r.random(k=2, l=3)
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