
// Make newform 4031.2.a.d in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_4031_a();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_4031_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_4031_a();"
function MakeCharacter_4031_a()
    N := 4031;
    order := 1;
    char_gens := [3337, 697];
    v := [1, 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_4031_a_Hecke(Kf)
    return MakeCharacter_4031_a();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_4031_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_4031_2_a_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_4031_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![-142987209, 7319058208, -55959975647, -1398289294943, 15052748247350, 102937153571204, -1186615396037222, -4273876618271024, 44504142936621598, 106559215748024919, -978863492218851714, -1699952453933480243, 14143816900221635892, 18438079254961555244, -144175785488233031765, -142551238562451699764, 1088868973508943024151, 812725397730257276489, -6314626864126703860616, -3493250463856694279076, 28896562748836483788745, 11429270213160194886714, -106607535329739331416237, -28212997345622981034401, 322615784514847601482503, 49864572988160806116063, -812288542863759353230176, -49496915745783525780619, 1721880389180779514085600, -33607622310490526508312, -3103790428287606582429544, 277285574393382521636241, 4797911687643722105081023, -722276835847720162003179, -6406440250155205163347892, 1311738199037801076815809, 7434767164569264901264963, -1883349941588356117962083, -7538730787587514480761910, 2241655394109284282146720, 6709132456217298492195748, -2266460728765436967865337, -5260529672304371961399633, 1975606903415372248341522, 3645644176759441078238817, -1499517861063346306455242, -2238910688064712209453984, 998160565734190309320119, 1220999122196677040161427, -585801698527959565938042, -592211926609877675706977, 304330053118773747671742, 255715566276655089303469, -140378335948760061113748, -98344294505069701380263, 57622274040768276641666, 33681083792684428516686, -21081325241835802948917, -10263739224819524334337, 6880881786079864016208, 2778396768276643101685, -2004504500929326483916, -666339268825414547944, 521108468524281804099, 141011935748363783508, -120811919156185995632, -26173158453461179714, 24946200351831040734, 4221820204012783412, -4579248543829184283, -583098035082749137, 745349995026146412, 67154851620594638, -107210634674716209, -6094561166241702, 13569199437206107, 366659479900782, -1502937020674630, -243071341572, 144680297198333, -3489225381766, -11999783667393, 553629282481, 847972487659, -56110481875, -50316202481, 4249161214, 2458563292, -248737120, -96277895, 11217172, 2903686, -379239, -63290, 9088, 887, -138, -6, 1]>],Snew);
    return Vf;
end function;