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


Python jas.PolyRing类代码示例

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


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

示例1: testRingQQ

 def testRingQQ(self):
     r = PolyRing( QQ(), "(t,x)", Order.INVLEX );
     self.assertEqual(str(r),'PolyRing(QQ(),"t,x",Order.INVLEX)');
     [one,x,t] = r.gens();
     self.assertTrue(one.isONE());
     self.assertTrue(len(x)==1);
     self.assertTrue(len(t)==1);
     #
     f = 11 * x**4 - 13 * t * x**2 - 11 * x**2 + 2 * t**2 + 11 * t;
     f = f**2 + f + 3;
     #print "f = " + str(f);
     self.assertEqual(str(f),'( 4 * x**4 - 52 * t**2 * x**3 + 44 * x**3 + 213 * t**4 * x**2 - 330 * t**2 * x**2 + 123 * x**2 - 286 * t**6 * x + 528 * t**4 * x - 255 * t**2 * x + 11 * x + 121 * t**8 - 242 * t**6 + 132 * t**4 - 11 * t**2 + 3 )');
开发者ID:rjolly,项目名称:jas,代码行数:12,代码来源:RingElemTest.py

示例2: testRingZM

 def testRingZM(self):
     r = PolyRing( GF(17), "(t,x)", Order.INVLEX );
     self.assertEqual(str(r),'PolyRing(GFI(17),"t,x",Order.INVLEX)');
     [one,x,t] = r.gens();
     self.assertTrue(one.isONE());
     self.assertTrue(len(x)==1);
     self.assertTrue(len(t)==1);
     #
     f = 11 * x**4 - 13 * t * x**2 - 11 * x**2 + 2 * t**2 + 11 * t;
     f = f**2 + f + 3;
     #print "f = " + str(f);
     self.assertEqual(str(f),'( 4 * x**4 + 16 * t**2 * x**3 + 10 * x**3 + 9 * t**4 * x**2 + 10 * t**2 * x**2 + 4 * x**2 + 3 * t**6 * x + t**4 * x + 11 * x + 2 * t**8 + 13 * t**6 + 13 * t**4 + 6 * t**2 + 3 )');
开发者ID:rjolly,项目名称:jas,代码行数:12,代码来源:RingElemTest.py

示例3: PolyRing

#
# jython examples for jas.
# $Id$
#

from java.lang import System
from java.lang import Integer

from jas import PolyRing, ZM, QQ
from jas import terminate
from jas import startLog

# polynomial examples: factorization over Z_p

r = PolyRing(ZM(1152921504606846883,field=True),"(x)",PolyRing.lex);
#r = PolyRing(ZM(19),"x",PolyRing.lex );
#r = PolyRing(ZM(23),"x",PolyRing.lex );

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

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


#f = x**4 - 1;
#f = x**3 + 1;
f = x**3 - x - 1;


print "f = ", f;
print;
开发者ID:,项目名称:,代码行数:31,代码来源:

示例4: Ring

## 3 z_1^2+y_1^2+b \&
## 3z_2^2+y_2^2+b \&
## \end{Equations}
## \end{PossoExample}


import sys;

from jas import Ring, PolyRing, QQ
from jas import startLog, terminate

# Hawes & Gibson example 2
# rational function coefficients

#r = Ring( "IntFunc(a, c, b) (y2, y1, z1, z2, x) G" );
r = PolyRing( PolyRing(QQ(),"a, c, b",PolyRing.lex), "y2, y1, z1, z2, x", PolyRing.grad );
print "Ring: " + str(r);
print;

#[one,a,c,b,y2,y1,z1,z2,x] = r.gens();

p1 = x + 2 * y1 * z1 + 3 * a * y1**2 + 5 * y1**4 + 2 * c * y1;
p2 = x + 2 * y2 * z2 + 3 * a * y2**2 + 5 * y2**4 + 2 * c * y2;
p3 = 2 * z2 + 6 * a * y2 + 20 * y2**3 + 2 * c; 
p4 = 3 * z1**2 + y1**2 + b;
p5 = 3 * z2**2 + y2**2 + b; 

F = [p1,p2,p3,p4,p5];

g = r.ideal( list=F );
print "Ideal: " + str(g);
开发者ID:rjolly,项目名称:jas,代码行数:31,代码来源:hawes2_gens.py

示例5: PolyRing

# $Id$
#

import sys;

from jas import Ring, PolyRing, Ideal
from jas import QQ, ZZ
from jas import startLog, terminate


# example: Algebraic Statistics
# Drton, Sturmfels, Sullivant, example 2.1.3


#r = PolyRing(QQ(),"l1,l2",PolyRing.grad);
r = PolyRing(QQ(),"l1,l2",PolyRing.lex);
print "Ring: " + str(r);
print;

print one,l1,l2;

u0 = 3; u1 = 5; u2 = 7; u12 = 11;

