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


Python Ring.gens方法代码示例

本文整理汇总了Python中jas.Ring.gens方法的典型用法代码示例。如果您正苦于以下问题:Python Ring.gens方法的具体用法?Python Ring.gens怎么用?Python Ring.gens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jas.Ring的用法示例。


在下文中一共展示了Ring.gens方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Ring

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
from java.lang import Integer

from jas import Ring
from jas import Ideal
from jas import terminate
from jas import startLog

# polynomial examples: factorization over Q

#r = Ring( "Rat(x) L" );
r = Ring( "Q(x) L" );

print "Ring: " + str(r);
print;

[one,x] = r.gens();

#f = x**15 - 1;
#f = x * ( x + 1 )**2 * ( x**2 + x + 1 )**3;
#f = x**6 - 3 * x**5 + x**4 - 3 * x**3 - x**2 - 3 * x+ 1;
#f = x**(3*11*11) + 3 * x**(2*11*11) - x**(11*11);
#f = x**(3*11*11*11) + 3 * x**(2*11*11*11) - x**(11*11*11);
#f = (x**2+1)*(x-3)*(x-5)**3;
#f = x**4 + 1;
#f = x**12 + x**9 + x**6 + x**3 + 1;
#f = x**24 - 1;
#f = x**20 - 1;
#f = x**22 - 1;
#f = x**8 - 40 * x**6 + 352 * x**4 - 960 * x**2 + 576;
#f = 362408718672000 * x**9 + 312179013226080 * x**8 - 591298435728000 * x**6 - 509344705789920 * x**5 - 1178946881112000 * x**2 - 4170783473878580 * x - 2717923400363451;
开发者ID:,项目名称:,代码行数:32,代码来源:

示例2: Ring

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
from jas import startLog

# polynomial examples: factorization

# 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 = Ring( "Z(x) L" );
# r = Ring( "Mod 3 (x,y,z) L" );
# r = Ring( "Z(y,x) L" );

print "Ring: " + str(r)
print

[one, x, y, z] = r.gens()

# f = z * ( y + 1 )**2 * ( x**2 + x + 1 )**3;
# f = z * ( y + 1 ) * ( x**2 + x + 1 );
# f = ( y + 1 ) * ( x**2 + x + 1 );
# f = ( y + z**2 ) * ( x**2 + x + 1 );

# f = x**4 * y + x**3  + z + x   + z**2 + y * z**2;
## f = x**3 + ( ( y + 2 ) * z + 2 * y + 1 ) * x**2 \
##     + ( ( y + 2 ) * z**2 + ( y**2 + 2 * y + 1 ) * z + 2 * y**2 + y ) * x \
##     + ( y + 1 ) * z**3 + ( y + 1 ) * z**2 + ( y**3 + y**2 ) * z + y**3 + y**2;

# f = ( x + y * z + y + z + 1 ) * ( x**2 + ( y + z ) * x + y**2 + z**2 );
f = (x + y * z + y + z + 1) * (x ** 2 + (y + z) * x + y ** 2 + 1)

# f = ( x + y ) * ( x - y);
开发者ID:rjolly,项目名称:jas,代码行数:33,代码来源:factors_mult.py

示例3: H

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate

# hermite polynomial example
# H(0) = 1
# H(1) = 2 * x
# H(n) = 2 * x * H(n-1) - 2 * (n-1) * H(n-2)

r = Ring( "Z(x) L" );
print "Ring: " + str(r);
print;

# sage like: with generators for the polynomial ring
[x] = r.gens();

one = r.one();
x2 = 2 * x;

N = 10;
H = [one,x2];
for n in range(2,N):
    h = x2 * H[n-1] - 2 * (n-1) * H[n-2];
    H.append( h );

for n in range(0,N):
    print "H[%s] = %s" % (n,H[n]);

print;
开发者ID:lukaszzdanikowski,项目名称:randoop,代码行数:32,代码来源:hermite.py

示例4: CC

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
c = CC((2,),(3,));
print "c:", c;
print "c^5:", c**5 + c.one();
print;

c = CC( (2,),rn );
print "c:", c;
print;


r = Ring( "Q(x,y) L" );
print "Ring: " + str(r);
print;

# sage like: with generators for the polynomial ring
[x,y] = r.gens();
one = r.one();
zero = r.zero();

try:
    f = RF();
except:
    f = None;
print "f: " + str(f);

d = x**2 + 5 * x - 6;
f = RF(d);
print "f: " + str(f);

n = d*d + y + 1;
f = RF(d,n);
开发者ID:lukaszzdanikowski,项目名称:randoop,代码行数:33,代码来源:arith.py

