
// Make newform 840.2.w.b in Magma, downloaded from the LMFDB on 03 October 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_840_w();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_840_2_w_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_840_w();"
function MakeCharacter_840_w()
    N := 840;
    order := 2;
    char_gens := [631, 421, 281, 337, 241];
    v := [1, 1, 2, 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_840_w_Hecke( : Kf := Kf)
    return MakeCharacter_840_w();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_840_2_w_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_840_2_w_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_840_w();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<17,R![65536, 811008, -1025024, -188672, 416000, 9344, -62112, 64, 4008, -4, -108, 0, 1]>],Snew);
    return Vf;
end function;