Exemplo n.º 1
0
 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 )');
Exemplo n.º 2
0
 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 )');
Exemplo n.º 3
0
import sys;

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


# Montes JSC 2002, 33, 183-208, example 11.4
# integral function coefficients

R = PolyRing( PolyRing(QQ(),"Q2, P2, Q1, P1",PolyRing.lex), "f3, e3, f2, e2", PolyRing.lex );
print "Ring: " + str(R);
print;

[one, Q2, P2, Q1, P1, f3, e3, f2, e2] = R.gens();
print "gens: ", [ str(f) for f in R.gens() ];
print;

fp1 = 14 - 12 * e2 - 110 * f2 - 2 * e3 - 10 * f3 - P1;
fp2 = 2397 - 2200 * e2 + 240 * f2 - 200 * e3 + 40 * f3 - 20 * Q1;
fp3 = 16 * e2**2 - 4 * e2 * e3 - 20 * e2 * f3 + 20 * e3 * f2 + 16 * f2**2 - 4 * f2 * f3 - 12 * e2 + 110 * f2 - P2;
fp4 = 2599 * e2**2 - 400 * e2 * e3 + 80 * e2 * f3 - 80 * e3 * f2 + 2599 * f2**2 - 400 * f2 * f3 - 2200 * e2 - 240 * f2 - 20 * Q2;

print "fp1: " + str(fp1);
print "fp2: " + str(fp2);
print "fp3: " + str(fp3);
print "fp4: " + str(fp4);
print;

F = [fp1,fp2,fp3,fp4];
Exemplo n.º 4
0
import sys;

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


# Montes JSC 2002, 33, 183-208, example 11.3
# integral function coefficients

R = PolyRing( PolyRing(QQ(),"r, l, z",PolyRing.lex), "c1, c2, s1, s2", PolyRing.lex );
print "Ring: " + str(R);
print;

[one,r,l,z,c1,c2,s1,s2] = R.gens();
print "gens: ", [ str(f) for f in r.gens() ];
print;

f1 = r - c1 + l * ( s1 * s2 - c1 * c2 );
f2 = z - s1 - l * ( s1 * c2 + s2 * c1 );
f3 = s1**2 + c1**2 - 1;
f4 = s2**2 + c2**2 - 1;

F = [f1,f2,f3,f4];

print "F: ", [ str(f) for f in F ];
print;

startLog();
import sys

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

# 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

