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

#automatic: [one,I] = r.gens();
print "one   = ", one
print "I     = ", I

eps = QQ(1, 10)**(BigDecimal.DEFAULT_PRECISION)
#-3
#eps = QQ(1,10) ** 7;
#eps = nil;
print "eps   = " + str(eps)

ip = (I**2 + 1)
# I
iq = AN(ip, 0, True)
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;
Esempio n. 2
0
print "s3  = " + str(s3);
s4 = s3 - s1;
print "s4  = " + str(s4);
print "s4.factory() = " + str(s4.factory());
print;


print "------- AN(alpha**2 - 2) ---------";
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);
Qs2 = AN(sqrt2);
print "Qs2   = " + str(Qs2.factory());
[one,alpha] = Qs2.gens();
print "one   = " + str(one);
print "alpha = " + str(alpha);
b = alpha**2 - 2;
print "b     = " + str(b);
c = 1 / alpha;
print "c     = " + str(c);
Qs2x = AN(alpha**2 - 2);
print "Qs2x  = " + str(Qs2x.factory());
print;


print "------- GF_17(alpha**2 - 2) ---------";
r = PolyRing(GF(17),"alpha",PolyRing.lex);
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();
#print "ep    = " + str(ep);
#print "wp    = " + str(wp);
#print "ap    = " + str(ap);
print;

Qr = RF(Qp);
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)
print "aa2  = " + str(aa2)
print

#cr = PolyRing(QQ(),"t",PolyRing.lex);
cr = PolyRing(Q3a, "t", PolyRing.lex)
print "coefficient Ring: " + str(cr)
rf = RF(cr)
print "coefficient quotient Ring: " + str(rf.ring.toScript())
Esempio n. 5
0
print "s3  = " + str(s3);
s4 = s3 - s1;
print "s4  = " + str(s4);
print "s4.factory() = " + str(s4.factory());
print;


print "------- AN(alpha**2 - 2) ---------";
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);
Qs2 = AN(sqrt2);
print "Qs2   = " + str(Qs2.factory());
[one,alpha] = Qs2.gens();
print "one   = " + str(one);
print "alpha = " + str(alpha);
b = alpha**2 - 2;
print "b     = " + str(b);
c = 1 / alpha;
print "c     = " + str(c);
Qs2x = AN(alpha**2 - 2);
print "Qs2x  = " + str(Qs2x.factory());
print;


print "------- GF_17(alpha**2 - 2) ---------";
r = PolyRing(GF(17),"alpha",PolyRing.lex);
Esempio n. 6
0
r = PolyRing( QQ(), "I", PolyRing.lex );
print "Ring: " + str(r);
#print;

#automatic: [one,I] = r.gens();
print "one   = ", one;
print "I     = ", I;

eps = QQ(1,10) ** (BigDecimal.DEFAULT_PRECISION); #-3
#eps = QQ(1,10) ** 7;
#eps = nil;
print "eps   = " + str(eps);

ip = (I**2 + 1);   # I
iq = AN( ip, 0, True);
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);
Esempio n. 7
0
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 "aa2  = " + str(aa2);
print;

#cr = PolyRing(QQ(),"t",PolyRing.lex);
cr = PolyRing(Q3a,"t",PolyRing.lex);
print "coefficient Ring: " + str(cr);
rf = RF(cr);
print "coefficient quotient Ring: " + str(rf.ring.toScript());
[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);

[et2,t,wpt] = cr.gens();
print "et2  = " + str(et2);
print "t    = " + str(t);
print "wpt  = " + str(wpt);
print;

root = wpt**prime - ta2;
af = AN(root,field=True);
print "coefficient algebraic quotient ring: " + str(af.ring.toScript());
#print af.gens();
##xx = AN(( wpt**5 + 4 * t ),True,PolyRing(RF(PolyRing(ZM(5),"t",PolyRing.lex)),"wpt",PolyRing.lex))
##print "xx: " + str(xx.ring.toScript());

[one,t,wpt] = af.gens();
print "one  = " + str(one);
print "t    = " + str(t);
print "wpt  = " + str(wpt);
#print one,t,wpt;
print;

#sys.exit();

r = PolyRing(af,"x,y",PolyRing.lex);
Esempio n. 9
0
from jas import Ring
from jas import PolyRing
from jas import Ideal
from jas import QQ, AN
from jas import terminate
from jas import startLog

# polynomial examples: factorization over Q(i)(sqrt2)

Q = PolyRing(QQ(),"i",PolyRing.lex);
print "Q     = " + str(Q);
Q.inject_variables();
print "i     = " + str(i);
imag = i**2 + 1;
print "imag  = " + str(imag);
Qi = AN(imag,field=True);
print "Qi    = " + str(Qi.factory());
Qi.inject_variables();
print "i     = " + str(i);
print;

Wr = PolyRing(Qi,"w2",PolyRing.lex)
print "Wr    = " + str(Wr);
Wr.inject_variables();
print "i     = " + str(i);
print "w2    = " + str(w2);
w2p = w2**2 - 2;
print "w2p   = " + str(w2p);
Qw2 = AN(w2p,field=True);
print "Qw2   = " + str(Qw2.factory());
Qw2.inject_variables();
from java.lang import System

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

# polynomial examples: factorization over Q(i)(sqrt2)

Q = PolyRing(QQ(), "i", PolyRing.lex)
print "Q     = " + str(Q)
# is automatic: Q.inject_variables();
print "i     = " + str(i)

imag = i ** 2 + 1
print "imag  = " + str(imag)
Qi = AN(imag, field=True)
print "Qi    = " + str(Qi.factory())
# is automatic: Qi.inject_variables();
print "i     = " + str(i)
print

