
// Make newform 840.2.cp.b in Magma, downloaded from the LMFDB on 13 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_840_cp();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_840_2_cp_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_cp();"
function MakeCharacter_840_cp()
    N := 840;
    order := 6;
    char_gens := [631, 421, 281, 337, 241];
    v := [6, 6, 3, 6, 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_cp_Hecke( : Kf := Kf)
    return MakeCharacter_840_cp();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_840_2_cp_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_cp_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_840_cp();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<11,R![306047942656, 1980743417856, 4724373471232, 2920473722880, -6268973146112, -2633040273408, 45643818116096, 125666814781440, 168435466756608, 130782267016704, 52900773463616, 698100975744, -9525106271472, -2768444772288, 1152111198080, 815263038528, 36880011712, -86964957168, -15573562600, 6462456144, 1968502072, -295019280, -140238472, 9695700, 7201481, -174300, -255278, 2100, 6555, 0, -102, 0, 1]>],Snew);
    return Vf;
end function;