[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

p6 = ((p5 / a) / b) / c
print "p6 = ", p6

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

g = r.ideal(list=F)
print "Ideal: " + str(g)
print
Exemplo n.º 6
0
from jas import Ring, PolyRing
from jas import terminate
from jas import startLog

from jas import QQ, DD

# polynomial examples: real roots over Q for zero dimensional ideal `cyclic5'

# r = Ring( "Q(x) L" );
r = PolyRing(QQ(), "a,b,c,d,e", PolyRing.lex)

print "Ring: " + str(r)
print

[one, a, b, c, d, e] = r.gens()

f1 = a + b + c + d + e
f2 = a * b + b * c + c * d + d * e + e * a
f3 = a * b * c + b * c * d + c * d * e + d * e * a + e * a * b
f4 = a * b * c * d + b * c * d * e + c * d * e * a + d * e * a * b + e * a * b * c
f5 = a * b * c * d * e - 1

print "f1 = ", f1
print "f2 = ", f2
print "f3 = ", f3
print "f4 = ", f4
print "f5 = ", f5
print

F = r.ideal(list=[f1, f2, f3, f4, f5])
from java.lang import System

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

# polynomial examples: ideal radical decomposition, example 8.16 in GB book, base field with p-th root

# noThreads(); # must be called very early

prime = 5
cf = GF(prime)
#cf = QQ();

ca = PolyRing(cf, "t", PolyRing.lex)
print "ca = " + str(ca)
[ea, ta] = ca.gens()
print "ea   = " + str(ea)
print "ta   = " + str(ta)
print

Qpt = RF(ca)
#print Qpt.gens();

[ea2, ta2] = Qpt.gens()
print "ea2  = " + str(ea2)
print "ta2  = " + str(ta2)
print

cr = PolyRing(Qpt, "wpt", PolyRing.lex)
print "polynomial quotient ring: " + str(cr)
Exemplo n.º 8
0
import sys

from jas import Ring, PolyRing, ParamIdeal, QQ, ZM, RR
from jas import startLog, terminate

# Boolean coefficient boolean GB
# see S. Inoue and A. Nagai "On the Implementation of Boolean Groebner Bases" in ASCM 2009
# Z_2 regular ring coefficent example

r = PolyRing(RR(ZM(2), 3), "a,x,y", PolyRing.lex)
print "r  = " + str(r)
#print len(r.gens())

[s1, s2, s3, a, x, y] = r.gens()
one = r.one()

print "one = " + str(one)
print "s1  = " + str(s1)
print "s2  = " + str(s2)
print "s3  = " + str(s3)
print "a   = " + str(a)
print "x   = " + str(x)
print "y   = " + str(y)

#brel = [ a**2 - a, x**2 - x, y**2 - y ];
brel = [x**2 - x, y**2 - y]

#print "brel = " + str(brel[0]) + ", " + str(brel[1]) + ", " + str(brel[2]);
print "brel = " + str(brel[0]) + ", " + str(brel[1])

pl = [(one + s1 + s2) * (x * y + x + y), s1 * x + s1, a * y + a, x * y]
Exemplo n.º 9
0
#

import sys;

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


# Raksanyi & Walter example
# integral/rational function coefficients


r = PolyRing(PolyRing(QQ(),"a1,a2,a3,a4",PolyRing.grad),"x1,x2,x3,x4",PolyRing.lex);
#print "r  = " + str(r);

[one,a1,a2,a3,a4,x1,x2,x3,x4] = r.gens();

pl = [ ( x4 - ( a4 - a2 ) ),
      ( x1 + x2 + x3 + x4 - ( a1 + a3 + a4 ) ),
      ( x1 * x3 + x1 * x4 + x2 * x3 + x3 * x4 - ( a1 * a4 + a1 * a3 + a3 * a4 ) ),
      ( x1 * x3 * x4 - ( a1 * a3 * a4 ) ) 
     ];
f = ParamIdeal(r,list=pl);
print "ParamIdeal: " + str(f);

gs = f.CGBsystem();
#print "CGBsystem: " + str(gs);
#print;

print f.CGB();
Exemplo n.º 10
0
import sys;

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


# Montes JSC 2002, 33, 183-208, example 11.1
# integral function coefficients

r = PolyRing( PolyRing(QQ(),"c, b, a",PolyRing.lex), "z,y,x", PolyRing.lex );
print "Ring: " + str(r);
print;

[one,c,b,a,z,y,x] = r.gens();
print "gens: ", [ str(f) for f in r.gens() ];
print;

f1 =     x + c * y + b * z + a;
f2 = c * x +     y + a * z + b;
f3 = b * x + a * y +     z + c;

F = [f1,f2,f3];

print "F: ", [ str(f) for f in F ];
print;

#startLog();

If = r.paramideal( "", list = F );
Exemplo n.º 11
0
import sys

from java.lang import System

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

# polynomial examples: factorization over Z_p

p = 5;
cr = PolyRing(ZM(p,field=True),"u",PolyRing.lex );
print "Ring cr: " + str(cr);

[one,u] = cr.gens();

fu = (u**2+u+1)**p;
print "fu = ", fu;

t = System.currentTimeMillis();
G = cr.squarefreeFactors(fu);
t = System.currentTimeMillis() - t;
#print "G = ", G; #.toScript();
print "factor time =", t, "milliseconds";
for h, i in G.iteritems():
    print "h**i = (", h, ")**" + str(i);
    h = h**i;
print;

qcr = RF(cr);
# $Id$
#

import sys

from java.lang import System

from jas import PolyRing, 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;
f2 = ( z**2 - y**2 );

print "w1 = ", w1;
Exemplo n.º 13
0
q = FF(17, 5)
print "q     = " + str(q.ring.toScript())
qe, qa = q.gens()
print "qe    = " + str(qe)
print "qa    = " + str(qa)

qap = qa**5 - qa + 1
print "qap   = " + str(qap)

s = ap - qap
print "s     = " + str(s)

ar = PolyRing(r, "beta", PolyRing.lex)
print "ar    = " + str(ar)
e, a, b = ar.gens()
print "e     = " + str(e)
print "a     = " + str(a)
print "b     = " + str(b)

p = a**5 - a + beta**5 - (a**3 + a) * beta
#p = p*p;
print "p     = " + str(p)
x = p.factors()
print "x     = " + ", ".join(
    [str(pp) + "**" + str(i) for (pp, i) in x.iteritems()])
g = reduce(operator.mul, [pp**i for (pp, i) in x.iteritems()], e)
print "g     = " + str(g)
#print "p-g:    " + str(p-g);
print "isFactors(p,x): " + str(p == g)
print
Exemplo n.º 14
0
# $Id$
#

from java.lang import System

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

# polynomial examples: factorization

#r = Ring( "Z(x) L" );
r = PolyRing(ZZ(), "(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;
#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;
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]
#F = [p1,p2,p3,p4,p5,p6];

f = r.ideal(list=F)
print "Ideal: " + str(f)
print
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

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

# polynomial examples: factorization over Q(sqrt(2))(x)(sqrt(x))[y]

Q = PolyRing(QQ(),"w2",PolyRing.lex);
print "Q     = " + str(Q);
[e,a] = Q.gens();
print "e     = " + str(e);
print "a     = " + str(a);

root = a**2 - 2;
print "root  = " + str(root);
Q2 = AN(root,field=True);
print "Q2    = " + str(Q2.factory());
[one,w2] = Q2.gens();
#print "one   = " + str(one);
#print "w2    = " + str(w2);
print;

Qp = PolyRing(Q2,"x",PolyRing.lex);
print "Qp    = " + str(Qp);
[ep,wp,ap] = Qp.gens();
Exemplo n.º 17
0
from java.lang import Integer

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

# polynomial examples: factorization

cr = PolyRing(QQ(),"x",PolyRing.lex );
print "Ring cr: " + str(cr);

r = PolyRing(cr,"y,z",PolyRing.lex );
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);
Exemplo n.º 18
0
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];
#F = [p1,p2,p3,p4,p5,p6];

