
// Make newform 507.2.f.g in Magma, downloaded from the LMFDB on 18 March 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_507_f();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_507_2_f_g();".
// 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_507_f();"
function MakeCharacter_507_f()
    N := 507;
    order := 4;
    char_gens := [170, 340];
    v := [2, 3];
    // 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_507_f_Hecke( : Kf := Kf)
    return MakeCharacter_507_f();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_507_2_f_g();".
// 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_507_2_f_g( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_507_f();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![169, 0, 0, 0, 11531, 0, 0, 0, 37725, 0, 0, 0, 16327, 0, 0, 0, 1885, 0, 0, 0, 79, 0, 0, 0, 1]>,<5,R![4826809, 0, 0, 0, 10383698, 0, 0, 0, 4403113, 0, 0, 0, 611594, 0, 0, 0, 22390, 0, 0, 0, 272, 0, 0, 0, 1]>,<7,R![1698181681, 0, 0, 0, 1229789799, 0, 0, 0, 175807737, 0, 0, 0, 6865831, 0, 0, 0, 104321, 0, 0, 0, 623, 0, 0, 0, 1]>],Snew);
    return Vf;
end function;