Wr = PolyRing(Qi, "w2", PolyRing.lex)
print "Wr    = " + str(Wr)
# is automatic: Wr.inject_variables();
print "i     = " + str(i)
print "w2    = " + str(w2)

w2p = w2 ** 2 - 2
print "w2p   = " + str(w2p)
Qw2 = AN(w2p, field=True)
print "Qw2   = " + str(Qw2.factory())
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)
#is automatic: [one,i,x] = r.gens();
print "one   = " + str(one)
print "i     = " + str(i)
print "x     = " + str(x)
print

#f = x**7 - 1;
# jython examples for jas.
# $Id$
#

from java.lang import System

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

# polynomial examples: squarefree: characteristic p, finite algebraic

ar = PolyRing(GF(7), "i", PolyRing.lex)
#automatic: [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

#automatic: [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():
    b = y
if c.isZERO():
    c = z
[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)

[et2, t, wpt] = cr.gens()
print "et2  = " + str(et2)
print "t    = " + str(t)
print "wpt  = " + str(wpt)
print

root = wpt**prime - ta2
af = AN(root, field=True)
print "coefficient algebraic quotient ring: " + str(af.ring.toScript())
#print af.gens();
##xx = AN(( wpt**5 + 4 * t ),True,PolyRing(RF(PolyRing(ZM(5),"t",PolyRing.lex)),"wpt",PolyRing.lex))
##print "xx: " + str(xx.ring.toScript());

[one, t, wpt] = af.gens()
print "one  = " + str(one)
print "t    = " + str(t)
print "wpt  = " + str(wpt)
#print one,t,wpt;
print

#sys.exit();

r = PolyRing(af, "x,y", PolyRing.lex)
Esempio n. 14
0
from java.lang import System

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

# polynomial examples: factorization over Q(i)(sqrt2)

Q = PolyRing(QQ(), "i", PolyRing.lex)
print "Q     = " + str(Q)
#is automatic: Q.inject_variables();
print "i     = " + str(i)

imag = i**2 + 1
print "imag  = " + str(imag)
Qi = AN(imag, field=True)
print "Qi    = " + str(Qi.factory())
#is automatic: Qi.inject_variables();
print "i     = " + str(i)
print

Wr = PolyRing(Qi, "w2", PolyRing.lex)
print "Wr    = " + str(Wr)
#is automatic: Wr.inject_variables();
print "i     = " + str(i)
print "w2    = " + str(w2)

w2p = w2**2 - 2
print "w2p   = " + str(w2p)
Qw2 = AN(w2p, field=True)
print "Qw2   = " + str(Qw2.factory())
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)
# is automatic: [one,i,x] = r.gens();
print "one   = " + str(one)
print "i     = " + str(i)
print "x     = " + str(x)
print

Qwx = PolyRing(Qr, "wx", PolyRing.lex)
print "Qwx   = " + str(Qwx)
[ewx, ax, wx] = Qwx.gens()
#print "ewx   = " + str(ewx);
print "ax    = " + str(ax)
print "wx    = " + str(wx)
print

#rootx = wx**5 - 2; # not working
#rootx = wx**5 - 1/ax;
#rootx = wx**5 - ax;
#rootx = wx**5 - ( ax**2 + 3 * ax );
rootx = wx**5 - (ax**2 + 3 / ax)
print "rootx = " + str(rootx)
Q2x = AN(rootx, field=True)
print "Q2x   = " + str(Q2x.factory())
[ex2, ax2, wx] = Q2x.gens()
#print "ex2   = " + str(ex2);
#print "w2x2  = " + str(w2x2);
#print "ax2   = " + str(ax2);
#print "wx    = " + str(wx);
print

#Yr = PolyRing(Q2x,"y,z,c0,c1,c2",PolyRing.lex)
Yr = PolyRing(Q2x, "y,z", PolyRing.lex)
print "Yr    = " + str(Yr)

#[e,x,wx,y,z,c0,c1,c2] = Yr.gens();
[e, x, wx, y, z] = Yr.gens()
print "e     = " + str(e)
Esempio n. 17
0
Qwx = PolyRing(Qr,"wx",PolyRing.lex);
print "Qwx   = " + str(Qwx);
[ewx,ax,wx] = Qwx.gens();
#print "ewx   = " + str(ewx);
print "ax    = " + str(ax);
print "wx    = " + str(wx);
print;

#rootx = wx**5 - 2; # not working
#rootx = wx**5 - 1/ax;
#rootx = wx**5 - ax;
#rootx = wx**5 - ( ax**2 + 3 * ax );
rootx = wx**5 - ( ax**2 + 3 / ax );
print "rootx = " + str(rootx);
Q2x = AN(rootx,field=True);
print "Q2x   = " + str(Q2x.factory());
[ex2,ax2,wx] = Q2x.gens();
#print "ex2   = " + str(ex2);
#print "w2x2  = " + str(w2x2);
#print "ax2   = " + str(ax2);
#print "wx    = " + str(wx);
print;

#Yr = PolyRing(Q2x,"y,z,c0,c1,c2",PolyRing.lex)
Yr = PolyRing(Q2x,"y,z",PolyRing.lex)
print "Yr    = " + str(Yr);

#[e,x,wx,y,z,c0,c1,c2] = Yr.gens();
[e,x,wx,y,z] = Yr.gens();
print "e     = " + str(e);
Esempio n. 18
0

# 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);
c = 1 / b;
print "c     = " + str(c);
print "b*c   = " + str(b*c);
print

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