f = r.ideal( list=F );
print "Ideal: " + str(f);
print;
Exemplo n.º 19
0
#

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;
f2 = z ** 2 - y ** 2

print "w1 = ", w1
# $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

r = PolyRing(Qi, "x", PolyRing.lex)
print "r    = " + str(r)
# $Id$
#

import sys

from java.lang import System

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

# polynomial examples: 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)

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)

b = i**2 + 1
print "b     = " + str(b)
c = 1 / i
print "c     = " + str(c)
Exemplo n.º 22
0
from jas import Ring, PolyRing, ParamIdeal, QQ
from jas import startLog
from jas import terminate


# 2 univariate polynomials of degree 2 example for comprehensive GB
# integral/rational function coefficients

#rp = PolyRing(QQ(), "a,b" );
rp = PolyRing(QQ(), "a" );
r = PolyRing( rp, "x,y,z", PolyRing.lex );
print "Ring: " + str(r);
print;

#one,a,b,x,y = r.gens();
one,a,x,y,z = r.gens();

#f1 = x * ( x**2 + a * y + b );
#f2 = x * ( y**2 + b * x + a );

f1 = ( x**2 + a * y**2 - x );
f2 = ( a * x**2 + y**2 - y );
f3 = ( x - y ) * z - 1;

print "f1 = " + str(f1);
print "f2 = " + str(f2);
print "f3 = " + str(f3);

f = r.paramideal( "", list=[f1,f2,f3] );
print "ParamIdeal: " + str(f);
print;
from java.lang import System

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

# polynomial examples: recursive factorization

cr = PolyRing(QQ(), "x", PolyRing.lex)
print "Ring cr: " + str(cr)
print
r = PolyRing(cr, "y,z", PolyRing.lex)
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);
Exemplo n.º 24
0
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();
#print "ewx   = " + str(ewx);
print "ax    = " + str(ax);
Exemplo n.º 25
0
from java.lang import System
from java.lang import Integer

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

from jas import QQ, DD

# polynomial examples: real roots over Q

