本文整理汇总了Python中jas.Ring类的典型用法代码示例。如果您正苦于以下问题:Python Ring类的具体用法?Python Ring怎么用?Python Ring使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ring类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ring
#
# jython examples for jas.
# $Id: mark.py 1429 2007-10-13 12:58:29Z kredel $
#
#import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
# mark, d-gb diplom example
r = Ring( "Z(x,y,z) L" );
print "Ring: " + str(r);
print;
ps = """
(
( z + x y**2 + 4 x**2 + 1 ),
( y**2 z + 2 x + 1 ),
( x**2 z + y**2 + x )
)
""";
f = r.ideal( ps );
print "Ideal: " + str(f);
print;
from edu.jas.ring import EGroebnerBaseSeq;
from edu.jas.ring import DGroebnerBaseSeq;
示例2: QQ
print "c:", c;
print;
## c1 = c.evaluate( QQ(0) );
## 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;
示例3: Ring
#
# jython examples for jas.
# $Id$
#
from jas import Ring
from jas import Ideal
# logic example from Kreutzer JdM 2008
r = Ring( "Mod 2 (a,f,p,u) G" );
print "Ring: " + str(r);
print;
ks = """
(
( a^2 - a ),
( f^2 - f ),
( p^2 - p ),
( u^2 - u )
)
""";
ps = """
(
( p f + p ),
( p u + p + u + 1 ),
( a + u + 1 ),
( a + p + 1 )
)
""";
示例4: Ring
#
from java.lang import System
from java.lang import Integer
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;
[one,x,y,z] = r.gens();
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;
示例5: Ring
#
# jython examples for jas.
# $Id$
#
from jas import Ring
# trinks 7 example
r = Ring( "Rat(B,S,T,Z,P,W) L" );
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 ),
( B**2 + 33/50 B + 2673/10000 )
)
""";
f = r.ideal( ps );
print "Ideal: " + str(f);
print;
#Katsura equations for N = 3:
示例6: H
# $Id: hermite.py 2111 2008-09-06 19:32:49Z kredel $
#
import sys;
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 );
示例7: rose
#
import sys;
from jas import Ring, QQ
from jas import startLog, terminate
# example from rose (modified)
#r = Ring( "Mod 19 (U3,U4,A46) L" );
#r = Ring( "Mod 1152921504606846883 (U3,U4,A46) L" ); # 2^60-93
#r = Ring( "Quat(U3,U4,A46) L" );
#r = Ring( "Z(U3,U4,A46) L" );
#r = Ring( "C(U3,U4,A46) L" );
r = Ring( "Rat(A46,U3,U4) L" );
print "Ring: " + str(r);
print;
ps = """
(
%s
( U4^4 - 20/7 A46^2 ),
( A46^2 U3^4 + 7/10 A46 U3^4 + 7/48 U3^4 - 50/27 A46^2 - 35/27 A46 - 49/216 ),
( A46^5 U4^3 + 7/5 A46^4 U4^3 + 609/1000 A46^3
U4^3 + 49/1250 A46^2 U4^3 - 27391/800000 A46 U4^3
- 1029/160000 U4^3 + 3/7 A46^5 U3 U4^2 + 3/5 A46^6
U3 U4^2 + 63/200 A46^3 U3 U4^2 + 147/2000 A46^2
U3 U4^2 + 4137/800000 A46 U3 U4^2 - 7/20 A46^4
U3^2 U4 - 77/125 A46^3 U3^2 U4 - 23863/60000 A46^2
U3^2 U4 - 1078/9375 A46 U3^2 U4 - 24353/1920000
示例8: Rat
rs = """
# polynomial ring:
Rat(x1,x2,x3,y1,y2) G|3|
""";
ps = """
(
( y1 + y2 - 1 ),
( x1 - y1^2 - y1 - y2 ),
( x2 - y1 - y2^2 ),
( x3 - y1 y2 )
)
""";
r = Ring( rs );
print "Ring: " + str(r);
i = r.ideal( ps );
print "Ideal: " + str(i);
g = i.GB();
print "seq GB:", g;
rsi = """
# polynomial ring:
Rat(x1,x2,x3) G
""";
示例9: Ring
from jas import Ring
from jas import startLog, terminate
#import rational;
# 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;
示例10: CC
c = CC();
print "c:", c;
c = c.one();
print "c:", c;
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;
示例11: Ring
from jas import Ideal
from jas import startLog
from jas import terminate
#import rational;
# 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;
示例12: map
self.coFac = cofac;
def map(self,ps):
return ps.negate().integrate( self.coFac.getZERO() ).integrate( self.coFac.getONE() );
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;
示例13: P
import sys
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
from edu.jas.arith import BigRational
# Legendre polynomial example
# P(0) = 1
# P(1) = x
# P(n) = 1/n [ (2n-1) * x * P(n-1) - (n-1) * P(n-2) ]
r = Ring("Q(x) L")
# r = Ring( "C(x) L" );
print "Ring: " + str(r)
print
# sage like: with generators for the polynomial ring
[x] = r.gens()
one = r.one()
N = 10
P = [one, x]
for n in range(2, N):
p = (2 * n - 1) * x * P[n - 1] - (n - 1) * P[n - 2]
r = (1, n)
# no rational numbers in python
示例14: P
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
from edu.jas.arith import BigRational
# Legendre polynomial example
# P(0) = 1
# P(1) = x
# P(n) = 1/n [ (2n-1) * x * P(n-1) - (n-1) * P(n-2) ]
r = Ring( "Q(x) L" );
#r = Ring( "C(x) L" );
print "Ring: " + str(r);
print;
# sage like: with generators for the polynomial ring
[one,x] = r.gens();
N = 10;
P = [one,x];
for n in range(2,N):
p = (2*n-1) * x * P[n-1] - (n-1) * P[n-2];
r = (1,n); # no rational numbers in python
#r = [(1,n)]; # no complex rational numbers in python
#r = ((1,n),(0,1)); # no complex rational numbers in python
p = r * p;
示例15: Ring
#
# jython for jas example integer programming.
# $Id$
#
# CLO2, p370
# 4 A + 5 B + C = 37
# 2 A + 3 B + D = 20
#
# max: 11 A + 15 B
#
import sys;
from jas import Ring
r = Ring( "Rat(w1,w2,w3,w4,z1,z2) W( (0,0,0,0,1,1),(1,1,2,2,0,0) )" );
print "Ring: " + str(r);
print;
ps = """
(
( z1^4 z2^2 - w1 ),
( z1^5 z2^3 - w2 ),
( z1 - w3 ),
( z2 - w4 )
)
""";
f = r.ideal( ps );
print "Ideal: " + str(f);