Miscalculated NilpotencyClass

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
mickg
Posts: 4
Joined: Sat Jan 24, 2015 9:16 am

Miscalculated NilpotencyClass

Post by mickg » Sat Jan 24, 2015 9:37 am

Around a month ago, I had the strangest problem with a NilpotencyClass calculations and posted on StackOverflow:

http://stackoverflow.com/questions/2750 ... calculated

I will report the question in Markdown code, hoping it won't be too distorted by differences in formating code over here.
We devised a function in class to test if the nilpotency class of a group is or not the sum of those of its p-Sylows. The original was the first one below, without the `n:=NilpotencyClass(G)` line. I got a strange result, as you will see below. The teacher got a different strange result: `3 1`. But the group `G` wasn't abelian, so we would have found a non-Abelian class 1 nilpotent group, which is absurd. Then we tried isolating the function, also because a classmate of mine had the function properly working. That solved the problem. Curious about this mystery, I tried to isolate the problem, and found it came straight out of the function. I tried calculating the returned `NilpotencyClass` at the start of the function and it worked. If I don't, even outside the function I still get `NilpotencyClass(G)=32767`! So I have the following code:

TestNilpotencyClass := function(G)
n:=NilpotencyClass(G);
if not IsNilpotent(G) then
return 0;
end if;
N := #G;
somma := 0;
for pn in Factorisation(N) do
p := pn[1];
P := SylowSubgroup(G,p);
c := NilpotencyClass(P);
somma +:= c;
end for;
return somma, n;
end function;

TestNilpotencyClassb := function(G)
if not IsNilpotent(G) then
return 0;
end if;
NilpotencyClass(G);
N := #G;
somma := 0;
for pn in Factorisation(N) do
p := pn[1];
P := SylowSubgroup(G,p);
c := NilpotencyClass(P);
somma +:= c;
end for;
return somma, NilpotencyClass(G);
end function;

TestNilpotencyClassc := function(G)
if (not IsNilpotent(G)) then
return 0;
end if;
NilpotencyClass(G);
N := #G;
somma := 0;
for pn in Factorisation(N) do
p := pn[1];
P := SylowSubgroup(G,p);
c := NilpotencyClass(P);
somma +:= c;
end for;
return somma, NilpotencyClass(G);
end function;

TestNilpotencyClassd := function(G)
if (not (IsNilpotent(G))) then
return 0;
end if;
NilpotencyClass(G);
N := #G;
somma := 0;
for pn in Factorisation(N) do
p := pn[1];
P := SylowSubgroup(G,p);
c := NilpotencyClass(P);
somma +:= c;
end for;
return somma, NilpotencyClass(G);
end function;

G:=SmallGroups(40)[11];
TestNilpotencyClass(G);
TestNilpotencyClassb(G);
TestNilpotencyClassc(G);
TestNilpotencyClassd(G);

Loading this on MAGMA yields the following result:

3 2
32767
3 32767
32767
3 32767
32767
3 32767

Where is that 32767 coming from? Notice how it is 2^(15)-1. Why is this miscalculation being produced?

**Update:** I tried copy-pasting the code to MAGMA and the result was the same. Furthermore, after quitting and reopening, I tried copy-pasting only the first function, then computing the `NilpotencyClass`, then using the function, and here's the result:

host-001:~ michelegorini$ magma
Magma V2.20-4 (STUDENT) Fri Dec 19 2014 17:29:45 [Seed = 1006321001]
Type ? for help. Type <Ctrl>-D to quit.
TestNilpotencyClass := function(G)
n:=NilpotencyClass(G);
if not IsNilpotent(G) then
return 0;
end if;
N := #G;
somma := 0;
for pn in Factorisation(N) do
p := pn[1];
P := SylowSubgroup(G,p);
c := NilpotencyClass(P);
somma +:= c;
end for;
return somma, n;
end function;> TestNilpotencyClass := function(G)
function> n:=NilpotencyClass(G);
function> if not IsNilpotent(G) then
function|if> return 0;
function|if> end if;
function> N := #G;
function> somma := 0;
function> for pn in Factorisation(N) do
function|for> p := pn[1];
function|for> P := SylowSubgroup(G,p);
function|for> c := NilpotencyClass(P);
function|for> somma +:= c;
function|for> end for;
function> return somma, n;
function> end function;
> G:=SmallGroups(40)[11];
> TestNilpotencyClass(G);
3 2
> NilpotencyClass(G);
32767
> TestNilpotencyClass(G);
3 32767
> TestNilpotencyClass(SmallGroups(40)[11]);
3 2
> NilpotencyClass(SmallGroups(40)[11]);
2
So, what is going on here? Any ideas why the Nilpotency class of that group (which should be 2) is very often evaluated to that number, which is 2^(15)-1, and was evaluated to 1 on my teacher's computer and to 2 on another one? And any ideas why the behaviour of this problem changes by saving the NilpotencyClass into a variable depending on where I do that in the code?

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: Miscalculated NilpotencyClass

Post by mgates3 » Mon Jan 26, 2015 9:05 pm

You appear to be posting on the wrong forum. This forum is for MAGMA, the GPU linear algebra library (http://icl.cs.utk.edu/magma/), not the Magma computational algebra system (http://magma.maths.usyd.edu.au/magma/).
-mark

mickg
Posts: 4
Joined: Sat Jan 24, 2015 9:16 am

Re: Miscalculated NilpotencyClass

Post by mickg » Tue Jan 27, 2015 3:47 am

I guess you're right. I had no idea there were two MAGMAs. Or maybe I miscapped it. Sorry. Will head over there. Thx for redirecting me :).

mickg
Posts: 4
Joined: Sat Jan 24, 2015 9:16 am

Re: Miscalculated NilpotencyClass

Post by mickg » Tue Jan 27, 2015 3:48 am

Is there any forum about the computational algebra MAGMA?

Post Reply