r = PolyRing(QQ(),"I,x,y,z",PolyRing.lex);
print "Ring: " + str(r);
print;

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

f1 = z - x - y * I;
f2 = I**2 + 1;

#f3 = z**3 - 2;
f3 = z**3 - 2*I;

print "f1 = ", f1;
print "f2 = ", f2;
print "f3 = ", f3;
print;

F = r.ideal( list=[f1,f2,f3] );

print "F = ", F;
Exemplo n.º 26
0
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(sqrt(2))(x)(sqrt(x))[y]

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

root = a ** 2 - 2
print "root  = " + str(root)
Q2 = AN(root, field=True)
print "Q2    = " + str(Q2.factory())
[one, w2] = Q2.gens()
# print "one   = " + str(one);
# print "w2    = " + str(w2);
print

Qp = PolyRing(Q2, "x", PolyRing.lex)
print "Qp    = " + str(Qp)
[ep, wp, ap] = Qp.gens()
Exemplo n.º 27
0
#
# jython examples for jas.
# $Id$
#

import sys;

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

# tuzun, e-gb example

r = PolyRing(ZZ(), "(t)" );
print "Ring: " + str(r);

[one,t] = r.gens();
print "one: " + str(one);
print "t:   " + str(t);
print;

f1 = 2 * t + 1;
f2 = t**2 + 1; 

F = [f1,f2];
I = r.ideal( list=F );
print "Ideal: " + str(I);
print;

#startLog();

G = I.eGB();
Exemplo n.º 28
0
#print "Ring: " + str(r);
#print;

#r = PolyRing(ZZ(),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(QQ(),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(CC(),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(DD(),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(ZM(19),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(ZM(1152921504606846883),"B,S,T,Z,P,W",PolyRing.lex); # 2^60-93
#rc = PolyRing(ZZ(),"e,f",PolyRing.lex);
#rc = PolyRing(QQ(),"e,f",PolyRing.lex);
#r = PolyRing(rc,"B,S,T,Z,P,W",PolyRing.lex);

rqc = PolyRing(ZZ(),"e,f",PolyRing.lex);
print "Q-Ring: " + str(rqc);
print "rqc.gens() = ", [ str(f) for f in rqc.gens() ];
print;
[pone,pe,pf] = rqc.gens();

r = PolyRing(RF(rqc),"B,S,T,Z,P,W",PolyRing.lex);
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();
#[one,I,B,S,T,Z,P,W] = r.gens();

f1 = 45 * P + 35 * S - 165 * B - 36;
Exemplo n.º 29
0
#print "Ring: " + str(r);
#print;

#r = PolyRing(ZZ(),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(QQ(),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(CC(),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(DD(),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(ZM(19),"B,S,T,Z,P,W",PolyRing.lex);
#r = PolyRing(ZM(1152921504606846883),"B,S,T,Z,P,W",PolyRing.lex); # 2^60-93
#rc = PolyRing(ZZ(),"e,f",PolyRing.lex);
#rc = PolyRing(QQ(),"e,f",PolyRing.lex);
#r = PolyRing(rc,"B,S,T,Z,P,W",PolyRing.lex);

rqc = PolyRing(ZZ(), "e,f", PolyRing.lex)
print "Q-Ring: " + str(rqc)
print "rqc.gens() = ", [str(f) for f in rqc.gens()]
print
[pone, pe, pf] = rqc.gens()

r = PolyRing(RF(rqc), "B,S,T,Z,P,W", PolyRing.lex)
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();
#[one,I,B,S,T,Z,P,W] = r.gens();

f1 = 45 * P + 35 * S - 165 * B - 36
Exemplo n.º 30
0
import sys;

from jas import PolyRing, ZZ, QQ, RealN, CC, ZM, RF, terminate
from edu.jas.root import RealArithUtil
from edu.jas.arith import ArithUtil

# example for rational and real algebraic numbers
#
#

# continued fractions:

