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); print "wx = " + str(wx); print; #rootx = wx**5 - 2; # not working #rootx = wx**5 - 1/ax;
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); print "Qr = " + str(Qr.factory()); [er,wr,ar] = Qr.gens(); #print "er = " + str(er); #print "wr = " + str(wr); #print "ar = " + str(ar); print; Qwx = PolyRing(Qr,"wx",PolyRing.lex); print "Qwx = " + str(Qwx); [ewx,wwx,ax,wx] = Qwx.gens(); #print "ewx = " + str(ewx); print "ax = " + str(ax); #print "wwx = " + str(wwx); print "wx = " + str(wx); print;
print "s2 = " + str(s2); s3 = z**2 + ( 2 ) * y * z + ( 2 ) * x * z + y**2 + ( 2 ) * x * y + ( b**2 + 2 * a * b + a**2 + (4,5) * b + (4,5) * a + (4,25) ) * y + x**2 - ( c - (2,3) ) * x + ( (1,2) ); print "s3 = " + str(s3); s4 = s1 + s2 - 2 * s3; print "s4 = " + str(s4); print "s4.factory() = " + str(s4.factory()); x = PolyRing(PolyRing(QQ(),"a, b, c",PolyRing.grad),"x, y, z",PolyRing.lex); print "x = " + str(x); print; print "------- RF(PolyRing(ZZ(),\"a,b,c\",PolyRing.lex)) ---------"; r = PolyRing(ZZ(),"a,b,c",PolyRing.lex); print "r = " + str(r); rf = RF(r); print "rf = " + str(rf.factory()); [one,a,b,c] = rf.gens(); print "one = " + str(one); print "a = " + str(a); print "b = " + str(b); print "c = " + str(c); q1 = a / b; print "q1 = " + str(q1); q2 = ( -2 * c**2 + 4 * b**2 + 4 * a**2 - 7 ); print "q2 = " + str(q2); q3 = ( -7 * b + 4 * a + 12 ); print "q3 = " + str(q3); q4 = q2 / q3; print "q4 = " + str(q4); q5 = ( 2 * c**2 - 4 * b**2 - 4 * a**2 + 7 ) / (7 * b - 4 * a - 12 ); print "q5 = " + str(q5);
fu = (u**2+u+1)**p; print "fu = ", fu; print; 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); print "Ring qcr: " + str(qcr.factory()); #not ok#r = PolyRing(cr,"x",PolyRing.lex ); r = PolyRing(qcr,"x",PolyRing.lex ); print "Ring r: " + str(r); #qr = RF(r); #print "Ring qr: " + str(qr.factory()); print; #[one,u,x] = r.gens(); print "one = " + str(one); print "u = " + str(u); print "x = " + str(x);
fu = (u**2 + u + 1)**p print "fu = ", fu print 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) print "Ring qcr: " + str(qcr.factory()) #not ok#r = PolyRing(cr,"x",PolyRing.lex ); r = PolyRing(qcr, "x", PolyRing.lex) print "Ring r: " + str(r) #qr = RF(r); #print "Ring qr: " + str(qr.factory()); print #[one,u,x] = r.gens(); print "one = " + str(one) print "u = " + str(u) print "x = " + str(x) #f = x**3 - u;