0
function Max(x)
    max := 0; L := [];
    for i := 1 to x do
        P2<x,y,z> := ProjectiveSpace(Rationals(),2);
        C_i := Curve(P2, x^3+y^3-i*z^3);
        E_i, C_itoE_i := EllipticCurve(C_i);
        gen := Generators(E_i);
        if max eq #gen then
            max := #gen;
        end if;
    end for;
    return max;
end function;

When I run this (Max(100)) it tells me that max = 0. However I know there are #gen = 1 and 2 at different places and therefore #gen > 0. I have having difficulty localizing max. It thinks of max outside the if and for statements as different than the max inside the for and if statements and thus is not updating max. I'm not sure how in magma CAS syntax I can correct for this. Can somebody help me understand Magma syntax with respect to this aspect? I tried putting local max; inside the loop and if statements but gave me syntax error.

Adam Staples
  • 396
  • 2
  • 7
  • 19
  • Also, why is there not tag for magma cas? magma is a higher level programming language (computer algebra system)/software. In my opinion it should be a tagging option. – Adam Staples Oct 15 '14 at 09:59
  • There is not a tag for everything someone *might* want. There are tags for the most popular things. This might be the first magma question ever. It seems to cost $1400 USD. – President James K. Polk Oct 21 '14 at 02:09

1 Answers1

1

I don't know magma, but if it's anything like other procedural computer languages then it looks like you have a simple bug in your code. the lines:

    if max eq #gen then
        max := #gen;
    end if;

should be changed to

    if #gen > max then
        max := #gen;
    end if;

using whatever the the correct syntax is for the greater-than operator.

President James K. Polk
  • 40,516
  • 21
  • 95
  • 125
  • Yes my professor the next day pointed this out to me and you are correct! When I found out I felt quite dumb, lol. Yes I understand why it's > than now. – Adam Staples Oct 22 '14 at 04:12