
// Make newform 512.2.i.a in Magma, downloaded from the LMFDB on 16 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_512_i();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_512_2_i_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
// To make the character of type GrpDrchElt, type "MakeCharacter_512_i();"
function MakeCharacter_512_i()
    N := 512;
    order := 16;
    char_gens := [511, 5];
    v := [16, 15];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

function MakeCharacter_512_i_Hecke(Kf)
    return MakeCharacter_512_i();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_512_2_i_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function MakeNewformModSym_512_2_i_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_512_i();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<3,R![2064512, -71201280, 1086851328, -9110427136, 45788524672, -146883157504, 324151793408, -543103289856, 759115497024, -897614395392, 982465612800, -1078264998912, 704752233216, -373009462784, 228341444352, 748771137024, 959158230624, 1930971063424, 1917602393536, 2472779943808, 2409404674272, 1492341758080, 792194753984, 148891483008, 315245179184, 496065860608, 413857607168, 115614020096, -26649506432, -65113838336, -46387931264, -23242978560, -2494192104, 4331080608, 2825150256, 1340634080, 651370072, 203297248, 12517520, -39403616, -34657172, -13569920, -2594112, -313536, 242352, 291488, 164080, 69984, 27042, 8920, 2836, 936, 330, 120, 36, 8, 1]>],Snew);
    return Vf;
end function;