
// Make newform 4022.2.a.d in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_4022_a();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_4022_2_a_d();".
// 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_4022_a();"
function MakeCharacter_4022_a()
    N := 4022;
    order := 1;
    char_gens := [3];
    v := [1];
    // 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_4022_a_Hecke(Kf)
    return MakeCharacter_4022_a();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_4022_2_a_d();".
// 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_4022_2_a_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_4022_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<3,R![136, 26612, -284422, -8042677, 52767175, 342253, -464492390, 320065505, 1827161003, -1408403973, -4280670703, 2883900127, 6623887814, -3478693099, -7110353380, 2695502660, 5452466834, -1385405267, -3047253772, 465661232, 1257905008, -90976413, -386320977, 3291347, 88336840, 3737879, -14938876, -1242191, 1838089, 213708, -159567, -22877, 9243, 1532, -320, -59, 5, 1]>],Snew);
    return Vf;
end function;