f1 = (u1+u12)*(l1+l2+2)*(l1+1)*(l1+l2+1)\
     + (u12)*l1*(l1+1)*(l1+l2+1)\
     - (u2+u12)*l1*(l1+l2+2)*(l1+l2+1)\
     - (u0+u1+u2+u12)*l1*(l1+l2+2)*(l1+1)  ;

f2 = (u2+u12)*(l1+l2+2)*(l2+1)*(l1+l2+1)\
     + (u12)*l2*(l2+1)*(l1+l2+1)\
     - (u1+u12)*l2*(l1+l2+2)*(l1+l2+1)\
开发者ID:rjolly,项目名称:jas,代码行数:31,代码来源:alg_stat_1.py

示例6: PolyRing

#
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

from jas import PolyRing, Ideal
from jas import QQ, AN, RF
from jas import terminate, startLog

# polynomial examples: prime/primary decomposition in Q[w2,x,wx,y,z]

Q = PolyRing(QQ(), "w2,x,wx,y,z", PolyRing.lex)
print "Q     = " + str(Q)

[e, w2, x, wx, y, z] = Q.gens()
print "e     = " + str(e)
print "w2    = " + str(w2)
print "x     = " + str(x)
print "wx    = " + str(wx)
print "y     = " + str(y)
print "z     = " + str(z)
print

w1 = w2 ** 2 - 2
w2 = wx ** 2 - x
f1 = (y ** 2 - x) * (y ** 2 - 2)
# f1 = ( y**2 - x )**3 * ( y**2 - 2 )**2;
开发者ID:rjolly,项目名称:jas,代码行数:31,代码来源:prime-decomp_algeb_trans-plain.py

示例7: Z_p

import sys

from java.lang import System
from java.lang import Integer

from jas import Ring
from jas import PolyRing
from jas import Ideal
from jas import ZM, QQ, AN, RF
from jas import terminate
from jas import startLog

# polynomial examples: factorization over Z_p(x)(sqrt3(x))[y]

Q = PolyRing(ZM(5),"x",PolyRing.lex);
print "Q     = " + str(Q);
[e,a] = Q.gens();
#print "e     = " + str(e);
print "a     = " + str(a);

Qr = RF(Q);
print "Qr    = " + str(Qr.factory());
[er,ar] = Qr.gens();
#print "er    = " + str(er);
#print "ar    = " + str(ar);
print;

Qwx = PolyRing(Qr,"wx",PolyRing.lex);
print "Qwx   = " + str(Qwx);
[ewx,ax,wx] = Qwx.gens();
开发者ID:,项目名称:,代码行数:30,代码来源:

示例8: Q

#
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

from jas import Ring, PolyRing
from jas import QQ, AN
from jas import terminate, startLog

# polynomial examples: absolute factorization over Q(i)

Qr = PolyRing(QQ(), "i", PolyRing.lex)
print "Qr    = " + str(Qr)
[e, a] = Qr.gens()
print "e     = " + str(e)
print "a     = " + str(a)
print

imag = a ** 2 + 1
print "imag  = " + str(imag)
Qi = AN(imag, field=True)
print "Qi    = " + str(Qi.factory())
[one, i] = Qi.gens()
print "one   = " + str(one)
print "i     = " + str(i)
print
开发者ID:siwiwit,项目名称:java-algebra-system,代码行数:30,代码来源:factors_abs_complex.py

示例9: Ring


import sys;

from jas import Ring, PolyRing, RF, ZZ, QQ
from jas import startLog, terminate

from edu.jas.arith import ModIntegerRing

#startLog();

# Hawes & Gibson example 2
# rational function coefficients

#r = Ring( "RatFunc(a, c, b) (y2, y1, z1, z2, x) G" );
r = PolyRing( RF(PolyRing(ZZ(),"a, c, b",PolyRing.lex)), "y2, y1, z1, z2, x", PolyRing.grad );
print "Ring: " + str(r);
print;

ps = """
(
 ( x + 2 y1 z1 + { 3 a } y1^2 + 5 y1^4 + { 2 c } y1 ),
 ( x + 2 y2 z2 + { 3 a } y2^2 + 5 y2^4 + { 2 c } y2 ), 
 ( 2 z2 + { 6 a } y2 + 20 y2^3 + { 2 c } ), 
 ( 3 z1^2 + y1^2 + { b } ), 
 ( 3 z2^2 + y2^2 + { b } ) 
) 
""";

f = r.paramideal( ps );
print "Ideal: " + str(f);
开发者ID:rjolly,项目名称:jas,代码行数:29,代码来源:hawes2mod.py

示例10: Ring

import sys;

from jas import QQ, Ring, PolyRing, Ideal
from jas import startLog, terminate


# 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( "Rat(B,S,T,Z,P,W) L" );
r = PolyRing( QQ(),"B,S,T,Z,P,W", PolyRing.lex);
print "Ring: " + str(r);
print;


