
// Make newform 10.13.c.a in Magma, downloaded from the LMFDB on 14 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_10_c();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_10_c_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_10_13_c_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_10_13_c_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 ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [490000, 0, 1422264, 0, 2385, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [0, 587164, 0, 1685, 0, 1], [44319800, 77197188, -2865450, 86045, -2450, 17], [44319800, -77197188, -2865450, -86045, -2450, -17], [422891000, 547516892, 27657350, 575355, 22750, 103], [-196948920, 422574076, -12015990, 443075, -9870, 79]];
    Rf_basisdens := [1, 344400, 91840, 91840, 91840, 55104];
    Rf_basisnums := ChangeUniverse([[z : z in elt] : elt in Rf_num], Kf);
    Rfbasis := [Rf_basisnums[i]/Rf_basisdens[i] : i in [1..Degree(Kf)]];
    inp_vec := Vector(Rfbasis)*ChangeRing(Transpose(Matrix([[elt : elt in row] : row in input])),Kf);
    return Eltseq(inp_vec);
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_10_c();"
function MakeCharacter_10_c()
    N := 10;
    order := 4;
    char_gens := [7];
    v := [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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_10_c_Hecke();"
function MakeCharacter_10_c_Hecke( : Kf := false)
    N := 10;
    order := 4;
    char_gens := [7];
    char_values := [[0, 1, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := ISA(Type(Kf), Fld), Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..prec]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 13;
    raw_aps := [[-32, -32, 0, 0, 0, 0], [-156, 156, 0, 1, 0, 0], [-2710, 1905, 9, 7, 1, 2], [-7556, -7556, -56, 1, 7, 1], [-569668, 0, 1925, 1991, 264, -198], [1351139, -1351139, -133, -2959, 133, -931], [1795419, 1795419, -24182, 308, 2156, 308], [0, 20457540, 16206, -15884, 966, 1288], [40191144, -40191144, 1363, 74592, -1363, 9541], [0, 3003800, 200828, -197246, 10746, 14328], [-284851368, 0, 104099, 132345, 112984, -84738], [-123769151, -123769151, 4834563, 3053, 21371, 3053], [-4124816588, 0, -1060681, -1190349, -518672, 389004], [2422160884, -2422160884, 142378, -1171301, -142378, 996646], [1404547904, 1404547904, -8011818, -152513, -1067591, -152513], [216169089, -216169089, -342691, 14963325, 342691, -2398837], [0, -51842651500, 10129686, -9883872, 737442, 983256], [-33546136988, 0, -12916257, -11507485, 5635088, -4226316], [18050662924, 18050662924, -47079021, 1251862, 8763034, 1251862], [-95066944568, 0, -81931333, -84341647, -9641256, 7230942], [118373704689, -118373704689, 58514, -55191070, -58514, 409598], [0, 37092879520, 49895120, -45145536, 14248752, 18998336], [121311248024, -121311248024, -412816, 264327853, 412816, -2889712], [0, -98027616480, 229057280, -251547820, -67471620, -89962160], [-367973438391, -367973438391, -890358044, -4060428, -28422996, -4060428], [454571750382, 0, 1317846738, 1303764154, -56330336, 42247752], [-557757296976, 557757296976, 29471255, -245625220, -29471255, 206298785], [-1270385188316, -1270385188316, 787608713, -5907320, -41351240, -5907320], [0, 832595499970, 707551859, -729912985, -67083378, -89444504], [-463910396781, 463910396781, -58669552, 457429942, 58669552, -410686864], [-1563689084036, -1563689084036, -1513198022, 44332975, 310330825, 44332975], [1998692120292, 0, 310866001, 162418515, -593789944, 445342458], [-330228577111, -330228577111, -6796925750, -169851122, -1188957854, -169851122], [0, 4701464118740, 769331926, -777057712, -23177358, -30903144], [0, -330643329650, 4995598629, -4997856607, -6773934, -9031912], [-1057745163048, 0, -5785163925, -5612016215, 692590840, -519443130], [-1571527641181, -1571527641181, 10311930099, 150460531, 1053223717, 150460531], [2131664325524, -2131664325524, -485688264, 8109624137, 485688264, -3399817848], [-5308981723576, -5308981723576, 35482978792, 163609253, 1145264771, 163609253], [3958748212449, -3958748212449, 536660395, -38753638805, -536660395, 3756622765], [0, -12518868366820, -26214310542, 26747523008, 1599637398, 2132849864], [-10862840102518, 0, 13552213196, 13022729684, -2117934048, 1588450536], [5144366722872, 0, -17965155893, -17154650167, 3242022904, -2431517178], [-14144616711701, 14144616711701, -225705824, 73365486542, 225705824, -1579940768], [-1907829983431, -1907829983431, -29984101241, 1035997777, 7251984439, 1035997777], [0, 2903900080760, 24351860196, -26937374960, -7756544292, -10342059056], [-12680072394628, 0, 30145498429, 29285090743, -3441630744, 2581223058], [-46811353572996, 46811353572996, -668983695, 53864956634, 668983695, -4682885865], [10455135419584, 10455135419584, -87819128053, 1288784346, 9021490422, 1288784346], [0, -49120837023240, 50323729404, -52654410666, -6992043786, -9322725048], [-55770901170541, 55770901170541, -186776362, -60125012996, 186776362, -1307434534], [0, 30562038323000, 186155452628, -182289779260, 11597020104, 15462693472], [-60505100974268, 0, 15775944543, 22141080891, 25460545392, -19095409044], [26984491392052, 0, 13926348177, 13181233979, -2980456792, 2235342594], [-94767474621421, -94767474621421, 118920037074, -3225165100, -22576155700, -3225165100], [61376522048004, -61376522048004, 4994588795, 263403321084, -4994588795, 34962121565], [0, -67178675013650, -283283555515, 276971376077, -18936538314, -25248717752], [-407400127824128, 0, 89528474903, 87588408949, -7760263816, 5820197862], [191750723804299, 191750723804299, -76009365967, -6329302771, -44305119397, -6329302771], [-74612299834588, 0, 115395601455, 107092776955, -33211298000, 24908473500], [250546865126104, -250546865126104, 5626321154, -541366195393, -5626321154, 39384248078], [371640552109699, -371640552109699, -8326160039, 45817066287, 8326160039, -58283120273], [94014069969324, 94014069969324, 309351879855, -2353033830, -16471236810, -2353033830], [223325524420992, 0, 345643945983, 371765328133, 104485528600, -78364146450], [185007224326459, -185007224326459, 5112010726, 255758450180, -5112010726, 35784075082], [-723604806937301, -723604806937301, -1130106139193, 3607349303, 25251445121, 3607349303], [-69133588707028, 0, 1503637634565, 1466341168751, -149185863256, 111889397442], [-587653703112831, -587653703112831, -2188426894756, 8220656868, 57544598076, 8220656868], [-834268888410976, -834268888410976, -679675181131, -37475726736, -262330087152, -37475726736], [0, 668139197179720, 469018161924, -460421855646, 25788918834, 34385225112], [-168293712048111, 168293712048111, 15363033912, -2187561393944, -15363033912, 107541237384], [0, 273991015695040, 2177445009648, -2204383221996, -80814637044, -107752849392], [-1254793998430356, -1254793998430356, 1600493371502, 47970001931, 335790013517, 47970001931], [-859214622766551, 859214622766551, 14759900921, -1988031549423, -14759900921, 103319306447], [0, 3341447167009500, -390071420446, 384428984036, -16927309230, -22569745640], [1600497956372284, -1600497956372284, -22296165383, -2658761843038, 22296165383, -156073157681], [0, -983024388325710, -1835550247893, 1916611329315, 243183244266, 324244325688], [-37728096959951, -37728096959951, -3941397381743, -13096871025, -91678097175, -13096871025], [-1177533848681278, 0, 413071977176, 450552247104, 149921079712, -112440809784], [0, -1066991326016610, 2185141893637, -2142334789453, 128421312552, 171228416736], [0, -2015737225688220, -2592386143010, 2555129309876, -111770499402, -149027332536], [-3368339402551308, 0, 2685686470735, 2736700836075, 204057461360, -153043096020], [-4781550229302288, 0, 248049377231, 408653931997, 642418219064, -481813664298], [-2614217239282391, 2614217239282391, -42337575784, 3065197087760, 42337575784, -296363030488], [0, 4152215662867680, -3803379514048, 3892123845852, 266232995412, 354977327216], [-1654874973240936, 1654874973240936, 144848008698, 8765628432503, -144848008698, 1013936060886], [0, -8306363424156270, 3265906858771, -3292051769519, -78434732244, -104579642992], [-3706441225628101, -3706441225628101, -6468666784884, -110293167758, -772052174306, -110293167758], [2356697633921422, 0, -4570085171294, -4729061027878, -635903426336, 476927569752], [6561571705234664, -6561571705234664, 158094803865, -11219265399258, -158094803865, 1106663627055], [3397362207471624, 3397362207471624, 6244639677927, -238841797162, -1671892580134, -238841797162], [0, -7253307850999960, 10830036953340, -10634866630500, 585510968520, 780681291360], [-941717504082876, -941717504082876, 12677510566536, 347588402649, 2433118818543, 347588402649], [5410978806123452, 0, 4041696695373, 4069297909703, 110404857320, -82803642990], [0, 19140595572200660, 10020443611622, -10015087180748, 16069292622, 21425723496], [-1538379690558816, 1538379690558816, -218760214005, 22754957494848, 218760214005, -1531321498035], [0, -4237490053153240, 8818690478484, -9125136387678, -919337727582, -1225783636776], [10061289832454342, 0, 14575265247102, 14336203355974, -956247564512, 717185673384], [12038315290061584, -12038315290061584, -34522168898, 8410989849187, 34522168898, -241655182286], [7229632519224622, 0, -15277099427518, -15628467748822, -1405473285216, 1054104963912], [-15935671071685936, -15935671071685936, 1504710950699, 272758785130, 1909311495910, 272758785130], [-3882554211593111, -3882554211593111, 10423279461197, 266366757755, 1864567304285, 266366757755], [9797476921217484, -9797476921217484, -125855126604, -7969706367315, 125855126604, -880985886228], [0, -25247731329712670, -30076751231077, 30353492136997, 830222717760, 1106963623680], [-7554047698008308, 0, 18845156709261, 19799725993567, 3818277137224, -2863707852918], [-21632648376350141, -21632648376350141, 18002614229706, -47852369556, -334966586892, -47852369556], [24451464438149504, 24451464438149504, -35597533391535, -92735002316, -649145016212, -92735002316], [-3549045155357311, 3549045155357311, 226374116124, 4951943360540, -226374116124, 1584618812868], [0, -2763217458445160, 28566465689524, -27868450113000, 2094046729572, 2792062306096], [-34768748684152188, 0, 12177691529999, 10693743598219, -5935791727120, 4451843795340], [-14700560453161296, -14700560453161296, 609961540698, -494185245237, -3459296716659, -494185245237], [1411745023353419, -1411745023353419, -154838467507, 78463716754427, 154838467507, -1083869272549], [13798265920221539, 13798265920221539, -47605349578696, 1818519092158, 12729633645106, 1818519092158], [0, 69270598034641460, -18111827306650, 18323237893160, 634231759530, 845642346040], [-55506208523118368, 0, 13614740415503, 14156231989013, 2165966294040, -1624474720530], [71543533036736932, 0, -18380907667329, -17140303344213, 4962417292464, -3721812969348], [24893446399259584, -24893446399259584, -1641082990940, -55362181298407, 1641082990940, -11487580936580], [23052615052776004, 23052615052776004, 36442514561888, -61001272191, -427008905337, -61001272191], [-40940916007837111, 40940916007837111, -489037730377, -20611202114257, 489037730377, -3423264112639], [0, 35890183644618020, -28656415007906, 32612537893900, 11868368657982, 15824491543976], [-11570715586263308, 0, -33175252641473, -32699082499189, 1904680569136, -1428510426852], [-25804361892833351, 25804361892833351, 1369488838716, -74134671560348, -1369488838716, 9586421871012], [-21286423946957111, -21286423946957111, -101897810047073, -875652163607, -6129565145249, -875652163607], [-44977814376037196, 44977814376037196, 1209326501626, -34672668950869, -1209326501626, 8465285511382], [53245072719246732, 0, 20415360612853, 20794104496591, 1514975534952, -1136231651214], [82310967334230212, 0, -11612949082225, -9859489433869, 7013838593424, -5260378945068], [0, 99879192228966760, 57481822314468, -57964386293850, -1447691938146, -1930255917528], [0, 1167413975031160, -90292417176844, 87042656323892, -9749282558856, -12999043411808], [37381204130968124, 37381204130968124, -180418930305412, 856175199949, 5993226399643, 856175199949], [50831273556907569, -50831273556907569, -1276419608521, -11646706778521, 1276419608521, -8934937259647], [0, -78640596139195940, 147429263580658, -143439879638712, 11968151825838, 15957535767784], [1089549539212524, -1089549539212524, 806670347603, 60030878629196, -806670347603, 5646692433221], [-161910718697536168, 0, -79725999403109, -78441637559335, 5137447375096, -3853085531322], [68284011612925579, 68284011612925579, -179467019983119, 968084090189, 6776588631323, 968084090189], [-87676826563614318, 0, 140728908663376, 137613524023848, -12461538558112, 9346153918584], [0, 74016376799161440, -184990769284784, 187182652057336, 6575648317656, 8767531090208], [134718315359527099, -134718315359527099, 1037530363717, -22556472478781, -1037530363717, 7262712546019], [49867679691028164, 49867679691028164, 293770531535999, 4768497761746, 33379484332222, 4768497761746], [-11480180273519461, -11480180273519461, -253276776194041, -372513314105, -2607593198735, -372513314105], [0, 150991049178050160, 108402243740440, -107787826948956, 1843250374452, 2457667165936], [-51107159973162668, 0, 138719849994497, 148004942534475, 37140370159912, -27855277619934], [193542842907623012, 0, 69999845652271, 71546412935539, 6186269133072, -4639701849804], [-65251493653331496, 65251493653331496, -8931313361789, 190202732817696, 8931313361789, -62519193532523], [-212088689851077456, -212088689851077456, -83971870696867, 2969757996792, 20788305977544, 2969757996792], [0, -140978215931013490, -121034475247787, 125443984772357, 13228528573710, 17638038098280], [0, -297466541191061800, 7113941841076, -8765280845864, -4954017014364, -6605356019152], [-109277901347507781, 109277901347507781, 10503164794433, 406417127014207, -10503164794433, 73522153561031], [-55577922850554391, -55577922850554391, -23690107763714, 2300051099866, 16100357699062, 2300051099866], [0, 11852959571965140, 288831775006518, -290014223060416, -3547344161694, -4729792215592], [-185713533432508816, 185713533432508816, 6435961526541, 10796226730610, -6435961526541, 45051730685787], [37930315982022179, 37930315982022179, 460493772668407, -2197082099921, -15379574699447, -2197082099921], [49539986920027412, 0, -559923989822953, -553322304445261, 26406741510768, -19805056133076], [-123626103304681076, 123626103304681076, -782952183900, -502412722068515, 782952183900, -5480665287300], [-209767327716645756, -209767327716645756, 127857412316420, 2579083857885, 18053587005195, 2579083857885], [-146666757542033116, -146666757542033116, -175518218748135, -2024341545736, -14170390820152, -2024341545736], [11521410013719672, 0, 721111472621107, 721102694950409, -35110682792, 26333012094], [0, -192359536107118680, 630274382517772, -618888051433808, 34158993251892, 45545324335856], [0, -214286448995806610, 228229118493613, -230827704192369, -7795757096268, -10394342795024], [451707364358176419, 451707364358176419, -486801732736112, -8301024591194, -58107172138358, -8301024591194], [-228189136550024598, 0, -371227967143396, -364362441143500, 27462103999584, -20596577999688], [103310041143489884, 103310041143489884, -1159123053228945, 113461441130, 794230087910, 113461441130], [-199746059044472741, 199746059044472741, 8646571138846, 501589522327580, -8646571138846, 60525997971922], [-112372955731565536, -112372955731565536, 702971325301656, 14275806873917, 99930648117419, 14275806873917], [-125025103857803708, 0, -393604781370079, -401849065046413, -32977134705336, 24732851029002], [279457798143448249, 279457798143448249, 1087473618622496, 2984866723400, 20894067063800, 2984866723400], [-508221707716374916, 508221707716374916, -6998059505801, -1264787855099744, 6998059505801, -48986416540607], [465310105458365632, 0, -377073858827793, -340763110865931, 145242991847448, -108932243885586], [532003849578165699, 532003849578165699, -737390887748519, -21709253922227, -151964777455589, -21709253922227]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_10_c_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_10_13_c_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
function MakeNewformModFrm_10_13_c_a(:prec:=6)
    chi := MakeCharacter_10_c();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 13));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_10_13_c_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_10_13_c_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_10_c();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,13,sign)));
    Vf := Kernel([<3,R![2405672814505248, -44818350901776, 417489145956, -674145288, 438048, 936, 1]>],Snew);
    return Vf;
end function;