r = PolyRing(QQ(),"alpha",PolyRing.lex);
print "r = " + str(r);
e,a = r.gens();
print "e     = " + str(e);
print "a     = " + str(a);
sqrt2 = a**2 - 2;
print "sqrt2 = " + str(sqrt2);
Qs2r = RealN(sqrt2,[1,[3,2]],a-1);
#Qs2r = RealN(sqrt2,[-2,-1],a+1);
print "Qs2r  = " + str(Qs2r.factory()) + " :: " + str(Qs2r.elem);
one,alpha = Qs2r.gens();
print "one   = " + str(one);
print "alpha = " + str(alpha);


cf = Qs2r.contFrac(20);
print "cf    = " + str(cf);
nb = Qs2r.contFracApprox(cf);
Exemplo n.º 31
0
from java.lang import System

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

# polynomial examples: ideal radical decomposition, example 8.16 in GB book, base field with p-th root

# noThreads(); # must be called very early

prime = 5;
cf = GF(prime);
#cf = QQ();

ca = PolyRing(cf,"t",PolyRing.lex);
print "ca = " + str(ca);
[ea,ta] = ca.gens();
print "ea   = " + str(ea);
print "ta   = " + str(ta);
print;

Qpt = RF(ca);
#print Qpt.gens();

[ea2,ta2] = Qpt.gens();
print "ea2  = " + str(ea2);
print "ta2  = " + str(ta2);
print;

cr = PolyRing(Qpt,"wpt",PolyRing.lex);
print "polynomial quotient ring: " + str(cr);
Exemplo n.º 32
0
from jas import terminate

# Montes JSC 2002, 33, 183-208, example 11.2
# integral function coefficients

r = PolyRing(PolyRing(QQ(), "f, e, d, c, b, a", PolyRing.lex), "y,x",
             PolyRing.lex)
#r = PolyRing( PolyRing(QQ(),"f, e, d, c, b, a",PolyRing.grad), "y,x", PolyRing.lex );
#r = PolyRing( PolyRing(QQ(),"f, e, d, c, b, a",PolyRing.lex), "y,x", PolyRing.grad );
#r = PolyRing( PolyRing(QQ(),"e, d, c, b, f, a",PolyRing.lex), "y,x", PolyRing.grad );
print "Ring: " + str(r)
print

#[one,e,d,c,b,f,a,y,x] = r.gens();
#automatic: [one,f,e,d,c,b,a,y,x] = r.gens();
print "gens: ", [str(f) for f in r.gens()]
print

f1 = x**2 + b * y**2 + 2 * c * x * y + 2 * d * x + 2 * e * y + f
f2 = x + c * y + d
f3 = b * y + c * x + e

F = [f1, f2, f3]

print "F: ", [str(f) for f in F]
print

#startLog();

If = r.paramideal("", list=F)
print "ParamIdeal: " + str(If)
# $Id$
#

import sys

from java.lang import System

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

# polynomial examples: factorization over Z_p(x)(sqrt{p}(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()
#print "ewx   = " + str(ewx);
print "ax    = " + str(ax)
Exemplo n.º 34
0
from java.lang import Integer

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;
Exemplo n.º 35
0
from jas import Ring, PolyRing
from jas import terminate, startLog, noThreads

from jas import QQ, ZM, RF, AN

# polynomial examples: ideal radical decomposition, modified from example 8.16 in GB book

# noThreads(); # must be called very early

prime = 5;
cf = ZM(prime);
#cf = QQ();

ca = PolyRing(cf,"a",PolyRing.lex);
#print "ca = " + str(ca);
[ea,aa] = ca.gens();
print "ea   = " + str(ea);
print "aa   = " + str(aa);
print;

#!#roota = aa**prime + 2;
roota = aa**2 + 2;
print "roota = " + str(roota);
Q3a = AN(roota,field=True);
print "Q3a   = " + str(Q3a.factory());

## Q3a = RF(ca);
#print Q3a.gens();

[ea2,aa2] = Q3a.gens();
print "ea2  = " + str(ea2);
print "iq    = " + str(iq.factory())
print

iroot = ip.algebraicRoots()
print "algebraic roots: iroot         = " + str(iroot)
print "unity algebraic roots: iroot   = " + str(iroot.rootsOfUnity())
iroot = iroot.rootRefine(eps)
print "algebraic roots refined: iroot = " + str(iroot.elem.toDecimalScript())
idroot = ip.decimalRoots(eps)
print "decimal roots: idroot          = " + str(idroot)
print