ps = """
( 
 ( 45 P + 35 S - 165 B - 36 ), 
 ( 35 P + 40 Z + 25 T - 27 S ), 
 ( 15 W + 25 S P + 30 Z - 18 T - 165 B**2 ), 
 ( - 9 W + 15 T P + 20 S Z ), 
 ( P W + 2 T Z - 11 B**3 ), 
 ( 99 W - 11 B S + 3 B**2 ),
 ( 10000 B**2 + 6600 B + 2673 )
) 
""";
开发者ID:rjolly,项目名称:jas,代码行数:30,代码来源:trinks_str.py

示例11: PolyRing

# jython examples for jas.
# $Id$
#

import sys;

from jas import Ring, PolyRing, Ideal
from jas import QQ, ZZ, RF
from jas import startLog, terminate


# example: Algebraic Statistics
# Drton, Sturmfels, Sullivant, example 2.1.3


r = PolyRing(RF(PolyRing(QQ(),"u0,u1,u2,u12",PolyRing.lex)),"l1,l2",PolyRing.grad);
print "Ring: " + str(r);
print;

print one,u0,u1,u2,u12,l1,l2;

f1 = (u1+u12)*(l1+l2+2)*(l1+1)*(l1+l2+1)\
     + (u12)*l1*(l1+1)*(l1+l2+1)\
     - (u2+u12)*l1*(l1+l2+2)*(l1+l2+1)\
     - (u0+u1+u2+u12)*l1*(l1+l2+2)*(l1+1)  ;

f2 = (u2+u12)*(l1+l2+2)*(l2+1)*(l1+l2+1)\
     + (u12)*l2*(l2+1)*(l1+l2+1)\
     - (u1+u12)*l2*(l1+l2+2)*(l1+l2+1)\
     - (u0+u1+u2+u12)*l2*(l1+l2+2)*(l2+1)  ;
开发者ID:rjolly,项目名称:jas,代码行数:30,代码来源:alg_stat_1p.py

示例12: PolyRing

#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import PolyRing, ZM, GF
from jas import terminate, startLog

# system biology examples: GB in Z_2
# see: Informatik Spektrum, 2009, February,
# Laubenbacher, Sturmfels: Computer Algebra in der Systembiologie

r = PolyRing(GF(2),"M, B, A, L, P",PolyRing.lex);
print "PolyRing: " + str(r);
print;

#automatic: [one,M,B,A,L,P] = r.gens();

f1 = M - A;
f2 = B - M;
f3 = A - A - L * B - A * L * B;
f4 = P - M;
f5 = L - P - L - L * B - L * P - L * B * P;
## t1 = M - 1;
## t2 = B - 1;
## t3 = A - 1;
## t4 = L - 1;
## t5 = P - 1;
#
开发者ID:rjolly,项目名称:jas,代码行数:31,代码来源:sys-bio.py

示例13: PolyRing

from jas import PolyRing, ZZ, QQ, ZM
from jas import terminate, startLog

from basic_sigbased_gb import sigbased_gb
from basic_sigbased_gb import ggv, ggv_first_implementation
from basic_sigbased_gb import coeff_free_sigbased_gb
from basic_sigbased_gb import arris_algorithm, min_size_mons
from basic_sigbased_gb import f5, f5z

from staggered_linear_basis import staglinbasis


#r = PolyRing( QQ(), "(B,S,T,Z,P,W)", PolyRing.lex );
#r = PolyRing( ZZ(), "(B,S,T,Z,P,W)", PolyRing.lex );
r = PolyRing( ZM(32003), "(B,S,T,Z,P,W)", PolyRing.lex );
#r = PolyRing( ZM(19), "(B,S,T,Z,P,W)", PolyRing.lex );
print "Ring: " + str(r);
print;

[one,B,S,T,Z,P,W] = r.gens();

p1 = 45 * P + 35 * S - 165 * B - 36; 
p2 = 35 * P + 40 * Z + 25 * T - 27 * S;
p3 = 15 * W + 25 * S * P + 30 * Z - 18 * T - 165 * B**2; 
p4 = -9 * W + 15 * T * P + 20 * S * Z; 
p5 = P * W + 2 * T * Z - 11 * B**3;
p6 = 99 * W - 11 * B * S + 3 * B**2;
p7 = 10000 * B**2 + 6600 * B + 2673;

F = [p1,p2,p3,p4,p5,p6,p7];
开发者ID:rjolly,项目名称:jas,代码行数:30,代码来源:trinks_sigbased_gb.py

示例14: Ring

#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import GF, PolyRing
from jas import terminate, startLog

# polynomial examples: factorization over Z_p

#r = Ring( "Mod 1152921504606846883 (x) L" );
#r = Ring( "Mod 19 (x) L" );
r = PolyRing( GF(19), "x", PolyRing.lex );
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;
开发者ID:rjolly,项目名称:jas,代码行数:31,代码来源:factors_mod.py

示例15: Ring

# jython examples for jas.
# $Id$
#

from java.lang import System

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


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