示例5: cosmap

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
ps8 = psr.fixPoint( cosmap( psr.ring.coFac ) );
print "ps8:", ps8;
print;

ps9 = ps8 - c;
print "ps9:", ps9;
print;


# conversion from polynomials

pr = Ring("Q(y) L");
print "pr:", pr;
print;

[one,yp] = pr.gens();

p1 = one;
p2 = one - yp;

ps1 = psr.fromPoly(p1);
ps2 = psr.fromPoly(p2);

# rational function as power series:
ps3 = ps1 / ps2;

print "p1:", p1;
print "p2:", p2;
print "ps1:", ps1;
print "ps2:", ps2;
print "ps3:", ps3;
开发者ID:rjolly,项目名称:jas,代码行数:33,代码来源:powerseries.py

示例6: cosmap

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
ps8 = psr.fixPoint( cosmap( psr.ring.coFac ) );
print "ps8:", ps8;
print;

ps9 = ps8 - c;
print "ps9:", ps9;
print;


# conversion from polynomials

pr = Ring("Q(y) L");
print "pr:", pr;
print;

[yp] = pr.gens();

one = pr.one();
p1 = one;
p2 = one - yp;

ps1 = psr.from(p1);
ps2 = psr.from(p2);

# rational function as power series:
ps3 = ps1 / ps2;

print "p1:", p1;
print "p2:", p2;
print "ps1:", ps1;
print "ps2:", ps2;
开发者ID:lukaszzdanikowski,项目名称:randoop,代码行数:33,代码来源:powerseries.py

示例7: Ring

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
## print "c1:", c1;
## print;

s2c2 = s*s+c*c; # sin^2 + cos^2 = 1
print "s2c2:", s2c2;
print;

#sys.exit();

# conversion from polynomials

pr = Ring("Q(x,y,z) L");
print "pr:", pr;
print;

[one,xp,yp,zp] = pr.gens();

p1 = one;
p2 = one - yp;

ps1 = psr.fromPoly(p1);
ps2 = psr.fromPoly(p2);

# rational function as power series:
ps3 = ps1 / ps2;

print "p1:", p1;
print "p2:", p2;
print "ps1:", ps1;
print "ps2:", ps2;
print "ps3:", ps3;
开发者ID:rjolly,项目名称:jas,代码行数:33,代码来源:powerseries_multi.py

示例8: CC

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
c = CC((2,),(3,));
print "c:", c;
print "c^5:", c**5 + c.one();
print;

c = CC( (2,),rn );
print "c:", c;
print;


r = Ring( "Q(x,y) L" );
print "Ring: " + str(r);
print;

# sage like: with generators for the polynomial ring
[one,x,y] = r.gens();
zero = r.zero();

try:
    f = RF(r);
except:
    f = None;
print "f: " + str(f);

d = x**2 + 5 * x - 6;
f = RF(r,d);
print "f: " + str(f);

n = d*d + y + 1;
f = RF(r,d,n);
print "f: " + str(f);
开发者ID:,项目名称:,代码行数:33,代码来源:

示例9: Ring

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
# trinks 6/7 example

#r = Ring( "Mod 19 (B,S,T,Z,P,W) L" );
#r = Ring( "Mod 1152921504606846883 (B,S,T,Z,P,W) L" ); # 2^60-93
#r = Ring( "Quat(B,S,T,Z,P,W) L" );
#r = Ring( "Z(B,S,T,Z,P,W) L" );
#r = Ring( "C(B,S,T,Z,P,W) L" );
#r = Ring( "Z(B,S,T,Z,P,W) L" );
#r = Ring( "IntFunc(e,f)(B,S,T,Z,P,W) L" );
r = Ring( "Z(B,S,T,Z,P,W) L" );
#r = Ring( "Q(B,S,T,Z,P,W) L" );
print "Ring: " + str(r);
print;

# sage like: with generators for the polynomial ring
print "r.gens() = ", [ str(f) for f in r.gens() ];
print;
#[e,f,B,S,T,Z,P,W] = r.gens();
[B,S,T,Z,P,W] = r.gens();

f1 = 45 * P + 35 * S - 165 * B - 36;
f2 = 35 * P + 40 * Z + 25 * T - 27 * S;
f3 = 15 * W + 25 * S * P + 30 * Z - 18 * T - 165 * B**2;
f4 = - 9 * W + 15 * T * P + 20 * S * Z;
f5 = P * W + 2 * T * Z - 11 * B**3;
f6 = 99 * W - 11 *B * S + 3 * B**2;
f7 = 10000.0 * B**2 + 6600 * B + 2673;
#all ok:
#f7 = f7 + e * f6**0;
#f7 = f7 + 5959345574908321469098512640906154241024000000**2 * f6;
#f7 = f7 + 35555./332 * f1;
开发者ID:lukaszzdanikowski,项目名称:randoop,代码行数:33,代码来源:trinks_s.py