r2 = PolyRing(QQ(), "w_3_2", PolyRing.lex)
print "Ring: " + str(r2)
#print;
e, a = r2.gens()
print "e     = " + str(e)
print "a     = " + str(a)
w3p = (a**3 - 2)
# root{3}(2)
w3q = AN(w3p, 0, True)
print "w3q   = " + str(w3q.factory())
print

#w3root = RootFactory.algebraicRoots(w3p.elem);
w3root = w3p.algebraicRoots()
print "algebraic roots: w3root         = " + str(w3root)
print "unity algebraic roots: w3root   = " + str(w3root.rootsOfUnity())
w3root = w3root.rootRefine(eps)
print "algebraic roots refined: w3root = " + str(w3root.elem.toDecimalScript())
w3droot = w3p.decimalRoots(eps)
Exemplo n.º 37
0
cgb = Ipi.CGB()
print "CGB: " + str(cgb)
print

#sys.exit();

# ------------ real roots --------------------

r3 = PolyRing(QQ(), "A", PolyRing.lex)
print "PolyRing: " + str(r3)
print

eps = QQ(1, 10)**DD().elem.DEFAULT_PRECISION
print "eps = ", eps

[one, A] = r3.gens()

plot = {}
plotd = {}
br = 1
for i in range(1, 30):
    L = QQ(-1) + (i, 10)
    #L = QQ(9,10) + (i,100);
    fr = QQ(5) * ((1, 5)) * A**7 - ((21, 20) * L - (29, 20)) * A**6 - (
        (21, 10) * L) * A**5 + ((1, 5)) * A**2 - ((1, 20) * L -
                                                  (9, 20)) * A - ((1, 10) * L)

    print "L  = " + str(DD(L))
    #print "fr = " + str(fr);
    #print;
Exemplo n.º 38
0
from java.lang import System

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

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

r = PolyRing(ZM(2),"M, B, A, L, P",PolyRing.lex);

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

