#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); print; rg = g.GB(); rg = g.GB(); rg = g.GB(); rg = g.GB(); print "GB:", rg; print; bg = rg.isGB(); print "isGB:", bg; print; #p7 = ( x + 1 ) / ( x**2 - x + 1 );
print "Ring: " + str(r) print #automatic: [one,x,y,z] = r.gens(); f1 = (x**2 - 5)**2 f2 = y**3 - x f3 = z**2 - y * x #print "f1 = ", f1; print "f2 = ", f2 print "f3 = ", f3 print F = r.ideal(list=[f2, f3]) print "F = ", F print startLog() t = System.currentTimeMillis() P = F.primeDecomp() t1 = System.currentTimeMillis() - t print "P = ", P print print "prime decomp time =", t1, "milliseconds" print print "F = ", F
print "Ring: " + str(r) print [one, x, y, z] = r.gens() f1 = (x ** 2 - 5) ** 2 f2 = (y ** 2 - x) ** 2 f3 = z ** 2 - x # print "f1 = ", f1; print "f2 = ", f2 print "f3 = ", f3 print F = r.ideal(list=[f2, f3]) print "F = ", F print startLog() t = System.currentTimeMillis() Q = F.primaryDecomp() t = System.currentTimeMillis() - t print "Q = ", Q print print "primary decomp time =", t, "milliseconds" print print "F = ", F
# {x, y, z})", # "{12-28*z+27*z^2-12*z^3+3*z^4, -6+4*y+11*z-6*z^2+3*z^3, 2+x-z}"); Scripting.setCAS(Scripting.CAS.Math); #Scripting.setCAS(Scripting.CAS.Sage); #Scripting.setCAS(Scripting.CAS.Singular); r = PolyRing(ZZ(),"x,y,z",Order.Lexicographic); print "Ring: " + str(r); print; ff = [ x**2 + y**2 + z**2 - 1, x - z + 2, z**2 - x*y] F = r.ideal( "", ff ); print "F = " + str(F); print; #startLog(); G = F.GB(); print "G = " + str(G); print; print "Ma: " + str( r.ideal("",[12-28*z+27*z**2-12*z**3+3*z**4,-6+4*y+11*z-6*z**2+3*z**3,2+x-z] )); print; # check("GroebnerBasis({x^2 + y^2 + z^2 - 1, x - z + 2, z^2 - x*y}, # {x, y, z}, MonomialOrder -> DegreeReverseLexicographic)", # "{16+23*x+12*x^2+3*x^3+4*y,3+4*x+2*x^2+y^2,-4-4*x-x^2+x*y,-2-x+z}");
print; #automatic: [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; print; startLog(); G = F.GB(); print "G = ", G; print; #terminate(); #sys.exit(); r = PolyRing(QQ(),"x,y",PolyRing.lex); print "Ring: " + str(r); print;
## t4 = L; ## t5 = P; # ## t1 = M; ## t2 = B; ## t3 = A; ## t4 = L - 1; ## t5 = P; # t1 = M; t2 = B; t3 = A - 1; t4 = L - 1; t5 = P; F = [f1,f2,f3,f4,f5]; #F = [f1,f2,f3,f4,f5,t1,t2,t3,t4,t5]; I = r.ideal( "", list=F ); print "Ideal: " + str(I); print; G = I.GB(); print "GB: " + str(G); print; #startLog(); terminate();
h1 = 2 * x1 - u1; h2 = 2 * x2 - u2; h3 = 2 * x3 - u1; h4 = 2 * x4 - u2; h5 = u2 * x5 + u1 * x6 - u1 * u2; h6 = u1 * x5 - u2 * x6; h7 = x1**2 - x2**2 - 2 * x1 * x7 + 2 * x2 * x8; h8 = x1**2 - 2 * x1 * x7 - x3**2 + 2 * x3 * x7 - x4**2 + 2 * x4 * x8; g = ( ( x5 - x7 )**2 + ( x6 - x8 )**2 - ( x1 - x7 )**2 - x8**2 ); L = [h1,h2,h3,h4,h5,h6,h7,h8]; #print "L = ", str(L); f = r.ideal( list=L ); print "Ideal: " + str(f); print; #sys.exit(); startLog(); c = f.CS(); print "seq char set:", c; print "is char set:", c.isCS(); print; print "g:", g; print; h = c.csReduction(g); print "h:", h;
h = 2; n = 5; delta = QQ(2,10); # 0.2 f1 = R - 1/(1+A**n); f2 = M * L - delta * A - ( v * M * A ) / ( h + A ); f3 = c0 + c * ( 1 - 1 / ( 1 + A**n ) - gamma * M); F = [f1,f2,f3]; print "f1 = " + str(f1); print "f2 = " + str(f2); print "f3 = " + str(f3); print; I = r.ideal( "", list=F ); print "Ideal: " + str(I); print; #sys.exit(); G = I.GB(); print "GB: " + str(G); print; # ------------ GB and CGB -------------------- r2 = PolyRing(PolyRing(QQ(),"L",PolyRing.lex),"A, M, R",PolyRing.lex); #r2 = PolyRing(RF(PolyRing(QQ(),"L",PolyRing.lex)),"A, M, R",PolyRing.lex); print "PolyRing: " + str(r2);
print "Ring: " + str(r) print #unused: ps = """ ( ( 3 x1^2 x3^4 + 7 x2^5 - 61 ) ) """ f = 3 * x1**2 * x3**4 + 7 * x2**5 - 61 print "f = " + str(f) print #id = r.ideal( ps ); id = r.ideal("", [f]) print "Ideal: " + str(id) print #startLog(); pps = """ 3 x1^2 x3^4 + 7 x2^5 - 61 """ ri = r.ring print "ri = " + str(ri) print pol = id.pset print "pol = " + str(pol)
( 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 ) ) """; k = r.ideal( ks ); p = r.ideal( ps ); f = k.sum( p ); print "Ideal: " + str(f); print; rg = f.GB(); print "Output:", rg; print;
# trinks 7 example r = PolyRing(QQ(), "B,S,T,Z,P,W", PolyRing.lex) print "Ring: " + str(r) print #one,B,S,T,Z,P,W = r.gens(); # capital letter variables automaticaly included in Python 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 f6 = 99 * W - 11 * B * S + 3 * B**2 f7 = 10000 * B**2 + 6600 * B + 2673 f = r.ideal("", [f1, f2, f3, f4, f5, f6, f7]) print "Ideal: " + str(f) print #exit() rg = f.GB() print "GB: " + str(rg) print #startLog(); s = rg.syzygy() print "syzygy: " + str(s) print
+ x1 * x2 * x3 * x6 + x1 * x2 * x5 * x6 + x1 * x4 * x5 * x6 + x2 * x3 * x4 * x5 + x3 * x4 * x5 * x6, x1 * x2 * x3 * x4 * x5 + x1 * x2 * x3 * x4 * x6 + x1 * x2 * x3 * x5 * x6 + x1 * x2 * x4 * x5 * x6 + x1 * x3 * x4 * x5 * x6 + x2 * x3 * x4 * x5 * x6, x1 * x2 * x3 * x4 * x5 * x6 - 1, ] # f = r.ideal( ps ); f = r.ideal("", F) print "Ideal: " + str(f) print startLog() o = f.optimize() print "optimized Ideal: " + str(o) print rg = f.GB() print "Output:", rg print # org = o.GB(); # print "opt Output:", org;
x1*x2*x3*x4 + x1*x2*x3*x6 + x1*x2*x5*x6 + x1*x4*x5*x6 + x2*x3*x4*x5 + x3*x4*x5*x6, x1*x2*x3*x4*x5 + x1*x2*x3*x4*x6 + x1*x2*x3*x5*x6 + x1*x2*x4*x5*x6 + x1*x3*x4*x5*x6 + x2*x3*x4*x5*x6, x1*x2*x3*x4*x5*x6 - 1 ) """; F = [ x1 + x2 + x3 + x4 + x5 + x6, x1*x2 + x1*x6 + x2*x3 + x3*x4 + x4*x5 + x5*x6, x1*x2*x3 + x1*x2*x6 + x1*x5*x6 + x2*x3*x4 + x3*x4*x5 + x4*x5*x6, x1*x2*x3*x4 + x1*x2*x3*x6 + x1*x2*x5*x6 + x1*x4*x5*x6 + x2*x3*x4*x5 + x3*x4*x5*x6, x1*x2*x3*x4*x5 + x1*x2*x3*x4*x6 + x1*x2*x3*x5*x6 + x1*x2*x4*x5*x6 + x1*x3*x4*x5*x6 + x2*x3*x4*x5*x6, x1*x2*x3*x4*x5*x6 - 1 ]; #f = r.ideal( ps ); f = r.ideal( "", F ); print "Ideal: " + str(f); print; startLog(); o = f.optimize(); print "optimized Ideal: " + str(o); print; rg = f.GB(); print "Output:", rg; print; #org = o.GB(); #print "opt Output:", org;
- (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) print f1 print f2 print h = l1 * l2 * (l1 + 1) * (l2 + 1) * (l1 + l2 + 1) * (l1 + l2 + 2) print h print F = r.ideal(list=[f1, f2]) print F print H = r.ideal(list=[h]) print H print G = F.GB() print G print #startLog(); Q = G.sat(H) print Q
- (u0+u1+u2+u12)*l2*(l1+l2+2)*(l2+1) ; print f1; print f2; print #h = l1*l2*(l1+1)*(l2+1)*(l1+l2+1)*(l1+l2+2); h = l1*l2*(l1+1); hp = (l2+1); hpp = (l1+l2+1)*(l1+l2+2); print h; print hp; print hpp; print F = r.ideal(list=[f1,f2]); print F; print H = r.ideal(list=[h]); print H; print Hp = r.ideal(list=[hp]); print Hp; print Hpp = r.ideal(list=[hpp]); print Hpp; print
# trinks 7 example r = PolyRing(QQ(), "B,S,T,Z,P,W", PolyRing.lex ); print "Ring: " + str(r); print; #one,B,S,T,Z,P,W = r.gens(); # capital letter variables automaticaly included in Python 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; f6 = 99 * W - 11 *B * S + 3 * B**2; f7 = 10000 * B**2 + 6600 * B + 2673; f = r.ideal( "", [f1,f2,f3,f4,f5,f6,f7] ); print "Ideal: " + str(f); print; #exit() rg = f.GB(); print "GB: " + str(rg); print; #startLog(); s = rg.syzygy(); print "syzygy: " + str(s); print;
( 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 ) ) """; # ( 10000 B**2 + 6600 B + 2673 ) # ( B**2 + 33/50 B + 2673/10000 ) #f = Ideal( r, ps ); #print "Ideal: " + str(f); #print; f = r.ideal( ps ); print "Ideal: " + str(f); print; #startLog(); rg = f.GB(); #print "seq Output:", rg; #print; rg = f.parGB(2); #print "par Output:", rg; #print; f.distClient(); # starts in background rg = f.distGB(2);
( ( x - 1 ), ( y - 1 ), ( z - 1 ) ) """; ps2 = """ ( ( x - 2 ), ( y - 3 ), ( z - 3 ) ) """; F1 = r.ideal( ps1 ); #print "Ideal: " + str(F1); #print; F2 = r.ideal( ps2 ); #print "Ideal: " + str(F2); #print; #startLog(); rg1 = F1.GB(); print "rg1 = ", rg1; print; rg2 = F2.GB(); print "rg2 = ", rg2;
#automatic: [one,c,x,y,z] = r.gens(); print one,c,x,y,z; #sys.exit(); f1 = (x**2 - 2); #**2; f2 = (y**2 - c)**5; f3 = (z**2 - 2 * c); #**5; print "f1 = ", f1; print "f2 = ", f2; print "f3 = ", f3; #print "f4 = ", f4; print; F = r.ideal( list=[f1,f2,f3] ); #F = r.ideal( list=[f1,f3] ); #F = r.ideal( list=[f2,f3] ); print "F = ", F; print; startLog(); t = System.currentTimeMillis(); P = F.primeDecomp(); t = System.currentTimeMillis() - t; print "P = ", P; print; print "decomp time =", t, "milliseconds"; print;
#r = Ring( "", k.ring ); #r = PolyRing( GF(23), k.ring.vars, Order.IGRLEX ); r = PolyRing(GF(32003), k.ring.vars, Order.IGRLEX) #r = PolyRing( GF(536870909), k.ring.vars, Order.IGRLEX ); #r = PolyRing( GF(4294967291), k.ring.vars, Order.IGRLEX ); #r = PolyRing( GF(9223372036854775783), k.ring.vars, Order.IGRLEX ); #r = PolyRing( GF(170141183460469231731687303715884105727), k.ring.vars, Order.IGRLEX ); print "Ring: " + str(r) print ps = k.polyList() #ps = k.cyclicPolys(); print "ps = " + str(ps) f = r.ideal(ps) print "Ideal: " + str(f) print if False: rg = f.parGB(tnum) for th in range(tnum, 0, -1): rg = f.parGB(th) #print "par Output:", rg; #print; rg = f.GB() #print "seq Output:", rg; print arri = arris_algorithm()
# EF(QQ()).realExtend("q","q^3 - 3", "[1,2]").realExtend("w", "w^2 - q", "[1,2]").realExtend("s", "s^5 - 2", "[1,2]").polynomial("x").build(); f1 = q**3 - 3; f2 = w**2 - q; #f3 = s**5 - 2; f3 = s**3 - 2; f4 = x**2 - w * s; print "f1 = ", f1; print "f2 = ", f2; print "f3 = ", f3; print "f4 = ", f4; print; F = r.ideal( list=[f1,f2,f3,f4] ); print "F = ", F; print; startLog(); t = System.currentTimeMillis(); R = F.realRoots(); t = System.currentTimeMillis() - t; print "R = ", R; print; print "real roots = "; F.realRootsPrint() print "real roots time =", t, "milliseconds"; print;
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; print "w2 = ", w2; print "f1 = ", f1; print "f2 = ", f2; print; F = Q.ideal( list=[w1,w2,f1,f2] ); print "F = ", F; print; #sys.exit(); startLog(); t = System.currentTimeMillis(); P = F.primeDecomp(); #P = F.primaryDecomp(); t1 = System.currentTimeMillis() - t; print "P = ", P; print; print "prime/primary decomp time =", t1, "milliseconds"; print;
r = PolyRing(rf,"x,y,z",PolyRing.lex); print "Ring: " + str(r); print; #automatic: [one,c,x,y,z] = r.gens(); f1 = (x**2 - 2); #**2 f2 = (y**2 - c)**5; f3 = (z**2 - 2 * c); #**5 print "f1 = ", f1; print "f2 = ", f2; print "f3 = ", f3; print; F = r.ideal( list=[f1,f2,f3] ); print "F = ", F; print; startLog(); t = System.currentTimeMillis(); Q = F.primaryDecomp(); t = System.currentTimeMillis() - t; print "Q = ", Q; print; print "primary decomp time =", t, "milliseconds"; print; print "F = ", F; print;
# EF(QQ()).realExtend("q","q^3 - 3", "[1,2]").realExtend("w", "w^2 - q", "[1,2]").realExtend("s", "s^5 - 2", "[1,2]").polynomial("x").build(); f1 = q**3 - 3 f2 = w**2 - q #f3 = s**5 - 2; f3 = s**3 - 2 f4 = x**2 - w * s print "f1 = ", f1 print "f2 = ", f2 print "f3 = ", f3 print "f4 = ", f4 print F = r.ideal(list=[f1, f2, f3, f4]) print "F = ", F print startLog() t = System.currentTimeMillis() R = F.realRoots() t = System.currentTimeMillis() - t print "R = ", R print print "real roots = " F.realRootsPrint() print "real roots time =", t, "milliseconds" print
#R = PolyRing( GF(32003), "x,y,z" ); R = PolyRing(QQ(), "x,y,z") print "Ring: " + str(R) print #automatic: [one,x,y,z] = R.gens(); f1 = x**5 - x * y**6 - z**7 f2 = x * y + y**3 + z**3 f3 = x**2 + y**2 - z**2 L = [f1, f2, f3] #print "L = ", str(L); F = R.ideal(list=L) print "Ideal: " + str(F) print PR = R.powerseriesRing() print "Power series ring: " + str(PR) print Fp = PSIdeal(PR, L) print "Power series ideal: " + str(Fp) print startLog() #9+5 # truncate at total degree 9 S = Fp.STD()
r = PolyRing( ZZ(), "x4,x3,x2,x1", PolyRing.lex ); print "Ring: " + str(r); print; #is automatic: [one,x4,x3,x2,x1] = r.gens(); f1 = x1 + 2 * x2 + 3 * x3 + 4 * x4 + 3; f2 = 3 * x2 + 2 * x3 + x4 + 2; f3 = 3 * x3 + 5 * x4 + 1; f4 = 5 * x4 + 4; L = [f1,f2,f3,f4]; #print "L = ", str(L); f = r.ideal( list=L ); print "Ideal: " + str(f); print; #startLog(); g = f.eGB(); print "seq e-GB:", g; print "is e-GB:", g.iseGB(); print; #sys.exit(); d = f.dGB(); print "seq d-GB:", d; print "is d-GB:", d.isdGB();
print #automatic: [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 print startLog() G = F.GB() print "G = ", G print #terminate(); #sys.exit(); r = PolyRing(QQ(), "x,y", PolyRing.lex) 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 ) ) """ k = r.ideal(ks) p = r.ideal(ps) f = k.sum(p) print "Ideal: " + str(f) print rg = f.GB() print "Output:", rg print
# Raksanyi & Walter example # rational function coefficients #r = Ring( "RatFunc(a1, a2, a3, a4) (x1, x2, x3, x4) G" ); r = PolyRing(RF(PolyRing(ZZ(), "a1, a2, a3, a4", PolyRing.lex)), "x1, x2, x3, x4", PolyRing.grad) print "Ring: " + str(r) print ps = """ ( ( 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 = r.ideal(ps) print "Ideal: " + str(f) print rg = f.GB() rg = f.GB() rg = f.GB() print "GB:", rg print terminate()
print "Ring: " + str(r); print; #unused: ps = """ ( ( 3 x1^2 x3^4 + 7 x2^5 - 61 ) ) """; f = 3 * x1**2 * x3**4 + 7 * x2**5 - 61; print "f = " + str(f); print; #id = r.ideal( ps ); id = r.ideal( "", [f] ); print "Ideal: " + str(id); print; #startLog(); pps = """ 3 x1^2 x3^4 + 7 x2^5 - 61 """; ri = r.ring; print "ri = " + str(ri); print pol = id.pset; print "pol = " + str(pol);
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; #startLog(); rg = f.GB(); rg = f.GB(); if not rg.isGB(): print "seq Output:", rg; print; #------------------- sbgb = sigbased_gb(); arri = arris_algorithm();
# jython examples for jas. # $Id$ # import sys from jas import PolyRing, ZZ, Order, Ideal from jas import startLog, terminate # sicora, e-gb example r = PolyRing(ZZ(), "t", Order.INVLEX) print "Ring: " + str(r) print f1 = 2 * t + 1 f2 = t**2 + 1 F = r.ideal("", [f1, f2]) print "Ideal: " + str(F) print E = F.eGB() print "seq e-GB:", E print "is e-GB:", E.iseGB() print f = t**3 n = E.eReduction(f) print "e-Reduction = " + str(n)
##f1 = x**4 + t; ##f2 = y**4 + t; f1 = x**3 + t; f2 = y**3 + t; #f2 = f2**2; f3 = (y-x); f3 = f3**prime; print "f1 = ", f1; print "f2 = ", f2; #print "f3 = ", f3; print; F = r.ideal( list=[f1,f2] ); print "F = ", F; print; startLog(); t = System.currentTimeMillis(); R = F.radicalDecomp(); #R = F.primeDecomp(); t = System.currentTimeMillis() - t; print "R = ", R; print; print "decomp time =", t, "milliseconds"; print;
r = PolyRing(QQ(), "(x,y,z)", PolyRing.grad) print "Ring: " + str(r) print ps1 = """ ( ( x^2 - 2 ), ( y^2 - 3 ), ( z^3 - x * y ) ) """ ff = [x**2 - 2, y**2 - 3, z**3 - x * y] #F1 = r.ideal( ps1 ); F1 = r.ideal("", ff) print "Ideal: " + str(F1) print #e = Ring( "Rat(z) G" ); e = PolyRing(QQ(), "(x,z)", PolyRing.grad) print "Ring: " + str(e) print #startLog(); rg1 = F1.eliminateRing(e) print "rg1 = ", rg1 print rg2 = rg1.intersectRing(e)
h = 2 n = 5 delta = QQ(2, 10) # 0.2 f1 = R - 1 / (1 + A**n) f2 = M * L - delta * A - (v * M * A) / (h + A) f3 = c0 + c * (1 - 1 / (1 + A**n) - gamma * M) F = [f1, f2, f3] print "f1 = " + str(f1) print "f2 = " + str(f2) print "f3 = " + str(f3) print I = r.ideal("", list=F) print "Ideal: " + str(I) print #sys.exit(); G = I.GB() print "GB: " + str(G) print # ------------ GB and CGB -------------------- r2 = PolyRing(PolyRing(QQ(), "L", PolyRing.lex), "A, M, R", PolyRing.lex) #r2 = PolyRing(RF(PolyRing(QQ(),"L",PolyRing.lex)),"A, M, R",PolyRing.lex); print "PolyRing: " + str(r2) print
ps1 = """ ( ( x^2 - 2 ), ( y^2 - 3 ), ( z^3 - x * y ) ) """; ff = [ x**2 - 2, y**2 - 3, z**3 - x * y ] #F1 = r.ideal( ps1 ); F1 = r.ideal( "", ff ); print "Ideal: " + str(F1); print; #e = Ring( "Rat(z) G" ); e = PolyRing( QQ(), "(x,z)", PolyRing.grad ); print "Ring: " + str(e); print; #startLog(); rg1 = F1.eliminateRing(e); print "rg1 = ", rg1; print; rg2 = rg1.intersectRing(e);
print "w2 = " + str(w2) print "x = " + str(x) print "wx = " + str(wx) print "y = " + str(y) print "z = " + str(z) print f1 = (y**2 - x) * (y**2 - 2) #f1 = ( y**2 - x )**3 * ( y**2 - 2 )**2; f2 = (z**2 - y**2) print "f1 = ", f1 print "f2 = ", f2 print F = Yr.ideal(list=[f1, f2]) print "F = ", F print #sys.exit(); startLog() t = System.currentTimeMillis() P = F.primeDecomp() #P = F.primaryDecomp(); t1 = System.currentTimeMillis() - t print "P = ", P print print "prime/primary decomp time =", t1, "milliseconds" print
- (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) ; print f1; print f2; print h = l1*l2*(l1+1)*(l2+1)*(l1+l2+1)*(l1+l2+2); print h; print F = r.ideal(list=[f1,f2]); print F; print H = r.ideal(list=[h]); print H; print G = F.GB(); print G; print #startLog(); Q = G.sat(H); print Q;
##f1 = x**4 + t; ##f2 = y**4 + t; f1 = x**3 + t f2 = y**3 + t #f2 = f2**2; f3 = (y - x) f3 = f3**prime print "f1 = ", f1 print "f2 = ", f2 #print "f3 = ", f3; print F = r.ideal(list=[f1, f2]) print "F = ", F print startLog() t = System.currentTimeMillis() R = F.radicalDecomp() #R = F.primeDecomp(); t = System.currentTimeMillis() - t print "R = ", R print print "decomp time =", t, "milliseconds" print print "F = ", F
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 print "w2 = ", w2 print "f1 = ", f1 print "f2 = ", f2 print F = Q.ideal(list=[w1, w2, f1, f2]) print "F = ", F print # sys.exit(); startLog() t = System.currentTimeMillis() P = F.primeDecomp() # P = F.primaryDecomp(); t1 = System.currentTimeMillis() - t print "P = ", P print print "prime/primary decomp time =", t1, "milliseconds"
# check("GroebnerBasis({x^2 + y^2 + z^2 - 1, x - z + 2, z^2 - x*y}, # {x, y, z})", # "{12-28*z+27*z^2-12*z^3+3*z^4, -6+4*y+11*z-6*z^2+3*z^3, 2+x-z}"); Scripting.setCAS(Scripting.CAS.Math) #Scripting.setCAS(Scripting.CAS.Sage); #Scripting.setCAS(Scripting.CAS.Singular); r = PolyRing(ZZ(), "x,y,z", Order.Lexicographic) print "Ring: " + str(r) print ff = [x**2 + y**2 + z**2 - 1, x - z + 2, z**2 - x * y] F = r.ideal("", ff) print "F = " + str(F) print #startLog(); G = F.GB() print "G = " + str(G) print print "Ma: " + str( r.ideal("", [ 12 - 28 * z + 27 * z**2 - 12 * z**3 + 3 * z**4, -6 + 4 * y + 11 * z - 6 * z**2 + 3 * z**3, 2 + x - z ])) print
#is automatic: [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] ); print "F = ", F; print; startLog(); t = System.currentTimeMillis(); R = F.complexRoots(); #R = F.realRoots(); t = System.currentTimeMillis() - t; print; print "R = ", R; print; print "complex roots: "; F.complexRootsPrint() print "complex roots time =", t, "milliseconds";
#R = PolyRing( ZM(32003), "x,y,z" ); R = PolyRing( QQ(), "x,y,z" ); print "Ring: " + str(R); print; [one,x,y,z] = R.gens(); f1 = x**5 - x * y**6 - z**7; f2 = x * y + y**3 + z**3; f3 = x**2 + y**2 - z**2; L = [f1,f2,f3]; #print "L = ", str(L); F = R.ideal( list=L ); print "Ideal: " + str(F); print; PR = R.powerseriesRing(); print "Power series ring: " + str(PR); print; Fp = PSIdeal(PR,L); print "Power series ideal: " + str(Fp); print; startLog(); #9+5 # truncate at total degree 9 S = Fp.STD();