
// Make newform 4031.2.a.b in Magma, downloaded from the LMFDB on 25 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_b();".
// 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_b();".
// 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_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_4031_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![83, -9507, 101714, 520613, -9053202, 3966712, 243068149, -434282476, -3111232034, 7473504953, 23584644351, -65378195942, -121136192812, 359173093507, 461016553433, -1362469348430, -1374231929278, 3764425561928, 3295042936776, -7837727168126, -6401929412793, 12592876149821, 10079540084690, -15891008825404, -12864014959656, 15959988976000, 13342359900423, -12882299120248, -11293682637796, 8410956485268, 7838134125079, -4456024908834, -4479071279024, 1914105250289, 2114084578007, -662618674758, -825562266125, 182152709942, 266719961108, -38488265762, -71146324248, 5754037558, 15599831316, -431808895, -2791005592, -48366925, 402916477, 22452255, -46165271, -4095853, 4096812, 480449, -271237, -38552, 12599, 2065, -366, -67, 5, 1]>],Snew);
    return Vf;
end function;