ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 08 Sep 2014 13:06:34 -0500Macaulay2 Does Nothinghttps://ask.sagemath.org/question/24041/macaulay2-does-nothing/I've been trying to run Macaulay2 in Sage to generate some examples for a project I have.
I used cloud.sagemath.com and everything worked fine for a while, but some inputs just wouldn't evaluate. There was no error, and it wouldn't freeze- it's just that nothing would happen. I figured there was a calculation limit, so I downloaded sage and Macaulay2, but the same problem occurs. Sage and Macaulay2 appear to be properly installed.
An example of code which doesn't do anything is:
R = ZZ[O1,O2,O3,O4,O5,In1,In2,In3,In4,In5];
I = ideal(O1*O2,O2*O3,O3*O4,O4*O5,O5*O1,In1*In3,In3*In5,In5*In2,In2*In4,In4*In1,O1*In1,O2*In2,O3*In3,O4*In4,O5*In5);
J = ideal(O1,O2,O3,O4,O5,In1,In2,In3,In4,In5);
v = flatten entries mingens J;
e = flatten entries mingens I;
m = table(e,e,(a,b)->a*b);
s = unique flatten m;
for i when i<length e do s=delete(e#i^2,s);
dvds = (a,b) -> if b%(a*a)==0 then true else false;
f = x -> any(v, a -> dvds(a,x));
i = 0; while i<#s do if f(s#i)==false then s=delete(s#i,s) else i=i+1;
F = ideal(s);
betti F
betti I
Meanwhile, similar code which returns correct-looking output is
%macaulay2
R = ZZ[x1,x2,x3,x4];
I = ideal(x1*x2, x2*x3, x3*x4, x4*x1);
J = ideal (x1,x2,x3,x4);
v = flatten entries mingens J;
e = flatten entries mingens I;
m = table(e,e,(a,b)->a*b);
s = unique flatten m;
for i when i<length e do s=delete(e#i^2,s);
dvds = (a,b) -> if b%(a*a)==0 then true else false;
f = x -> any(v, a -> dvds(a,x));
i = 0; while i<#s do if f(s#i)==false then s=delete(s#i,s) else i=i+1;
F = ideal(s);
betti F
betti I
The output is
Ideal of R
Ideal of R
2 2 2 2
{x1*x3*x4 , x2*x3 x4, x1 x2*x4, x1*x2 x3}
List
Ideal of R
0 1
total: 1 4
0: 1 .
1: . .
2: . .
3: . 4
BettiTally
0 1
total: 1 4
0: 1 .
1: . 4
BettiTally
The only real difference seems to be the number of calculations made, and this idea is confirmed in that the calculations always seem to fail around `ZZ[x1..xn]` for `n>8`. There must be some way to fix this. Can anyone help?Sun, 07 Sep 2014 13:01:12 -0500https://ask.sagemath.org/question/24041/macaulay2-does-nothing/Answer by slelievre for <p>I've been trying to run Macaulay2 in Sage to generate some examples for a project I have.</p>
<p>I used <a href="http://cloud.sagemath.com">cloud.sagemath.com</a> and everything worked fine for a while, but some inputs just wouldn't evaluate. There was no error, and it wouldn't freeze- it's just that nothing would happen. I figured there was a calculation limit, so I downloaded sage and Macaulay2, but the same problem occurs. Sage and Macaulay2 appear to be properly installed.</p>
<p>An example of code which doesn't do anything is:</p>
<pre><code>R = ZZ[O1,O2,O3,O4,O5,In1,In2,In3,In4,In5];
I = ideal(O1*O2,O2*O3,O3*O4,O4*O5,O5*O1,In1*In3,In3*In5,In5*In2,In2*In4,In4*In1,O1*In1,O2*In2,O3*In3,O4*In4,O5*In5);
J = ideal(O1,O2,O3,O4,O5,In1,In2,In3,In4,In5);
v = flatten entries mingens J;
e = flatten entries mingens I;
m = table(e,e,(a,b)->a*b);
s = unique flatten m;
for i when i<length e do s=delete(e#i^2,s);
dvds = (a,b) -> if b%(a*a)==0 then true else false;
f = x -> any(v, a -> dvds(a,x));
i = 0; while i<#s do if f(s#i)==false then s=delete(s#i,s) else i=i+1;
F = ideal(s);
betti F
betti I
</code></pre>
<p>Meanwhile, similar code which returns correct-looking output is</p>
<pre><code>%macaulay2
R = ZZ[x1,x2,x3,x4];
I = ideal(x1*x2, x2*x3, x3*x4, x4*x1);
J = ideal (x1,x2,x3,x4);
v = flatten entries mingens J;
e = flatten entries mingens I;
m = table(e,e,(a,b)->a*b);
s = unique flatten m;
for i when i<length e do s=delete(e#i^2,s);
dvds = (a,b) -> if b%(a*a)==0 then true else false;
f = x -> any(v, a -> dvds(a,x));
i = 0; while i<#s do if f(s#i)==false then s=delete(s#i,s) else i=i+1;
F = ideal(s);
betti F
betti I
</code></pre>
<p>The output is</p>
<pre><code>Ideal of R
Ideal of R
2 2 2 2
{x1*x3*x4 , x2*x3 x4, x1 x2*x4, x1*x2 x3}
List
Ideal of R
0 1
total: 1 4
0: 1 .
1: . .
2: . .
3: . 4
BettiTally
0 1
total: 1 4
0: 1 .
1: . 4
BettiTally
</code></pre>
<p>The only real difference seems to be the number of calculations made, and this idea is confirmed in that the calculations always seem to fail around <code>ZZ[x1..xn]</code> for <code>n>8</code>. There must be some way to fix this. Can anyone help?</p>
https://ask.sagemath.org/question/24041/macaulay2-does-nothing/?answer=24062#post-id-24062When I try your two examples on SageMathCloud in a terminal, I get similar-looking output.
Here is what I get running your simpler example on SageMathCloud
in a terminal.
~$ M2
Macaulay2, version 1.6
with packages: ConwayPolynomials, Elimination, IntegralClosure, LLLBases, PrimaryDecomposition, ReesAlgebra, TangentCone
i1 : R = ZZ[x1,x2,x3,x4];
i2 : I = ideal(x1*x2, x2*x3, x3*x4, x4*x1);
o2 : Ideal of R
i3 : J = ideal (x1,x2,x3,x4);
o3 : Ideal of R
i4 : v = flatten entries mingens J;
i5 : e = flatten entries mingens I;
i6 : m = table(e,e,(a,b)->a*b);
i7 : s = unique flatten m;
i8 : for i when i<length e do s=delete(e#i^2,s);
i9 : dvds = (a,b) -> if b%(a*a)==0 then true else false;
i10 : f = x -> any(v, a -> dvds(a,x));
i11 : i = 0; while i<#s do if f(s#i)==false then s=delete(s#i,s) else i=i+1;
i13 : F = ideal(s);
o13 : Ideal of R
i14 : betti F
0 1
o14 = total: 1 4
0: 1 .
1: . .
2: . .
3: . 4
o14 : BettiTally
i15 : betti I
0 1
o15 = total: 1 4
0: 1 .
1: . 4
o15 : BettiTally
And here is what I get running your more involved example on SageMathCloud in a terminal.
~$ M2
Macaulay2, version 1.6
with packages: ConwayPolynomials, Elimination, IntegralClosure, LLLBases, PrimaryDecomposition, ReesAlgebra, TangentCone
i1 : R = ZZ[O1,O2,O3,O4,O5,In1,In2,In3,In4,In5];
i2 : I = ideal(O1*O2,O2*O3,O3*O4,O4*O5,O5*O1,In1*In3,In3*In5,In5*In2,In2*In4,In4*In1,O1*In1,O2*In2,O3*In3,O4*In4,O5*In5);
o2 : Ideal of R
i3 : J = ideal(O1,O2,O3,O4,O5,In1,In2,In3,In4,In5);
o3 : Ideal of R
i4 : v = flatten entries mingens J;
i5 : e = flatten entries mingens I;
i6 : m = table(e,e,(a,b)->a*b);
i7 : s = unique flatten m;
i8 : for i when i<length e do s=delete(e#i^2,s);
i9 : dvds = (a,b) -> if b%(a*a)==0 then true else false;
i10 : f = x -> any(v, a -> dvds(a,x));
i11 : i = 0; while i<#s do if f(s#i)==false then s=delete(s#i,s) else i=i+1;
i13 : F = ideal(s);
o13 : Ideal of R
i14 : betti F
0 1
o14 = total: 1 30
0: 1 .
1: . .
2: . .
3: . 30
o14 : BettiTally
i15 : betti I
0 1
o15 = total: 1 15
0: 1 .
1: . 15
o15 : BettiTally
Mon, 08 Sep 2014 13:06:34 -0500https://ask.sagemath.org/question/24041/macaulay2-does-nothing/?answer=24062#post-id-24062