示例10: Ring

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
# trinks 6/7 example

#r = Ring( "Mod 19 (B,S,T,Z,P,W) L" );
#r = Ring( "Mod 1152921504606846883 (B,S,T,Z,P,W) L" ); # 2^60-93
#r = Ring( "Quat(B,S,T,Z,P,W) L" );
#r = Ring( "Z(B,S,T,Z,P,W) L" );
#r = Ring( "C(B,S,T,Z,P,W) L" );
#r = Ring( "Z(B,S,T,Z,P,W) L" );
#r = Ring( "IntFunc(e,f)(B,S,T,Z,P,W) L" );
r = Ring( "Z(B,S,T,Z,P,W) L" );
#r = Ring( "Q(B,S,T,Z,P,W) L" );
print "Ring: " + str(r);
print;

# sage like: with generators for the polynomial ring
print "r.gens() = ", [ str(f) for f in r.gens() ];
print;
#[one,e,f,B,S,T,Z,P,W] = r.gens();
#automatic: [one,B,S,T,Z,P,W] = r.gens();

f1 = 45 * P + 35 * S - 165 * B - 36;
f2 = 35 * P + 40 * Z + 25 * T - 27 * S;
f3 = 15 * W + 25 * S * P + 30 * Z - 18 * T - 165 * B**2;
f4 = - 9 * W + 15 * T * P + 20 * S * Z;
f5 = P * W + 2 * T * Z - 11 * B**3;
f6 = 99 * W - 11 *B * S + 3 * B**2;
f7 = 10000 * B**2 + 6600 * B + 2673;
#all ok:
#f7 = f7 + e * f6**0;
#f7 = f7 + 5959345574908321469098512640906154241024000000**2 * f6;
#f7 = f7 + 35555./332 * f1;
开发者ID:rjolly,项目名称:jas,代码行数:33,代码来源:trinks_s.py

示例11: Ring

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
from jas import Ring
from jas import Ideal
from jas import terminate
from jas import 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" );

print "Ring: " + str(r);
print;

[x,y,z] = r.gens();

one = r.one();
a = r.random();
b = r.random();
c = abs(r.random());
#c = 1; 
#a = 0;

f = x * a + b * y**2 + one * z**7;

print "a = ", a;
print "b = ", b;
print "c = ", c;
print "f = ", f;
print;
开发者ID:lukaszzdanikowski,项目名称:randoop,代码行数:33,代码来源:polynomial.py

示例12: Ring

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gens [as 别名]
# trinks 6/7 example

# r = Ring( "Mod 19 (B,S,T,Z,P,W) L" );
# r = Ring( "Mod 1152921504606846883 (B,S,T,Z,P,W) L" ); # 2^60-93
# r = Ring( "Quat(B,S,T,Z,P,W) L" );
# r = Ring( "Z(B,S,T,Z,P,W) L" );
# r = Ring( "C(B,S,T,Z,P,W) L" );
# r = Ring( "Z(B,S,T,Z,P,W) L" );
# r = Ring( "IntFunc(e,f)(B,S,T,Z,P,W) L" );
r = Ring("Z(B,S,T,Z,P,W) L")
# r = Ring( "Q(B,S,T,Z,P,W) L" );
print "Ring: " + str(r)
print

# sage like: with generators for the polynomial ring
print "r.gens() = ", [str(f) for f in r.gens()]
print
# [one,e,f,B,S,T,Z,P,W] = r.gens();
[one, B, S, T, Z, P, W] = r.gens()

f1 = 45 * P + 35 * S - 165 * B - 36
f2 = 35 * P + 40 * Z + 25 * T - 27 * S
f3 = 15 * W + 25 * S * P + 30 * Z - 18 * T - 165 * B ** 2
f4 = -9 * W + 15 * T * P + 20 * S * Z
f5 = P * W + 2 * T * Z - 11 * B ** 3
f6 = 99 * W - 11 * B * S + 3 * B ** 2
f7 = 10000 * B ** 2 + 6600 * B + 2673
# all ok:
# f7 = f7 + e * f6**0;
# f7 = f7 + 5959345574908321469098512640906154241024000000**2 * f6;
# f7 = f7 + 35555./332 * f1;
开发者ID:rjolly,项目名称:jas,代码行数:33,代码来源:trinks_s.py


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