当前位置: 首页>>代码示例>>Python>>正文


Python PolyRing.random方法代码示例

本文整理汇总了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;
开发者ID:,项目名称:,代码行数:33,代码来源:

示例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;
开发者ID:rjolly,项目名称:jas,代码行数:33,代码来源:gcd.py

示例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
开发者ID:rjolly,项目名称:jas,代码行数:32,代码来源:squarefree_finite.py


注:本文中的jas.PolyRing.random方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。