
// Make newform 507.2.m.a in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_507_m();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_507_2_m_a();".
// 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_m();"
function MakeCharacter_507_m()
    N := 507;
    order := 13;
    char_gens := [170, 340];
    v := [13, 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_507_m_Hecke(Kf)
    return MakeCharacter_507_m();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_507_2_m_a();".
// 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_m_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_507_m();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![28561, 5540834, 204668126, -7505345263, 212730439324, -5591720848090, -78765401616772, 16285014381273326, -379034676350342129, -1177043105820836215, 306207344379840797751, -8111481865457104394884, 124987925789936081647021, -1241892806456271482988397, 9555984814629659361500493, -54206020987249910195793259, 294663768034581064302556555, -1027209362784936485036225980, 4271742095898943390198430034, -8194365276708929490335839143, 30943371996527298101706994380, -15962544230387482778210327180, 166967739132745045011776620088, -11247959424181027345478401474, 1468092455177096329295181648454, -27843737726618304005514905165, 7372545923743363303637191901419, 7205511781919146055784147868599, 32178818539906807996780987350826, 41540566631545804428673809467310, 181129682039206307065246651990628, 169795088373986997311687145500379, 681860004825075408081493448693781, 1276478624848618246321138010899787, 1885023634376636601776770684531624, 4840689467867670745257046120719781, 9146783130205036745069318518372025, 13898955018865520202151221278963977, 25553318535205663721411822570207255, 26511502884035843656050421337520458, 53748712173259394948721066293488301, 58695948642466620650194539220672247, 73311700029180838358231909152172545, 71244811460475008081962008931447289, 117981417507187658462700796025421608, 71312296697630832424311547982587136, 113979771643684242164951265332811662, 43773098597949295120397027779587348, 136221705948806210374323500811441853, 47673883824058188141951187908389151, 133625019891959532959770914549936770, 80054553340241543089667330161252608, 234234410372599096494235098310049611, 201500863558453675824578836743335146, 356494556390666987263407209031529796, 272539256932446069948336932782711081, 413163078190912971972842538731578243, 285859175202918378771285437469752248, 436761270803908886068809809175686353, 292289301079657386053550528115393661, 416133117709445726288696235254756468, 208665346378070289332541469652503521, 328042246357004577242568853332389118, 117715122659238203874560122417158912, 264017282541137875207917301818720732, 59932645092129024175503787316263525, 211095238550685042328347402534362357, 16746473568316890537461364557352609, 150253082333725527517518240697809035, -12093465096681934831091901183218929, 97230491883066652910181753021856897, -19784393720295089231495253320588641, 59982724272401574968257563807240138, -14656553115971599714195972928860959, 34526628204652131758279604789136872, -8240395799352340499370440727596394, 18310756745009345684559365053619388, -3837600503883983885471922573454169, 9083442769109515438652494798512303, -1414889013183374941719284939530698, 4237094518835919913442228320118189, -406485846651285915846491470065287, 1907787036771596184970610214897022, -96375591331070593521040490025999, 854676883179265898076756126547861, -11706679290384864324566256644321, 364612639467819844545113499662349, 12675401846922652015958714948549, 151261713554045390852119214050058, 8837369017499636704655821295325, 63291062719997594786866879474735, 2689441507628867885077819075517, 25393588455419483542465539944174, 929022206755073712173713399053, 9848524994093800682377830403610, 407156346349513510512759942010, 3872261934312375852820956724394, 282161402218138329758223832487, 1432567695801556463659107049263, 186831562517729774373697406190, 493489740253286952856312974318, 95969318196887700532100476144, 167316946070871861495709488924, 38891218857885054418529319858, 58858181851933419306541176853, 12756116973431150475767907795, 20944297605789069024139019855, 3974861836322765857968554587, 7074234283956912865293061578, 1293365950671861611997474778, 2196440273834084394527565677, 447609410313941145936800684, 652771865453851450834024780, 151941272746147448908839410, 191556679586377021045972179, 47978542085452137673326869, 56650014304890178154524970, 14678811449932091206631095, 16687087150113041352069132, 4384986188948363063008006, 4815631396872773630712451, 1268812037902218479386201, 1334444336074452931741709, 345419461748299016015141, 354023138631061084523656, 89045715282022515905162, 89626936227024968519445, 21998130713464527182291, 21634912111241693478805, 5207188522373711407974, 4921692836076915505530, 1159350446205359488056, 1046510337979986969533, 239790538143799241265, 208793363049682878661, 46859580512318120670, 39837793350102302617, 8716961561681174672, 7308903728598373213, 1522379446976070883, 1286175541141602449, 246090793801290305, 217953287164383989, 37836881139442015, 36321196882047703, 5830241327111021, 6038584167804037, 929713861481441, 1003231015401278, 152870154670542, 163428177281702, 24567120836305, 25524592653250, 3705078071312, 3770537955111, 512327303688, 526564977892, 65954168277, 70787357869, 8432333550, 9482116990, 1125874832, 1274564023, 153800056, 169613593, 20400249, 21966446, 2644366, 2745221, 318641, 324322, 34438, 36167, 3585, 3663, 321, 321, 23, 23, 1, 1]>],Snew);
    return Vf;
end function;