746d745
< //   return E1,psi0,phi0,omeg0; 
1347a1347,1356
> function NumberOfUnits(D)
>    if D eq -3 then
>       return 6;
>    elif D eq -4 then
>       return 4;
>    else 
>       return 2;
>    end if;
> end function;
> 
1355,1368c1364,1368
<    if DK eq -3 then 
<       w := 3; 
<    elif DK eq -4 then 
<       w := 2; 
<    else  
<       w := 1; 
<    end if; 
<    if m gt 1 then
<       return ClassNumber(QuadraticField(DK))* 
<          &*[ Integers() | (p[1] - KroneckerSymbol(DK,p[1]))*p[1]^(p[2]-1)  
<             : p in Factorization(m) ] div w; 
<    else 
<       return ClassNumber(QuadraticField(DK));
<    end if;
---
>    wK := NumberOfUnits(DK) div 2;
>    wR := NumberOfUnits(D) div 2;
>    return ClassNumber(QuadraticField(DK))* 
>       &*[ Integers() | p[1]^p[2] - KroneckerSymbol(DK,p[1])*p[1]^(p[2]-1)  
>          : p in Factorization(m) ] div (wK div wR); 
1397a1398,1952
> 
> /////////////////////////////////////////////////////////////////
> //                                                             //
> //            MODULAR CURVES, AND MODULAR ISOGENIES            //
> //                                                             //
> /////////////////////////////////////////////////////////////////
> 
> // The genus zero case.
> 
> EllModRec0 := recformat<
>    level : Integers(),
>    genus_type : Integers(),
>    function_field : FldFunRat,
>    canonical_involution : Map,
>    singular_locus : FldFunRatUElt, 
>    eisenstein_2 : FldFunRatUElt,
>    eisenstein_4 : FldFunRatUElt,
>    eisenstein_6 : FldFunRatUElt,
>    j_invariant : FldFunRatUElt
> >;
> 
> // The genus_type one case: genus one and hyperelliptic curves.
> 
> EllModRec1 := recformat<
>    level : Integers(),
>    genus_type : Integers(),
>    function_field : RngUPolRes,
>    inv_function_field : FldFunRat,
>    canonical_involution : Map,
>    singular_locus : RngUPolResElt,
>    eisenstein_2 : RngUPolResElt,
>    eisenstein_4 : RngUPolResElt,
>    eisenstein_6 : RngUPolResElt,
>    j_invariant : RngUPolResElt
> >;
> 
> // The general case.
> 
> EllModRec := recformat<
>    level : Integers(),
>    genus_type : Integers(),
>    function_field : RngUPolRes,
>    inv_function_field : RngUPolRes,
>    canonical_involution : Map,
>    singular_locus : RngUPolResElt,
>    eisenstein_2 : RngUPolResElt,
>    eisenstein_4 : RngUPolResElt,
>    eisenstein_6 : RngUPolResElt,
>    j_invariant : RngUPolResElt
> >;
> 
> intrinsic ModularFunctionField(X::Rec) -> Rng
>    {Returns the function field of the modular curve X.}
>    return X`function_field;
> end intrinsic;
> 
> intrinsic ModularLevel(X::Rec) -> RngIntElt
>    {Returns the level of the modular curve X.}
>    return X`level;
> end intrinsic;
> 
> intrinsic ModularCurve(N::RngIntElt) -> Rec
>    {Returns the modular curve of level N.}
>    if N in [2,3,4,5,7,8,13,16] then
>       X := rec< EllModRec0 | level := N >;
>       X`genus_type := 0;
>    elif N in [11,17,19,23,29,31,32,41,47,59,71] then
>       X := rec< EllModRec1 | level := N >;
>       X`genus_type := 1;
>    else 
>       X := rec< EllModRec | level := N >;
>    end if;
>    g := X`genus_type;
>    if (N eq 2) then
>       F<u> := FunctionField(Integers());
>       X`function_field := F;
>       X`canonical_involution := hom< F -> F | 4096/u >;
>       X`singular_locus := u + 64;
>       X`eisenstein_2 := F!(-1/24);
>       X`eisenstein_4 := (u + 256)/(u + 64);
>       X`eisenstein_6 := (u - 512)/(u + 64);
>       X`j_invariant := (u + 256)^3/u^2;
>       return X;
>    elif (N eq 3) then
>       F<u> := FunctionField(Integers());
>       X`function_field := F;
>       X`canonical_involution := hom< F -> F | 1/u >;
>       X`singular_locus := u + 1;
>       X`eisenstein_2 := F!(-1/12);
>       X`eisenstein_4 := (u + 9)/(u + 1);
>       X`eisenstein_6 := (u^2 - 18*u - 27)/(u + 1)^2;
>       X`j_invariant := 27*(u + 1)*(u + 9)^3/u^3;
>       return X;
>    elif (N eq 5) then
>       F<u> := FunctionField(Integers());
>       X`function_field := F;
>       X`canonical_involution := hom< F -> F | 125/u >;
>       X`singular_locus := u^2 + 22*u + 125;
>       X`eisenstein_2 := F!(-1/6);
>       X`eisenstein_4 := (u^2 + 250*u + 3125)/(u^2 + 22*u + 125);
>       X`eisenstein_6 := (u^2 - 500*u - 15625)/(u^2 + 22*u + 125);
>       X`j_invariant := (u^2 + 250*u + 3125)^3/u^5;
>       return X;
>    elif (N eq 7) then
>       F<u> := FunctionField(Integers());
>       X`function_field := F;
>       X`canonical_involution := hom< F -> F | 49/u >;
>       X`singular_locus := u^2 + 13*u + 49;
>       X`eisenstein_2 := F!(-1/4);
>       X`eisenstein_4 := (u^2 + 245*u + 2401)/(u^2 + 13*u + 49);
>       X`eisenstein_6 := (u^4 - 490*u^3 - 21609*u^2 - 235298*u - 823543)/
>            (u^2 + 13*u + 49)^2;
>       X`j_invariant := (u^2 + 13*u + 49)*(u^2 + 245*u + 2401)^3/u^7;
>       return X;
>    elif (N eq 13) then
>       F<u> := FunctionField(Integers());
>       X`function_field := F;
>       X`canonical_involution := hom< F -> F | 13/u >;
>       X`singular_locus := (u^2 + 6*u + 13)*(u^2 + 5*u + 13);
>       X`eisenstein_2 := F!(-1/2);
>       X`eisenstein_4 := (u^4 + 247*u^3 + 3380*u^2 + 15379*u + 28561)/ 
>          ((u^2 + 6*u + 13)*(u^2 + 5*u + 13));
>       X`eisenstein_6 := (u^6 - 494*u^5 - 20618*u^4 - 237276*u^3 
>             - 1313806*u^2 - 3712930*u - 4826809)/ 
>          ((u^2 + 6*u + 13)*(u^2 + 5*u + 13)^2);
>       X`j_invariant := (u^4 + 247*u^3 + 3380*u^2 + 15379*u + 28561)^3
>          *(u^2 + 5*u + 13)/u^13;
>       return X;
>    elif (N eq 11) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u+1)*(u^3 - 17*u^2 + 19*u - 7)>;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := K!1;
>       X`eisenstein_2 := (-5*u + 3)/12;
>       X`eisenstein_4 := (61*u^2 - 246*u + 45) + 60*v;
>       X`eisenstein_6 := (-665*u^3 + 5733*u^2 - 1323*u - 945) 
>          + (-666*u + 918)*v;
>       X`j_invariant := 
>          ((u^11 - 55*u^10 + 1188*u^9 - 12716*u^8 + 69630*u^7 
>          - 177408*u^6 + 133056*u^5 + 132066*u^4 - 187407*u^3  
>          + 40095*u^2 + 24300*u - 6750) + 
>          (u^9 - 47*u^8 + 843*u^7 - 7187*u^6 + 29313*u^5 - 48573*u^4 
>          + 10665*u^3 + 27135*u^2 - 12150*u)*v)/2;
>       return X;
>    elif (N eq 17) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u^4-10*u^3-3*u^2+4*u-8) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := u - 1;
>       X`eisenstein_2 := (-2*u + 1)/3;
>       X`eisenstein_4 := ( (145*u^3 - 605*u^2 + 260*u + 20)
>          + (144*u - 120)*v)/(u - 1);
>       X`eisenstein_6 := ( (-2456*u^4 + 16940*u^3 - 7308*u^2 
>          - 2792*u + 4256) + (-2457*u^2 + 5166*u - 1260)*v )/(u - 1);
>       X`j_invariant := (
>          u^17 - 51*u^16 + 1105*u^15 - 13243*u^14 + 95659*u^13 
>             - 424065*u^12 + 1110355*u^11 - 1454945*u^10 + 73746*u^9  
>             + 2450210*u^8 - 3131026*u^7 + 1104830*u^6 + 1073992*u^5 
>             - 1392232*u^4 + 557600*u^3 + 2720*u^2 - 67200*u + 16000 + 
>          (u^15 - 46*u^14 + 889*u^13 - 9374*u^12 + 58549*u^11 
>             - 219274*u^10 + 468035*u^9 - 457950*u^8 - 102282*u^7  
>             + 680948*u^6 - 593800*u^5 + 111616*u^4 + 146208*u^3 
>             - 105920*u^2 + 22400*u)*v )/2;
>       return X;
>    elif (N eq 19) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u + 2)*(u^3 - 10*u^2 + 12*u - 4) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := u + 1;
>       X`eisenstein_2 := (-3*u + 2)/4;
>       X`eisenstein_4 := ( (181*u^3 - 423*u^2 - 488*u + 340) + 
>          60*(3*u + 1)*v )/(u + 1);
>       X`eisenstein_6 := ( (-3429*u^5 + 13464*u^4 + 29907*u^3 
>          - 11214*u^2 - 15948*u + 5040 ) + 
>          (-3430*u^3 + 252*u^2 + 5390*u + 1484)*v )/(u + 1)^2;
>       X`j_invariant := (
>          u^19 - 38*u^18 + 570*u^17 - 4066*u^16 + 11153*u^15 
>             + 21090*u^14 - 180443*u^13 + 129580*u^12 + 932406*u^11 
>             - 1140950*u^10 - 2420087*u^9 + 2833014*u^8 + 3245960*u^7 
>             - 3025294*u^6 - 1988616*u^5 + 1562104*u^4 + 475456*u^3  
>             - 337440*u^2 - 22400*u + 16000 + 
>          (u^17 - 34*u^16 + 446*u^15 - 2652*u^14 + 4833*u^13 
>             + 19162*u^12 - 82469*u^11 - 24046*u^10 + 392654*u^9 
>             - 47024*u^8 - 847909*u^7 + 39282*u^6 + 791244*u^5 + 23472*u^4 
>             - 292400*u^3 - 8160*u^2 + 33600*u )*v )/2;
>       return X;
>    elif (N eq 23) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u^3 - u + 1)*(u^3 - 8*u^2 + 3*u - 7) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := K!1;
>       X`eisenstein_2 := (-11*u^2 + 10*u - 3)/12;
>       X`eisenstein_4 := (265*u^4 - 940*u^3 + 310*u^2 - 60*u - 135)
>          + (264*u - 120)*v;
>       X`eisenstein_6 := (-6083*u^6 + 36246*u^5 - 25557*u^4 
>          + 4060*u^3 + 18459*u^2 - 17010*u + 7749) + 
>          (-6084*u^3 + 12420*u^2 - 3852*u + 540)*v;
>       X`j_invariant := (
>          u^23 - 46*u^22 + 920*u^21 - 10465*u^20 + 74221*u^19  
>             - 336927*u^18 + 953856*u^17 - 1470068*u^16 + 336674*u^15 
>             + 3209696*u^14 - 6447728*u^13 + 5423124*u^12 + 302266*u^11 
>             - 6612454*u^10 + 8362616*u^9 - 4877702*u^8 - 116403*u^7 
>             + 2732814*u^6 - 2492280*u^5 + 1115109*u^4 - 170775*u^3 
>             - 83835*u^2 + 48600*u - 6750 + 
>         (u^20 - 42*u^19 + 759*u^18 - 7696*u^17 + 47754*u^16 
>             - 184350*u^15 + 421050*u^14 - 444070*u^13 - 225188*u^12 
>             + 1271974*u^11 - 1563176*u^10 + 693650*u^9 + 604358*u^8 
>             - 1256170*u^7 + 930982*u^6 - 254034*u^5 - 144045*u^4 
>             + 168588*u^3 - 72495*u^2 + 12150*u)*v )/2;
>       return X;
>    elif (N eq 29) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u^6 - 4*u^5 - 12*u^4 + 2*u^3 + 
>          8*u^2 + 8*u - 7) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := u + 1;
>       X`eisenstein_2 := (-7*u^2 + u + 3)/6;
>       X`eisenstein_4 := (
>          (421*u^5 - 301*u^4 - 1867*u^3 - 671*u^2 + 627*u + 405) +
>          (420*u^2 + 300*u - 60)*v )/(u + 1);
>       X`eisenstein_6 := (
>          (-12194*u^7 + 24136*u^6 + 101682*u^5 + 25634*u^4 
>             - 60382*u^3 - 47502*u^2 + 12852*u + 9450) + 
>          (-12195*u^4 + 252*u^3 + 20763*u^2 + 5706*u - 2241)*v 
>          )/(u + 1);
>       X`j_invariant := (
>          u^29 - 29*u^28 + 319*u^27 - 1421*u^26 - 580*u^25 
>             + 26680*u^24 - 53679*u^23 - 189399*u^22 + 622398*u^21 
>             + 853818*u^20 - 3427365*u^19 - 3592085*u^18 + 10954634*u^17 
>             + 14041394*u^16 - 18871083*u^15 - 37142939*u^14 + 9216142*u^13 
>             + 54103270*u^12 + 19207947*u^11 - 38397537*u^10 - 31795426*u^9 
>             + 9708910*u^8 + 19103721*u^7 + 2357613*u^6 - 5229135*u^5 
>             - 1754181*u^4 + 570024*u^3 + 281880*u^2 - 12150*u - 6750 + 
>          (u^26 - 27*u^25 + 273*u^24 - 1076*u^23 - 895*u^22 + 19043*u^21 
>             - 28279*u^20 - 129484*u^19 + 299477*u^18 + 569525*u^17 
>             - 1356433*u^16 - 2093854*u^15 + 3151075*u^14 + 5976011*u^13 
>             - 2746015*u^12 - 10263744*u^11 - 2363779*u^10 + 8434433*u^9 
>             + 5865017*u^8 - 2371192*u^7 - 3602119*u^6 - 373185*u^5 
>             + 839187*u^4 + 257850*u^3 - 57510*u^2 - 24300*u)*v )/2;
>       return X;
>    elif (N eq 31) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u^3 - 17*u - 27)*(u^3 + 4*u^2 + 3*u + 1) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := u;
>       X`eisenstein_2 := -(5*u^2 + 14*u + 5)/4;
>       X`eisenstein_4 := (
>          (481*u^5 + 2044*u^4 + 598*u^3 - 5668*u^2 - 5343*u - 1232) +
>          (480*u^2 + 840*u + 120)*v )/u;
>       X`eisenstein_6 := (
>          (-14895*u^8 - 89622*u^7 - 54513*u^6 + 661644*u^5 + 1755351*u^4 
>             + 1724706*u^3 + 751689*u^2 + 138600*u + 3240) + 
>          (-14896*u^5 - 59332*u^4 - 50260*u^3 + 22036*u^2 + 19572*u 
>             + 1232)*v )/u^2;
>       X`j_invariant := (
>          u^31 - 93*u^29 - 93*u^28+3720*u^27 + 7254*u^26 - 80197*u^25 
>             - 237708*u^24 + 940509*u^23 + 4184969*u^22 - 4557930*u^21 
>             - 41821542*u^20 - 19054584*u^19 + 225388104*u^18 + 365294142*u^17 
>             - 482826674*u^16 - 1774934109*u^15 - 697534038*u^14 
>             + 3105288879*u^13 + 4499034681*u^12 + 343835136*u^11 
>             - 4393744638*u^10 - 4271395977*u^9 - 1024559610*u^8 
>             + 1009134351*u^7 + 972695277*u^6 + 363257256*u^5 + 56466562*u^4 
>             - 2276640*u^3 - 1821312*u^2 - 157696*u +
>          (u^28 - 2*u^27 - 80*u^26+78*u^25 + 2848*u^24 + 2*u^23 
>             - 57019*u^22 - 50112*u^21 + 673072*u^20 + 1149790*u^19 
>             - 4457210*u^18 - 12086282*u^17 + 12639550*u^16 + 65962622*u^15 
>             + 17844960*u^14 - 172388766*u^13 - 198774025*u^12 + 128325724*u^11 
>             + 380038858*u^10 + 179518644*u^9 - 146065582*u^8 - 199366024*u^7 
>             - 75019429*u^6 + 4991078*u^5 + 12708136*u^4 + 3927888*u^3 
>             + 465920*u^2 + 15360*u)*v )/2;
>       return X;
>    elif (N eq 41) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u^8 - 4*u^7 - 8*u^6 + 10*u^5 + 20*u^4 +
>          8*u^3 - 15*u^2 - 20*u - 8) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := u - 1;
>       X`eisenstein_2 := (-5*u^3 + 2*u^2 + 6*u + 2)/3;
>       X`eisenstein_4 := (
>          (841*u^7 - 2403*u^6 - 1683*u^5 + 4443*u^4 + 2395*u^3 
>             - 1229*u^2 - 1796*u - 460) + 
>          (840*u^3 - 960*u^2 - 240*u + 240)*v )/(u - 1);
>       X`eisenstein_6 := (
>          (-34460*u^10 + 137588*u^9 + 95820*u^8 - 422908*u^7 - 207332*u^6
>             + 319068*u^5 + 376152*u^4 + 16896*u^3 - 170376*u^2 
>             - 82288*u - 2240) + 
>          (-34461*u^6 + 69174*u^5 + 42525*u^4 - 76356*u^3 - 33075*u^2
>             + 11214*u + 7308)*v )/(u - 1);
>       X`j_invariant := (
>          u^41 - 41*u^40 + 738*u^39 - 7544*u^38 + 46617*u^37
>             - 162483*u^36 + 163057*u^35 + 1099661*u^34 - 4706595*u^33
>             + 3613289*u^32 + 20512341*u^31 - 49355103*u^30 - 24135265*u^29
>             + 193718727*u^28 - 61715127*u^27 - 462271351*u^26 + 261059095*u^25
>             + 879637411*u^24 - 421357697*u^23 - 1503727029*u^22
>             + 282422801*u^21 + 2179745361*u^20 + 343522723*u^19
>             - 2400692229*u^18 - 1270633050*u^17 + 1772593672*u^16
>             + 1832223375*u^15 - 605560447*u^14 - 1542677562*u^13
>             - 271341362*u^12 + 745775322*u^11 + 436080674*u^10
>             - 147139488*u^9 - 217030548*u^8 - 31732934*u^7 + 46140990*u^6
>             + 20985112*u^5 - 1742664*u^4 - 2966432*u^3 - 465760*u^2 + 67200*u
>             + 16000 +
>          (u^37 - 39*u^36 + 666*u^35 - 6439*u^34 + 37484*u^33 - 122263*u^32
>             + 110144*u^31 + 750233*u^30 - 2931764*u^29 + 1979597*u^28 
>             + 11190142*u^27 - 24060781*u^26 - 12025938*u^25 + 79114945*u^24
>             - 17919564*u^23 - 155045647*u^22 + 60568430*u^21 + 241909907*u^20
>             - 58867672*u^19 - 332987597*u^18 - 12946368*u^17 + 366614063*u^16
>             + 124573790*u^15 - 283039783*u^14 - 196479899*u^13 + 127641266*u^12
>             + 169059382*u^11 - 8986886*u^10 - 83929974*u^9 - 24681704*u^8
>             + 21067652*u^7 + 13488360*u^6 - 1104272*u^5 - 2734272*u^4
>             - 447040*u^3 + 167040*u^2 + 44800*u)*v )/2;
>       return X;
>    elif (N eq 47) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u^5 - 5*u^4 + 5*u^3 - 15*u^2 + 6*u - 11)
>          *(u^5-u^4+u^3+u^2-2*u+1) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := K!1;
>       X`eisenstein_2 := (-23*u^4 + 34*u^3 - 47*u^2 + 32*u - 8)/12;
>       X`eisenstein_4 := 
>          (1105*u^8 - 4300*u^7 + 7350*u^6 - 11580*u^5 + 8785*u^4
>             - 6000*u^3 + 480*u^2 + 1360*u - 800) + 
>          (1104*u^3 - 1224*u^2 + 1128*u - 384)*v;
>       X`eisenstein_6 := 
>          (-51911*u^12 + 311214*u^11 - 785721*u^10 + 1630156*u^9
>             - 2167161*u^8 + 2307006*u^7 - 1460351*u^6 + 257904*u^5
>             + 754680*u^4 - 1054696*u^3 + 752640*u^2 - 303168*u + 59752) +
>          (-51912*u^7 + 155988*u^6 - 251748*u^5 + 313740*u^4 
>             - 219492*u^3 + 117936*u^2 - 24192*u - 1008)*v;
>       X`j_invariant := (
>          u^47 - 47*u^46 + 1034*u^45 - 14194*u^44 + 136864*u^43
>             - 990431*u^42 + 5617769*u^41 - 25770006*u^40 + 97893151*u^39
>             - 313468474*u^38 + 856757031*u^37 - 2013138357*u^36
>             + 4071881378*u^35 - 7040645261*u^34 + 10182603298*u^33
>             - 11611941072*u^32 + 8435506655*u^31 + 2065827049*u^30
>             - 20241250112*u^29 + 41879296232*u^28 - 57873890484*u^27
>             + 57280402355*u^26 - 33364599371*u^25 - 10454018992*u^24
>             + 59196883097*u^23 - 92028642340*u^22 + 93046207239*u^21
>             - 60791892299*u^20 + 9942017442*u^19 + 36612252089*u^18
>             - 60426283952*u^17 + 56657584158*u^16 - 34288012648*u^15
>             + 8421580132*u^14 + 9100068184*u^13 - 14673798654*u^12
>             + 11705275552*u^11 - 5945275904*u^10 + 1469334304*u^9
>             + 552981696*u^8 - 845669120*u^7 + 508021120*u^6
>             - 187217920*u^5 + 38598656*u^4 - 96256*u^3 - 2502656*u^2
>             + 688128*u - 65536 + 
>          (u^42 - 44*u^41 + 901*u^40 - 11438*u^39 + 101271*u^38
>             - 667810*u^37 + 3424200*u^36 - 14083902*u^35 + 47566499*u^34
>             - 134176208*u^33 + 319489974*u^32 - 644352392*u^31
>             + 1093778952*u^30 - 1525982346*u^29 + 1632999370*u^28
>             - 1012737914*u^27 - 601645255*u^26 + 3028415830*u^25
>             - 5455622885*u^24 + 6637395180*u^23 - 5520074039*u^22
>             + 1996771588*u^21 + 2744569094*u^20 - 6671665088*u^19
>             + 8005203155*u^18 - 6272528962*u^17 + 2576264698*u^16
>             + 1139839970*u^15 - 3280008936*u^14 + 3409478688*u^13
>             - 2203729384*u^12 + 743315936*u^11 + 213245648*u^10
>             - 508851472*u^9 + 394092544*u^8 - 182555136*u^7 + 42663936*u^6
>             + 7426048*u^5 - 11205632*u^4 + 4854784*u^3 - 1114112*u^2
>             + 114688*u)*v )/2; 
>       return X;
>    elif (N eq 59) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u^3 + 2*u^2 + 1)*
>          (u^9 + 2*u^8 - 4*u^7 - 21*u^6 - 44*u^5 - 60*u^4 -61*u^3 
>             - 46*u^2 - 24*u - 11) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := K!1;
>       X`eisenstein_2 := (-58*u^5 - 140*u^4 - 120*u^3 - 90*u^2 - 40*u - 8)/24;
>       X`eisenstein_4 := 1741*u^10 + 7084*u^9 + 8524*u^8 - 2166*u^7 - 20188*u^6 
>          - 35344*u^5 - 38467*u^4 - 30264*u^3 - 16808*u^2 - 7040*u - 1712 
>          + (1740*u^4 + 3360*u^3 + 2160*u^2 + 1080*u + 240)*v;
>       X`eisenstein_6 := 
>          -102689*u^15 - 616386*u^14 - 1242096*u^13 - 11971*u^12 
>          + 5408112*u^11 + 15077232*u^10 + 25804557*u^9 + 32887590*u^8 
>          + 33185316*u^7 + 27213687*u^6 + 18443844*u^5 + 10177188*u^4 
>          + 4500496*u^3 + 1576752*u^2 + 370560*u + 51128 + 
>          (-102690*u^9 - 410508*u^8 - 606816*u^7 - 416934*u^6 - 34776*u^5 
>          + 277200*u^4 + 341964*u^3 + 231336*u^2 + 91728*u + 20160)*v;
>       X`j_invariant := (
>          u^59 - 59*u^57 - 59*u^56 + 1534*u^55 + 3127*u^54 
>             - 21417*u^53 - 72098*u^52 + 143193*u^51 + 916447*u^50 
>             + 174286*u^49 - 6516727*u^48 - 11515738*u^47 + 19221846*u^46 
>             + 92182957*u^45 + 65239368*u^44 - 284253976*u^43 - 754619145*u^42 
>             - 308671598*u^41 + 1977259920*u^40 + 4550403910*u^39 
>             + 2575381270*u^38 - 7632475764*u^37 - 20657216762*u^36 
>             - 19963085715*u^35 + 9507261180*u^34 + 59805257547*u^33 
>             + 91253130157*u^32 + 55180018686*u^31 - 60666698493*u^30 
>             - 201693103797*u^29 - 266853603370*u^28 - 176572038603*u^27 
>             + 59881108419*u^26 + 333403380486*u^25 + 495749968855*u^24 
>             + 451258867420*u^23 + 214958799438*u^22 - 100904630525*u^21 
>             - 356956184970*u^20 - 462413784548*u^19 - 410304447353*u^18 
>             - 260679395796*u^17 - 94424809972*u^16 + 28887189420*u^15 
>             + 88472297848*u^14 + 95279288800*u^13 + 73656872866*u^12 
>             + 45446452976*u^11 + 22881418704*u^10 + 9210419200*u^9 
>             + 2701208800*u^8 + 347512832*u^7 - 190061184*u^6 
>             - 170524160*u^5 - 78057472*u^4 - 24891392*u^3 - 5679104*u^2 
>             - 860160*u - 65536 + 
>          (u^53 - 2*u^52 - 53*u^51 + 53*u^50 + 1326*u^49 + 51*u^48 
>             - 19602*u^47 - 20774*u^46 + 175074*u^45 + 386908*u^44 
>             - 806244*u^43 - 3547930*u^42 - 311794*u^41 + 17319796*u^40 
>             + 26778125*u^39 - 29422668*u^38 - 143266952*u^37 
>             - 128206147*u^36 + 231962696*u^35 + 741552520*u^34 
>             + 621823737*u^33 - 765060318*u^32 - 2700953520*u^31 
>             - 2945743289*u^30 + 366026237*u^29 + 6083260574*u^28 
>             + 9629688902*u^27 + 6286262747*u^26 - 4159897430*u^25 
>             - 15821913668*u^24 - 20357179622*u^23 - 13265052106*u^22 
>             + 2397582537*u^21 + 17988932634*u^20 + 25221236460*u^19 
>             + 21327234815*u^18 + 9890068484*u^17 - 2460001288*u^16 
>             - 10398860626*u^15 - 12288005628*u^14 - 9739961896*u^13 
>             - 5594065240*u^12 - 2066968672*u^11 - 34102432*u^10 
>             + 682681104*u^9 + 666234400*u^8 + 419424000*u^7 
>             + 200868864*u^6 + 75785728*u^5 + 22348800*u^4 
>             + 4934656*u^3 + 739328*u^2 + 57344*u)*v )/2;
>       return X;
>    elif (N eq 71) then
>       F<u> := FunctionField(Integers());
>       P<t> := PolynomialRing(F);
>       K<v> := quo< P | t^2 - (u^7 - 7*u^5 - 11*u^4 + 5*u^3 + 18*u^2
>          + 4*u - 11)*(u^7 + 4*u^6 + 5*u^5 + u^4 - 3*u^3 - 2*u^2 + 1) >;
>       u := K!u;
>       X`function_field := K;
>       X`canonical_involution := hom< K -> K | -v >;
>       X`singular_locus := K!1;
>       X`eisenstein_2 := 
>          (-35*u^6 - 82*u^5 - 25*u^4 + 90*u^3 + 65*u^2 - 20*u - 20)/12;
>       X`eisenstein_4 := 
>          2521*u^12 + 10204*u^11 + 6602*u^10 - 32296*u^9 - 68077*u^8
>             - 23552*u^7 + 61658*u^6 + 65084*u^5 - 2407*u^4 - 30392*u^3
>             - 10120*u^2 + 4112*u + 2128 + 
>          (2520*u^5 + 4920*u^4 + 1200*u^3 - 3240*u^2 - 1560*u + 240)*v;
>       X`eisenstein_6 := 
>          -178955*u^18 - 1073982*u^17 - 1620423*u^16 + 3823106*u^15
>             + 17530422*u^14 + 21659694*u^13 - 6184171*u^12 - 43609146*u^11
>             - 35720538*u^10 + 15092154*u^9 + 40585629*u^8 + 14683830*u^7
>             - 14265559*u^6 - 12743556*u^5 + 146580*u^4 + 3486280*u^3
>             + 816480*u^2 - 339360*u - 95480 + 
>          (-178956*u^11 - 715572*u^10 - 706500*u^9 + 990792*u^8
>             + 2530728*u^7 + 1072512*u^6 - 1452924*u^5 - 1455660*u^4
>             - 10116*u^3 + 385128*u^2 + 87120*u - 17136)*v;
>       X`j_invariant := (
>          u^71 - 71*u^69 - 71*u^68 + 2343*u^67 + 4686*u^66 - 45440*u^65
>             - 143207*u^64 + 532571*u^63 + 2646312*u^62 - 3017855*u^61
>             - 32313875*u^60 - 12535334*u^59 + 264727618*u^58 + 436340724*u^57
>             - 1349702048*u^56 - 4562424855*u^55 + 2470074167*u^54
>             + 28370520232*u^53 + 21838230836*u^52 - 108115393917*u^51
>             - 223748200881*u^50 + 178499735948*u^49 + 1049626967323*u^48
>             + 559609774297*u^47 - 2804372906166*u^46 - 4756674670971*u^45
>             + 2852043212765*u^44 + 15532407929486*u^43 + 8910386482360*u^42
>             - 26684853528524*u^41 - 45189635779980*u^40 + 10070390189979*u^39
>             + 93526428598685*u^38 + 67340538668100*u^37 - 92238664550530*u^36
>             - 181011248436643*u^35 - 20416496340435*u^34
>             + 222113110063628*u^33 + 198858847792011*u^32
>             - 104404339449123*u^31 - 289422447801750*u^30
>             - 100351154110315*u^29 + 201255962070609*u^28
>             + 219621557336740*u^27 - 23874469114128*u^26
>             - 180309303758044*u^25 - 88838046950616*u^24
>             + 67961958775580*u^23 + 90628940915831*u^22
>             + 8381691827967*u^21 - 43318072084785*u^20
>             - 24438297785886*u^19 + 8464593397081*u^18
>             + 13701811602284*u^17 + 2311159191326*u^16
>             - 3893638186944*u^15 - 2135340401604*u^14
>             + 406581485800*u^13 + 687410216130*u^12 + 106005364016*u^11
>             - 115455743472*u^10 - 48344218080*u^9 + 7719267680*u^8
>             + 8267735296*u^7 + 582840704*u^6 - 698430976*u^5 - 135084032*u^4
>             + 24864768*u^3 + 7124992*u^2 - 172032*u - 65536 +
>          (u^64 - 2*u^63 - 64*u^62 + 64*u^61 + 2014*u^60 + 2*u^59
>             - 39650*u^58 - 37758*u^57 + 521795*u^56 + 1006010*u^55
>             - 4551260*u^54 - 14564034*u^53 + 22966119*u^52 + 137538182*u^51
>             - 7774573*u^50 - 879738832*u^49 - 926008851*u^48 + 3633324268*u^47
>             + 8451235910*u^46 - 7061954686*u^45 - 42244574028*u^44
>             - 17898331088*u^43 + 129050868570*u^42 + 190397829498*u^41
>             - 193493122533*u^40 - 719163448312*u^39 - 204615180680*u^38
>             + 1512668406124*u^37 + 1863545637135*u^36 - 1383303489006*u^35
>             - 4754294919621*u^34 - 1706492129522*u^33 + 6270468545195*u^32
>             + 7714644758350*u^31 - 2575798462320*u^30 - 11927571422290*u^29
>             - 5845711807378*u^28 + 8930945675246*u^27 + 12186228848518*u^26
>             - 232107082616*u^25 - 10757575588639*u^24 - 6491292121628*u^23
>             + 4106003385038*u^22 + 6772209439642*u^21 + 1111225472193*u^20
>             - 3331572229588*u^19 - 2237713896721*u^18 + 562759687478*u^17
>             + 1241440058514*u^16 + 295894300138*u^15 - 336652770260*u^14
>             - 223040220360*u^13 + 22387060680*u^12 + 66358209920*u^11
>             + 14558605072*u^10 - 9683482384*u^9 - 5007661792*u^8
>             + 355845888*u^7 + 707245056*u^6 + 84179456*u^5 - 45004800*u^4
>             - 10234880*u^3 + 911360*u^2 + 286720*u)*v )/2;
>       return X;
>    else
>       return X;
>    end if;
> end intrinsic;
> 
> intrinsic EisensteinFunction(X::Rec,k::RngIntElt) -> RngElt
>    {Returns the function field element giving the quotient of 
>    the classical Eisenstein series of weight k by a power of 
>    a fixed form on X.}
>    if k eq 2 then
>       return X`eisenstein_2;
>    elif k eq 4 then
>       return X`eisenstein_4;
>    elif k eq 6 then
>       return X`eisenstein_6;
>    else
>       return "Error.";
>    end if;
> end intrinsic;
> 
> intrinsic jInvariant(X::Rec) -> RngElt
>    {Returns the j-invariant as an element of the function 
>    field of X.}
>    return X`j_invariant;
> end intrinsic;
> 
> intrinsic CanonicalInvolution(X::Rec) -> Map
>    {Returns the canonical involution of the modular curve X.}
>    return X`canonical_involution;
> end intrinsic;
> 
> intrinsic GenusType(X::Rec) -> RngIntElt
>    {Returns an integer representing the "genus type" of X, defined 
>    to be 0 if the genus of X is zero, and 1 if X is of genus one or 
>    hyperelliptic over the quotient by the canonical involution.}
>    return X`genus_type;
> end intrinsic;
> 
> intrinsic SingularLocus(X::Rec) -> RngElt
>    {Returns an element of the function field which disappears on 
>    the locus of points for which this model of the modular curve 
>    is singular.}
>    return X`singular_locus;
> end intrinsic;
> 
