grobner-libgiac - imj

grobner-libgiac -- Sage
http://localhost:8080/home/admin/55/print
grobner-libgiac
Times are on a 2 core 2012 notebook:
Intel(R) Core(TM) i5-2435M CPU @ 2.40GHz
n=6;R=PolynomialRing(QQ,n,'x');
I = sage.rings.ideal.Cyclic(R,n);
I.gens()
[x0 + x1 + x2 + x3 + x4 + x5, x0*x1 + x1*x2 + x2*x3 + x3*x4 + x0*x5
+ x4*x5, x0*x1*x2 + x1*x2*x3 + x2*x3*x4 + x0*x1*x5 + x0*x4*x5 +
x3*x4*x5, x0*x1*x2*x3 + x1*x2*x3*x4 + x0*x1*x2*x5 + x0*x1*x4*x5 +
x0*x3*x4*x5 + x2*x3*x4*x5, x0*x1*x2*x3*x4 + x0*x1*x2*x3*x5 +
x0*x1*x2*x4*x5 + x0*x1*x3*x4*x5 + x0*x2*x3*x4*x5 + x1*x2*x3*x4*x5,
x0*x1*x2*x3*x4*x5 - 1]
time B = I.groebner_basis("libsingular:std")
Time: CPU 0.21 s, Wall: 0.37 s
import sys;sys.path.append('/home/fred/giacpy-sage')
(If you have the standalone version of giacpy for sage in /home/fred/giacpy-sage )
if not, then patch sage and do:
from sage.libs.giac import *
import giacpy
// Giac share
root-directory:/home/fred/dev/sage/git-trac-command/local/share/giac\
/
// Using keyword file
/home/fred/dev/sage/git-trac-command/local/share/giac/doc/fr/keyword\
s
// Giac share
root-directory:/home/fred/dev/sage/git-trac-command/local/share/giac\
/
Help file
/home/fred/dev/sage/git-trac-command/local/share/giac/doc/fr/aide_ca\
s not found
1 sur 8
15/08/2014 11:17
grobner-libgiac -- Sage
http://localhost:8080/home/admin/55/print
Added 0 synonyms
from giacpy import libgiac,giacsettings
next_prime(11**25) # testing if there are no conflicts with
pari. (it is safer to use a giac compiled without pari. NB in
the giac-1.1.0.spkg pari is disabled
108347059433883722041830257
next_prime?
File: /home/fred/dev/sage/git-trac-command/local/lib/python2.7/site-packages/sage/rings
/arith.py
Type: <type ‘function’>
Definition: next_prime(n, proof=None)
Docstring:
The next prime greater than the integer n. If n is prime, then this function does not
return n, but the next prime after n. If the optional argument proof is False, this
function only returns a pseudo-prime, as defined by the PARI nextprime function. If
it is None, uses the global default (see sage.structure.proof.proof)
INPUT:
n - integer
proof - bool or None (default: None)
EXAMPLES:
sage:
2
sage:
2
sage:
3
sage:
5
sage:
5
next_prime(-100)
next_prime(1)
next_prime(2)
next_prime(3)
next_prime(4)
Notice that the next_prime(5) is not 5 but 7.
sage: next_prime(5)
7
sage: next_prime(2004)
2011
2 sur 8
15/08/2014 11:17
grobner-libgiac -- Sage
http://localhost:8080/home/admin/55/print
I1=libgiac(I.gens())
In giac 1.1 there is a new code for grobner basis with revlex.
It is much faster than the old ones, but only with revlex and doesn't use cocoa.
time B1=I1.gbasis([R.gens()],'revlex')
Time: CPU 0.09 s, Wall: 0.14 s
time B1=I1.gbasis([R.gens()],'revlex,cocoa=false')
Time: CPU 0.10 s, Wall: 0.08 s
[(B[-i-1]/B1[i]).simplify() for i in range(len(B))] #singular
donne des fractions. les degres ne sont pas dans le meme ordre
[1, 1, 1/14, 1, 1/2, 1/7, 1/2, 1/903, 1/1806, 1/258, 1/903, 1/903,
1/1806, 1/903, 1/1806, 1/1806, 1/7, 1/602, 1/258, 1/1806, 1/18,
1/274400, 1/54880, 1/109760, 1/164640, 1/86596, 1/43298, 1/86596,
1/35739035160, 1/2978252930, 1/1191301172, 1/2382602344,
1/3573903516, 1/35739035160, 1/14, 1/24990, 1/42, 1/24990, 1/99960,
1/6664, 1/99960, 1/19992, 1/99960, 1/2040, 1/16660]
n=8;R=PolynomialRing(QQ,n,'x');
I = sage.rings.ideal.Cyclic(R,n);I
Ideal (x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7, x0*x1 + x1*x2 + x2*x3
+ x3*x4 + x4*x5 + x5*x6 + x0*x7 + x6*x7, x0*x1*x2 + x1*x2*x3 +
x2*x3*x4 + x3*x4*x5 + x4*x5*x6 + x0*x1*x7 + x0*x6*x7 + x5*x6*x7,
x0*x1*x2*x3 + x1*x2*x3*x4 + x2*x3*x4*x5 + x3*x4*x5*x6 + x0*x1*x2*x7
+ x0*x1*x6*x7 + x0*x5*x6*x7 + x4*x5*x6*x7, x0*x1*x2*x3*x4 +
x1*x2*x3*x4*x5 + x2*x3*x4*x5*x6 + x0*x1*x2*x3*x7 + x0*x1*x2*x6*x7 +
x0*x1*x5*x6*x7 + x0*x4*x5*x6*x7 + x3*x4*x5*x6*x7, x0*x1*x2*x3*x4*x5
+ x1*x2*x3*x4*x5*x6 + x0*x1*x2*x3*x4*x7 + x0*x1*x2*x3*x6*x7 +
x0*x1*x2*x5*x6*x7 + x0*x1*x4*x5*x6*x7 + x0*x3*x4*x5*x6*x7 +
x2*x3*x4*x5*x6*x7, x0*x1*x2*x3*x4*x5*x6 + x0*x1*x2*x3*x4*x5*x7 +
x0*x1*x2*x3*x4*x6*x7 + x0*x1*x2*x3*x5*x6*x7 + x0*x1*x2*x4*x5*x6*x7 +
x0*x1*x3*x4*x5*x6*x7 + x0*x2*x3*x4*x5*x6*x7 + x1*x2*x3*x4*x5*x6*x7,
x0*x1*x2*x3*x4*x5*x6*x7 - 1) of Multivariate Polynomial Ring in x0,
x1, x2, x3, x4, x5, x6, x7 over Rational Field
#time B = I.groebner_basis("libsingular:std")
I1=libgiac(I.gens())
time B1=libgiac(I.gens()).gbasis([R.gens()],'revlex')
3 sur 8
15/08/2014 11:17
grobner-libgiac -- Sage
http://localhost:8080/home/admin/55/print
Running a probabilistic check for the reconstructed Groebner basis.
If successfull, error probability is less than 1e-15 and is
estimated to be less than 10^-105. Use proba_epsilon:=0 to certify
(this takes more time).
Time: CPU 193.03 s, Wall: 63.75 s
I1
[x0+x1+x2+x3+x4+x5+x6+x7,x0*x1+x1*x2+x2*x3+x3*x4+x4*x5+x5*x6+x0*x7+x\
6*x7,x0*x1*x2+x1*x2*x3+x2*x3*x4+x3*x4*x5+x4*x5*x6+x0*x1*x7+x0*x6*x7+\
x5*x6*x7,x0*x1*x2*x3+x1*x2*x3*x4+x2*x3*x4*x5+x3*x4*x5*x6+x0*x1*x2*x7\
+x0*x1*x6*x7+x0*x5*x6*x7+x4*x5*x6*x7,x0*x1*x2*x3*x4+x1*x2*x3*x4*x5+x\
2*x3*x4*x5*x6+x0*x1*x2*x3*x7+x0*x1*x2*x6*x7+x0*x1*x5*x6*x7+x0*x4*x5*\
x6*x7+x3*x4*x5*x6*x7,x0*x1*x2*x3*x4*x5+x1*x2*x3*x4*x5*x6+x0*x1*x2*x3\
*x4*x7+x0*x1*x2*x3*x6*x7+x0*x1*x2*x5*x6*x7+x0*x1*x4*x5*x6*x7+x0*x3*x\
4*x5*x6*x7+x2*x3*x4*x5*x6*x7,x0*x1*x2*x3*x4*x5*x6+x0*x1*x2*x3*x4*x5*\
x7+x0*x1*x2*x3*x4*x6*x7+x0*x1*x2*x3*x5*x6*x7+x0*x1*x2*x4*x5*x6*x7+x0\
*x1*x3*x4*x5*x6*x7+x0*x2*x3*x4*x5*x6*x7+x1*x2*x3*x4*x5*x6*x7,x0*x1*x\
2*x3*x4*x5*x6*x7-1]
p=next_prime(2**29);I1p=I1 % p;
time B1p=I1p.gbasis([R.gens()],'revlex')
Time: CPU 13.32 s, Wall: 13.34 s
giacsettings.proba_epsilon=0
time B2=I1.gbasis([R.gens()],'revlex')
Time: CPU 285.21 s, Wall: 159.44 s
n
8
time B2p=I1p.gbasis([R.gens()],'revlex')
Time: CPU 13.47 s, Wall: 13.49 s
giacsettings.proba_epsilon=1e-15
n=9;R=PolynomialRing(QQ,n,'x');
I = sage.rings.ideal.Katsura(R,n);
I.gens()
[x0 + 2*x1 + 2*x2 + 2*x3 + 2*x4 + 2*x5 + 2*x6 + 2*x7 + 2*x8 - 1,
x0^2 + 2*x1^2 + 2*x2^2 + 2*x3^2 + 2*x4^2 + 2*x5^2 + 2*x6^2 + 2*x7^2
+ 2*x8^2 - x0, 2*x0*x1 + 2*x1*x2 + 2*x2*x3 + 2*x3*x4 + 2*x4*x5 +
2*x5*x6 + 2*x6*x7 + 2*x7*x8 - x1, x1^2 + 2*x0*x2 + 2*x1*x3 + 2*x2*x4
+ 2*x3*x5 + 2*x4*x6 + 2*x5*x7 + 2*x6*x8 - x2, 2*x1*x2 + 2*x0*x3 +
4 sur 8
15/08/2014 11:17
grobner-libgiac -- Sage
2*x1*x4 +
+ 2*x0*x4
2*x1*x4 +
+ 2*x1*x5
2*x1*x6 +
http://localhost:8080/home/admin/55/print
2*x2*x5 +
+ 2*x1*x5
2*x0*x5 +
+ 2*x0*x6
2*x0*x7 +
2*x3*x6 +
+ 2*x2*x6
2*x1*x6 +
+ 2*x1*x7
2*x1*x8 -
2*x4*x7 +
+ 2*x3*x7
2*x2*x7 +
+ 2*x2*x8
x7]
2*x5*x8 - x3, x2^2 + 2*x1*x3
+ 2*x4*x8 - x4, 2*x2*x3 +
2*x3*x8 - x5, x3^2 + 2*x2*x4
- x6, 2*x3*x4 + 2*x2*x5 +
time B = I.groebner_basis("libsingular:std")
Time: CPU 24.42 s, Wall: 24.46 s
giacsettings.proba_epsilon=1e-15;
Igiac=libgiac(I.gens());
time Bgiac=Igiac.gbasis([R.gens()],'revlex')
Running a probabilistic check for the reconstructed Groebner basis.
If successfull, error probability is less than 1e-15 and is
estimated to be less than 10^-133. Use proba_epsilon:=0 to certify
(this takes more time).
Time: CPU 4.87 s, Wall: 3.74 s
[(Bgiac[i]/B[-i-1]).simplify() for i in range(len(B))]
#singular donne des coeffs ds Q et giac dans Z. les degres ne
sont pas dans le meme ordre.
[1, 34, 17, 2, 1, 34, 17, 34, 17, 456, 15884, 18107760, 410442560,
10055842720, 60335056320, 153915960, 30167528160, 1005584272,
30167528160, 50400, 2434320, 3059892381268800, 5368232247840,
624218045778835200, 936327068668252800, 40574172975624288000,
673176323879136, 94244685343079040, 160215965083234368,
19225915809988124160, 1124716074884305263360, 65772869876275161600,
16027204067101350002880000, 31568735283684477278400000,
12901154976614089785600000, 1278523401364210256640,
15981542517052628208000, 498624126532042000089600,
1246560316330105000224000, 4155201054433683334080000,
53620425371552310671400000, 3431707223779347882969600000,
428963402972418485371200000, 43671700800, 10100582354873058048000,
3679497857846614003200000, 18439301764890417902400000,
29207853995586421957401600000, 4867975665931070326233600000,
194436210331306367424000, 68571170176840712244864000,
4721125066675483038058886400000, 21245062800039673671264988800000,
9997676611783375845301171200000, 84980251200158694685059955200000,
19779153466836936187947704572800000,
84391054791837594401910206177280000,
8228127842204165454186245102284800000,
12342191763306248181279367653427200000,
5485418561469443636124163401523200000,
32279578457877879858730653862809600000,
80783695585336043095674278400000,
5 sur 8
15/08/2014 11:17
grobner-libgiac -- Sage
http://localhost:8080/home/admin/55/print
4662605777249027090705538891294720000,
2302335324182077228226716934400000,
681275832769667296773519747840000,
26212087665812949243361172298144000000,
25020629135548724277753846284592000000,
17614522911426301891538707784352768000000,
10408581720388269299545600054390272000000,
5204290860194134649772800027195136000000,
15612872580582403949318400081585408000000,
433690905016177887481066668932928000000,
8807261455713150945769353892176384000000,
31225745161164807898636800163170816000000,
29490981541100096348712533487439104000000,
145622709254516384685339846100800000,
1857931837089306069968889609708663552000000,
534940564608427535578799434656000000,
206937534203786441394956623406400000,
523227842001545434737984000000, 18530986070888067480303600000000000,
852425359260851104093965600000000000,
20138549112537607334219937300000000000,
14693085432507438311046866254080000000000,
22039628148761157466570299381120000000000,
220396281487611574665702993811200000000000,
7145479441914143683898581273036800000000000,
164856418552733457849945839370777600000000000,
501736926030058349978096032867584000000000000,
86549619740185065371221565669658240000000000000,
86549619740185065371221565669658240000000000000,
173099239480370130742443131339316480000000000000,
995320627012128251769048005201069760000000000000,
684775113183438769706947371999360000000000000,
117096544354368029619888000611890560000000000000,
9289659185446530349844448048543317760000000000000,
34252456641828669953328700080000000000000,
1667471866518113887273410808440000000000000,
1394006480409143209760571435855840000000000000,
4608285885650060197555608052416000000000000,
2275018576027721718329252583316730880000000000,
14362491010276020949048311763363200000000000,
11601435511299777370704755699721300000000000000,
8906152513725081617914761951301200000000000000,
24687854768045926244859720129006926400000000000000,
5723093605319737447672026029906151120000000000000,
6 sur 8
15/08/2014 11:17
grobner-libgiac -- Sage
http://localhost:8080/home/admin/55/print
12590805931703422384878457265793532464000000000000,
228923744212789497906881041196246044800000000000,
65609530003315329201150306645365046000000000000000,
101396546368760054219959564815564162000000000000000,
1061824633573655287791416562748587904464000000000000000,
804412601192163096811679214203475685200000000000000,
891932692201870441744789912708813839749760000000000000,
4504710566676113342145403599539463837120000000000000,
13384828354506364017307526754153240360000000000000000,
190733804051715687246632256246683675130000000000000000,
363157162914466668517587815893685717447520000000000000000,
311277568212400001586503842194587757812160000000000000000,
31376778875809920159919587293214445987465728000000000000,
3651075236175518815601097697921480467571200000000000000,
50115688482196400255427118593328629007757760000000000000000,
1804164785359070409195376269359830644279279360000000000000000,
26060158010742128132822101668530887084034035200000000000000,
2345414220966791531953989150167779837563063168000000000000000,
868671933691404271094070055617696236134467840000000000000000,
3909023701611319219923315250279633062605105280000000000000000,
7818047403222638439846630500559266125210210560000000000000000,
78180474032226384398466305005592661252102105600000000000000,
4690828441933583063907978300335559675126126336000000000000000,
5941716026449205214283439180425042255159760025600000000000000,
33060526035630719122749591082758503689200000000000000000,
17489018272848650415934533682779248451586800000000000000000,
2497431809362787279395451409900876678886595040000000000000000,
1895550743306355545061147620114765399274925635360000000000000000,
49148922844300504489799756150118559995485571831120000000000000000,
32053017097287414773566204223480421205096212019680000000000000000000\
,
11650038906514079600392331919688076168775353984076000000000000000000\
0,
12116040462774642784408025196475599215526368143439040000000000000000\
000,
18640062250422527360627731071500921870040566374521600000000000000000\
00,
13169609198668089983052201300516955669050400155912000000000000000000\
0,
67707284939034768501103670215598936792647351389806400000000000000000\
00,
78269621389524192387275842769232370932300338206616198400000000000000\
0000,
7 sur 8
15/08/2014 11:17
grobner-libgiac -- Sage
http://localhost:8080/home/admin/55/print
10702423662598620066232085460995019013303790415662465075199360000000\
0000000000000]
giacsettings.proba_epsilon=0;
time Bgiac=Igiac.gbasis([R.gens()],'revlex')
Time: CPU 33.92 s, Wall: 32.85 s
8 sur 8
15/08/2014 11:17