[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;
#
## t1 = M;
## t2 = B;
## t3 = A;
Exemplo n.º 39
0
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

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

# polynomial examples: prime/primary decomposition in Q(sqrt(2))(x)(sqrt(x))[y,z]

Q = PolyRing(QQ(), "w2", PolyRing.lex)
print "Q     = " + str(Q)
[e, a] = Q.gens()
#print "e     = " + str(e);
print "a     = " + str(a)

root = a**2 - 2
print "root  = " + str(root)
Q2 = AN(root, field=True)
print "Q2    = " + str(Q2.factory())
[one, w2] = Q2.gens()
#print "one   = " + str(one);
#print "w2    = " + str(w2);
print

Qp = PolyRing(Q2, "x", PolyRing.lex)
print "Qp    = " + str(Qp)
[ep, wp, ap] = Qp.gens()
Exemplo n.º 40
0
print "zrelations: = " + str( [ str(r) for r in zrelations ] );
print;

pz = SolvPolyRing(QQ(), "x,y,z,t", PolyRing.lex, zrelations);
print "SolvPolyRing: " + str(pz);
print;

pzq = SRF(pz);
print "SolvableQuotientRing: " + str(pzq.ring.toScript); # + ", assoz: " + str(pzq::ring.isAssociative);
#print "gens =" + str( [ str(r) for r in pzq.gens() ] );
print;

pct = PolyRing(pzq,"u,v,w", PolyRing.lex);
#is automatic: [one,x,y,z,t,u,v,w] = p.gens();
print "tgens = " + str( [ str(r) for r in pct.gens() ] );
print;

relations = [#w, v,  v * w - u,
             v, u,  v * u + x,
             w, y,  y * w + y,
             w, z,  z * w - z
            ];

print "relations: = " + str( [ str(r) for r in relations ] );
print;

#startLog();

pt = SolvPolyRing(pzq, "u,v,w", PolyRing.lex, relations);
print "SolvPolyRing: " + str(pt); # + ", is assoz: " + str(pt.ring.isAssociative);
from java.lang import System

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

# polynomial examples: ideal radical decomposition, modified from example 8.16 in GB book

# noThreads(); # must be called very early

prime = 5
cf = GF(prime)
#cf = QQ();

ca = PolyRing(cf, "a", PolyRing.lex)
#print "ca = " + str(ca);
[ea, aa] = ca.gens()
print "ea   = " + str(ea)
print "aa   = " + str(aa)
print

#!#roota = aa**prime + 2;
roota = aa**2 + 2
print "roota = " + str(roota)
Q3a = AN(roota, field=True)
print "Q3a   = " + str(Q3a.factory())

## Q3a = RF(ca);
#print Q3a.gens();

[ea2, aa2] = Q3a.gens()
print "ea2  = " + str(ea2)
Exemplo n.º 42
0
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;

startLog();

t = System.currentTimeMillis();
#G = r.squarefreeFactors(f);
G = r.factorsAbsolute(f);
Exemplo n.º 43
0
#

import sys;

from java.lang import System

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

# polynomial examples: complex factorization via algebraic factorization

r = PolyRing( CR(QQ()), "x", PolyRing.lex );
print "Ring: " + str(r);
print;
[one,I,x] = r.gens();


f1 = x**3 - 2;
f2 = ( x - I ) * ( x + I );
f3 = ( x**3 - 2 * I );

#f = f1**2 * f2 * f3;
f = f1 * f2 * f3;
#f = f1 * f2;
#f = f1 * f3;
#f = f2 * f3;
#f = f3;

#f = f**3;
# $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

r = PolyRing(Qi, "x", PolyRing.lex)
print "r    = " + str(r)
Exemplo n.º 45
0
print "o1 = " + str(o1);
o2 = (1/o1)**2;
print "o2 = " + str(o2);
o3 = o2 * o1 * o1;
print "o3 = " + str(o3);
o4 = (-69,20164)*oneOR + (-3,20164)*IOR + (-1,5041)*JOR + (-5,20164)*KOR  + (-3,10082)*oneOI + (-7,20164)*IOI + (-2,5041)*JOI + (-9,20164)*KOI;
print "o4 = " + str(o4);
o5 = o2 - o4;
print "o5  = " + str(o5);
print;


print "------- PolyRing(ZZ(),\"x,y,z\") ---------";
r = PolyRing(ZZ(),"x,y,z",PolyRing.grad);
print "r = " + str(r);
[one,x,y,z] = r.gens();
print "one = " + str(one);
print "x   = " + str(x);
print "y   = " + str(y);
print "z   = " + str(z);
p1 = 2 + 3 * x + 4 * y + 5 * z + ( x + y + z )**2;
print "p1  = " + str(p1);
p2  = z**2 + 2 * y * z + 2 * x * z + y**2 + 2 * x * y + x**2 + 5 * z + 4 * y + 3 * x + 2;
print "p2  = " + str(p2);
p3 = p1 - p2;
print "p3  = " + str(p3);
print "p3.factory() = " + str(p3.factory());
print;


print "------- PolyRing(QQ(),\"x,y,z\") ---------";
Exemplo n.º 46
0
from jas import Ring
from jas import PolyRing
from jas import Ideal
from jas import terminate
from jas import startLog

from jas import QQ, DD, CR

# polynomial examples: complex factorization via algebraic factorization

r = PolyRing( CR(QQ()), "x", PolyRing.lex );

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

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


f1 = x**3 - 2;

f2 = ( x - I ) * ( x + I );

f3 = ( x**3 - 2 * I );

#f = f1**2 * f2 * f3;
f = f1 * f2 * f3;
#f = f1 * f2;
#f = f1 * f3;
#f = f2 * f3;
#f = f3;
Exemplo n.º 47
0
#
# jython examples for jas.
# $Id$
#

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

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

# polynomial examples: squarefree: characteristic p, finite algebraic

ar = PolyRing(ZM(7,field=True),"i",PolyRing.lex)
[one,i] = ar.gens();

# irred for 7, 11, 19
r = PolyRing(AN(i**2+1,field=True),"x, y, z",PolyRing.lex)
print "Ring: " + str(r);
print;

[one,i,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():
Exemplo n.º 48
0
import sys;

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


# Montes JSC 2002, 33, 183-208, example 11.1
# integral function coefficients

r = PolyRing( PolyRing(QQ(),"c, b, a",PolyRing.lex), "z,y,x", PolyRing.lex );
print "Ring: " + str(r);
print;

#automatic: [one,c,b,a,z,y,x] = r.gens();
print "gens: ", [ str(f) for f in r.gens() ];
print;

f1 =     x + c * y + b * z + a;
f2 = c * x +     y + a * z + b;
f3 = b * x + a * y +     z + c;

F = [f1,f2,f3];

print "F: ", [ str(f) for f in F ];
print;

#startLog();

If = r.paramideal( "", list = F );
print "ParamIdeal: " + str(If);
Exemplo n.º 49
0
print "o1 = " + str(o1);
o2 = (1/o1)**2;
print "o2 = " + str(o2);
o3 = o2 * o1 * o1;
print "o3 = " + str(o3);
o4 = (-69,20164)*oneOR + (-3,20164)*IOR + (-1,5041)*JOR + (-5,20164)*KOR  + (-3,10082)*oneOI + (-7,20164)*IOI + (-2,5041)*JOI + (-9,20164)*KOI;
print "o4 = " + str(o4);
o5 = o2 - o4;
print "o5  = " + str(o5);
print;


print "------- PolyRing(ZZ(),\"x,y,z\") ---------";
r = PolyRing(ZZ(),"x,y,z",PolyRing.grad);
print "r = " + str(r);
[one,x,y,z] = r.gens();
print "one = " + str(one);
print "x   = " + str(x);
print "y   = " + str(y);
print "z   = " + str(z);
p1 = 2 + 3 * x + 4 * y + 5 * z + ( x + y + z )**2;
print "p1  = " + str(p1);
p2  = z**2 + 2 * y * z + 2 * x * z + y**2 + 2 * x * y + x**2 + 5 * z + 4 * y + 3 * x + 2;
print "p2  = " + str(p2);
p3 = p1 - p2;
print "p3  = " + str(p3);
print "p3.factory() = " + str(p3.factory());
print;


print "------- PolyRing(QQ(),\"x,y,z\") ---------";
Exemplo n.º 50
0
import sys;

from jas import Ring, PolyRing, ParamIdeal, QQ, ZM, RR
from jas import startLog, terminate


# Boolean coefficient boolean GB
# see S. Inoue and A. Nagai "On the Implementation of Boolean Groebner Bases" in ASCM 2009
# Z_2 regular ring coefficent example


r = PolyRing(RR(ZM(2),3),"a,x,y",PolyRing.lex);
print "r  = " + str(r);
#print len(r.gens())

[s1,s2,s3,a,x,y] = r.gens();
one = r.one();

print "one = " + str(one);
print "s1  = " + str(s1);
print "s2  = " + str(s2);
print "s3  = " + str(s3);
print "a   = " + str(a);
print "x   = " + str(x);
print "y   = " + str(y);

#brel = [ a**2 - a, x**2 - x, y**2 - y ]; 
brel = [ x**2 - x, y**2 - y ]; 

#print "brel = " + str(brel[0]) + ", " + str(brel[1]) + ", " + str(brel[2]);
print "brel = " + str(brel[0]) + ", " + str(brel[1]);
Exemplo n.º 51
0
#
# jython examples for jas.
# $Id$
#

import sys;

from jas import PolyRing, AN, QQ, ZZ, terminate


# multiple algebraic field extensions

print "------- multiple algebraic field extensions QQ(alpha)(beta)(gamma)(delta) ---------";
r = PolyRing(QQ(),"alpha",PolyRing.lex);
print "r     = " + str(r);
e,a = r.gens();
print "e     = " + str(e);
print "a     = " + str(a);

ap = a**5 - a + 1;
print "ap    = " + str(ap);
x = r.factors(ap); 
print "x     = " + str( [ str(p)+"**"+str(e)+"," for (p,e) in x.iteritems() ] );
qs2 = AN(ap,0,len(x)==1); # and e==1
print "qs2   = " + str(qs2.factory());
one,alpha = qs2.gens();
print "one   = " + str(one);
print "alpha = " + str(alpha);

b = alpha**2 - 1;
print "b     = " + str(b);