print "Ring: " + str(r); print; ps = """ ( ( z1^3 z2 z3^2 - w1 ), ( z1^2 z2^2 z3 - w2 ), ( z1 z2^3 z3 - w3 ), ( z1 - w4 ), ( z2 - w5 ), ( z3 - w6 ) ) """; f = Ideal( r, ps ); print "Ideal: " + str(f); print; rg = f.GB(); print "seq Output:", rg; print; pf = """ ( ( z1^45 z2^21 z3^18 ) ) """; fp = Ideal( r, pf );
( 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 U3^2 U4 - 3/20 A46^4 U3^3 - 21/100 A46^3 U3^3 - 91/800 A46^2 U3^3 - 5887/200000 A46 U3^3 - 343/128000 U3^3 ) ) """; f = Ideal( r, ps ); print "Ideal: " + str(f); print; fi = f.toInteger(); print "Ideal: " + str(fi); print; # "1152921504606846883" mf = ModIntegerRing( str(2**60-93), True ); #mf = ModIntegerRing( str(19), True ); fm = fi.toModular( mf ); print "Ideal: " + str(fm); #sys.exit(); rm = fm.GB();
#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( "Rat(B,S,T,Z,P,W) L" ); #print "Ring: " + str(r); #print; k = Katsura(knum) r = Ring(k.varList("Rat", "G")) print "Ring: " + str(r) print ps = k.polyList() f = Ideal(r, ps) print "Ideal: " + str(f) print 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 # rg = f.distGB(2); #print "dist Output:", rg;
#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( "Rat(B,S,T,Z,P,W) L" ); #print "Ring: " + str(r); #print; k = Katsura(knum); r = Ring( k.varList("Rat","G") ); print "Ring: " + str(r); print; ps = k.polyList(); f = Ideal( r, ps ); print "Ideal: " + str(f); print; 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; # rg = f.distGB(2);
print "------- RC(PolyRing(QQ(),\"a,b,c\",PolyRing.lex)) ---------"; r = PolyRing(QQ(),"a,b,c",PolyRing.lex); print "r = " + str(r); [pone,pa,pb,pc] = r.gens(); print "pone = " + str(pone); print "pa = " + str(pa); print "pb = " + str(pb); print "pc = " + str(pc); g1 = pa**2 - 2; print "g1 = " + str(g1); g2 = pb**3 - 2; print "g2 = " + str(g2); g3 = pc**2 - pa*pb; print "g3 = " + str(g3); F = Ideal(r,list=[g1,g2,g3]); print "F = " + str(F); rc = RC(F); print "rc.factory() = " + str(rc.factory()); [one,a,b,c] = rc.gens(); print "one = " + str(one); print "a = " + str(a); print "b = " + str(b); print "c = " + str(c); r1 = a*b + c; print "r1 = " + str(r1); r2 = r1*r1*r1 - r1*r1 + one; print "r2 = " + str(r2); r3 = r2**3 - r1 + one; print "r3 = " + str(r3); r4 = ( -120 * a * b**2 * c + 606 * b**2 * c + 1917 * a * b * c + 400 * b * c - 132 * a * c - 673 * c + 432 * a * b**2 + 2130 * b**2 + 1436 * a * b - 72 * b + 100 * a - 1950 );
( 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 U3^2 U4 - 3/20 A46^4 U3^3 - 21/100 A46^3 U3^3 - 91/800 A46^2 U3^3 - 5887/200000 A46 U3^3 - 343/128000 U3^3 ) ) """; f = Ideal( r, ps ); 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;
from jas import Ideal # ? example r = Ring("Rat(x,y,z) L") print "Ring: " + str(r) print ps = """ ( ( z^3 - y ), ( y z - x ), ( y^3 - x^2 z ), ( x z^2 - y^2 ) ) """ f = Ideal(r, ps) print "Ideal: " + str(f) print from edu.jas.module import SyzygyAbstract from edu.jas.vector import ModuleList from edu.jas.module import ModGroebnerBaseAbstract R = SyzygyAbstract().resolution(f.pset) for i in range(0, R.size()): print "\n %s. resolution" % (i + 1) print "\n ", R[i]
print "------- RC(PolyRing(QQ(),\"a,b,c\",PolyRing.lex)) ---------" r = PolyRing(QQ(), "a,b,c", PolyRing.lex) print "r = " + str(r) [pone, pa, pb, pc] = r.gens() print "pone = " + str(pone) print "pa = " + str(pa) print "pb = " + str(pb) print "pc = " + str(pc) g1 = pa**2 - 2 print "g1 = " + str(g1) g2 = pb**3 - 2 print "g2 = " + str(g2) g3 = pc**2 - pa * pb print "g3 = " + str(g3) F = Ideal(r, list=[g1, g2, g3]) print "F = " + str(F) rc = RC(F) print "rc.factory() = " + str(rc.factory()) [one, a, b, c] = rc.gens() print "one = " + str(one) print "a = " + str(a) print "b = " + str(b) print "c = " + str(c) r1 = a * b + c print "r1 = " + str(r1) r2 = r1 * r1 * r1 - r1 * r1 + one print "r2 = " + str(r2) r3 = r2**3 - r1 + one print "r3 = " + str(r3) r4 = (-120 * a * b**2 * c + 606 * b**2 * c + 1917 * a * b * c + 400 * b * c -
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 U3^2 U4 - 3/20 A46^4 U3^3 - 21/100 A46^3 U3^3 - 91/800 A46^2 U3^3 - 5887/200000 A46 U3^3 - 343/128000 U3^3 ) ) """ pp1 = """ ( 20 A46 + 7 ), """ pp2 = """ ( 5480334637123239936000000000000000000 A46^32 + 23330567455181792870400000000000000000 A46^31 - 22260410953422455439360000000000000000 A46^30 - 379039147753503876710400000000000000000 A46^29 - 1305289515920841108357120000000000000000 A46^28 - 2661894008686715272062566400000000000000 A46^27 - 3732109213267597335472373760000000000000 A46^26 - 3719328899522099347074318336000000000000 A46^25 - 2513175000419852400394764288000000000000 A46^24 - 801907472074794268996141056000000000000 A46^23 + 559468735767998648283977220096000000000 A46^22 + 1161692745234469227508358814105600000000 A46^21 + 1115120737963786660933876454522880000000 A46^20 + 754183677763034219243933188227072000000 A46^19 + 366205139138005719200006792439398400000 A46^18 + 95407136698255889087520898673541120000 A46^17 - 35897763757636362165902256717692928000 A46^16 - 68696958358719191677546842722559590400 A46^15 - 55382563098545072682320366954843996160 A46^14 - 32223104574376823941781148035505979392 A46^13 - 14867126462105106300205537184606126080 A46^12 - 5596017809975575801376014016653721600 A46^11 - 1730893404306213749794640488178116608 A46^10 - 438698743729822786570094575456788480 A46^9 - 90199241991532353478039712103521280 A46^8 - 14778859703096558479650421488297984 A46^7 - 1874056025467134008603806670325120 A46^6 - 174876413639867324175892636604160 A46^5 - 10843113615171040141214782270464 A46^4 - 325577720150105105056746125600 A46^3 + 6040454553390756509792153750 A46^2 + 761038687880048862537750000 A46 + 13745464623924567359765625 ), """ pp = ps % pp1 f = Ideal(r, pp) print "Ideal: " + str(f) print startLog() rg = f.GB() print "seq Output:", rg print #sys.exit();
print; ps = """ ( 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 ) """; #x1 + x2 + x3 + x4 + x5 + x6, #x1*x2*x3*x4*x5*x6 - 1 f = Ideal( r, ps ); 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;
# ? example r = Ring("Rat(x,y,z) L") print "Ring: " + str(r) print ps = """ ( ( z^3 - y ), ( y z - x ), ( y^3 - x^2 z ), ( x z^2 - y^2 ) ) """ f = Ideal(r, ps) print "Ideal: " + str(f) print rg = f.GB() print "seq Output:", rg print from edu.jas.module import SyzygyAbstract from edu.jas.vector import ModuleList from edu.jas.module import ModGroebnerBaseAbstract s = SyzygyAbstract().zeroRelations(rg.list) sl = ModuleList(rg.pset.ring, s) print "syzygy:", sl
( 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 U3^2 U4 - 3/20 A46^4 U3^3 - 21/100 A46^3 U3^3 - 91/800 A46^2 U3^3 - 5887/200000 A46 U3^3 - 343/128000 U3^3 ) ) """; f = Ideal( r, ps ); print "Ideal: " + str(f); print; #startLog(); rg = f.GB(); #print "seq Output:", rg; #print; #sys.exit(); rg = f.parNewGB(2); #print "par-new Output:", rg; #print;
( 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 U3^2 U4 - 3/20 A46^4 U3^3 - 21/100 A46^3 U3^3 - 91/800 A46^2 U3^3 - 5887/200000 A46 U3^3 - 343/128000 U3^3 ) ) """ f = Ideal(r, ps) 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
( 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 U3^2 U4 - 3/20 A46^4 U3^3 - 21/100 A46^3 U3^3 - 91/800 A46^2 U3^3 - 5887/200000 A46 U3^3 - 343/128000 U3^3 ) ) """; f = Ideal( r, ps ); print "Ideal: " + str(f); print; rg = f.GB(); #print "seq Output:", rg; #print; #sys.exit(); rg = f.parGB(2); #print "par Output:", rg; #print; rg = f.parOldGB(2); #print "par-old Output:", rg;
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 = Ideal(r, ps) print "Ideal: " + str(i) g = i.GB() print "seq GB:", g rsi = """ # polynomial ring: Rat(x1,x2,x3) G """ ri = Ring(rsi) print "Ring: " + str(ri) y = application.Ideal(g.pset).intersect(ri.ring) len = y.list.size()
( 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 U3^2 U4 - 3/20 A46^4 U3^3 - 21/100 A46^3 U3^3 - 91/800 A46^2 U3^3 - 5887/200000 A46 U3^3 - 343/128000 U3^3 ) ) """ f = Ideal(r, ps) print "Ideal: " + str(f) print fi = f.toInteger() print "Ideal: " + str(fi) print # "1152921504606846883" mf = ModIntegerRing(str(2**60 - 93), True) #mf = ModIntegerRing( str(19), True ); fm = fi.toModular(mf) print "Ideal: " + str(fm) #sys.exit(); rm = fm.GB()
from jas import Ideal 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 = Ideal(r, ps) print "Ideal: " + str(f) print rg = f.GB() print "seq Output:", rg print pf = """ ( ( z1^37 z2^20 ) ) """ fp = Ideal(r, pf) print "Ideal: " + str(fp)
from jas import Ring from jas import Ideal # 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 = Ideal(r, ps) print "Ideal: " + str(f) print g = f.GB() print "Groebner base:", g print