
// Make newform 26.5.f.b in Magma, downloaded from the LMFDB on 06 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_26_f();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_26_f_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_26_5_f_b();".
// 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_26_5_f_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 ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [221087161, 0, -7343258, 0, 90747, 0, -494, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [14869, 26, -247, 0, 1, 0, 0, 0], [-14869, 26, 247, 0, -1, 0, 0, 0], [386594, 3670615, 0, -75878, 0, 494, 0, -1], [-1858625, 0, 45498, 0, -370, 0, 1, 0], [25309075053, -3138167344, -657745084, 75943985, 5501530, -609453, -14869, 1625], [25309075053, 3138167344, -657745084, -75943985, 5501530, 609453, -14869, -1625], [24162125, -1702137, -591474, 44236, 4810, -370, -13, 1]];
    Rf_basisdens := [1, 52, 52, 773188, 1262, 487881628, 487881628, 32812];
    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_26_f();"
function MakeCharacter_26_f()
    N := 26;
    order := 12;
    char_gens := [15];
    v := [11];
    // 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_26_f_Hecke();"
function MakeCharacter_26_f_Hecke( : Kf := false)
    N := 26;
    order := 12;
    char_gens := [15];
    char_values := [[0, 0, 0, 0, 0, -1, 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 := 5;
    raw_aps := [[0, 0, 0, 2, 0, 0, -2, 0], [0, 1, 0, 0, 0, 3, -1, 0], [5, 0, -1, -15, -1, -9, -5, -1], [0, 1, 0, 2, 1, 2, -1, 0], [-3, 2, 9, 50, 7, -12, 52, -2], [-7, -8, -2, -73, -12, 35, -62, -9], [-26, 2, 1, -39, 0, 19, 1, -13], [299, -9, 11, -14, 9, 3, 276, -11], [124, -27, -54, -48, 28, 27, -63, 28], [-12, 94, 0, -177, -12, -550, 322, 12], [113, -62, -34, -182, -34, -35, -175, 28], [-479, -28, 18, 920, 46, -497, 892, 28], [197, -28, -30, -192, 2, -167, 164, -28], [-1095, -124, -62, -1074, 0, 193, -62, 21], [-995, 72, 84, -812, -84, 1723, -923, -12], [-595, 101, 101, 8, 8, -1719, -1618, 16], [198, 297, 298, 646, 297, 348, -547, 298], [-3342, 0, -109, 3243, -198, -3, 115, -99], [1400, -117, -251, -1735, 134, -1149, 1618, -117], [3211, 139, -29, -898, -139, 927, 2452, 29], [-609, -235, 54, -588, -54, 1143, -844, -289], [4728, -38, -38, 0, 0, 898, 860, 0], [4723, -117, 55, -4011, 55, 657, -4840, 172], [3792, -121, -255, -3469, -134, 4047, -3590, 121], [-4103, -231, -1, 3574, 231, -3573, -760, 1], [-3003, -105, -210, 1664, 325, 105, 4848, 325], [222, 223, -223, -575, -131, 1298, -1075, 0], [-12, 779, 0, 3414, -12, -4215, 2497, 12], [9157, -426, 240, -1480, 240, 7437, -9583, 666], [-940, 0, -195, 1445, 1010, -3263, 6721, 505], [-6898, 27, 54, 2978, -942, -27, 1709, -942], [-6986, -433, -433, 421, 421, 1296, 863, 842], [-2510, -650, 79, -1848, -650, -1927, 3708, 79], [-4313, 0, 498, 5384, 2142, 5257, -11012, 1071], [2883, -310, -1324, -13060, 310, 14384, -10487, 1324], [7533, 334, 490, 5914, -490, -13937, 7867, -156], [5311, 60, 60, -1281, -1281, 2803, 2863, -2562], [13434, 1181, 1202, -23466, 1181, -24668, 11213, 1202], [7137, 998, -1283, 7626, -2281, 8420, 8624, -998], [-9, -512, -256, 2108, 0, -343, -256, 2117], [24523, 1524, 3048, -12271, -19, -1524, -1659, -19], [5743, 824, -824, -9793, 1693, 403, 421, 0], [25686, 0, 2039, -26142, -912, 1070, -4179, -456], [101, -1424, -1370, 6128, 54, 1471, 4704, 1424], [-22856, -2233, -1189, 21993, -1044, 24045, -24226, -2233], [1884, -2566, -1283, 3126, 0, 21914, -1283, 1242], [504, -2881, 0, -19350, 504, -947, -967, -504], [-15506, -2911, -2789, 19391, -122, 18295, -22302, -2911], [-9211, -399, 1147, -15566, 399, 14419, -25176, -1147], [14781, 1160, 1582, 11770, -1582, -28133, 15941, -422], [-6458, 988, -988, 13186, 270, 16070, -15082, 0], [-6449, -1547, -1543, -29645, -1543, -34551, 4902, 4], [13934, -1410, -4661, -11416, -1410, -6755, -3928, -4661], [-4886, 2438, 1219, -6044, 0, -7274, 1219, -1158], [6252, -3538, -7076, -3791, -1330, 3538, -45260, -1330], [-1715, 2738, 0, 55915, -1715, 69964, -33613, 1715], [-21545, 0, 1598, 23026, 2962, -14337, 27076, 1481], [3309, 398, -217, -12294, -615, 3526, -11896, -398], [12164, 198, 99, 16001, 0, -7839, 99, 3837], [-1609, -3434, 997, -13757, -997, 14369, -5043, -4431], [-19279, -352, -704, 12233, 5187, 352, 57263, 5187], [-43344, -3372, -3681, -15888, -3372, -12207, 55860, -3681], [1105, -1330, -5192, -46500, 5192, 50587, -225, 3862], [-42182, 1979, -1979, 89353, 4989, -42674, 44653, 0], [54458, 1154, 1154, -1666, -1666, -35480, -34326, -3332], [-10781, 3483, 8544, 9196, 8544, -10129, 14264, 5061], [5494, 2337, -3064, 46056, -2337, -42992, 53887, 3064], [1015, 985, -985, 4300, 6330, 78351, -77366, 0], [38552, 0, -5423, -43162, -9220, 12536, -19649, -4610], [-6694, 7053, 3101, -20371, -3952, -9795, -13318, -7053], [59380, -1057, -978, -124057, -79, -58402, 123000, -1057], [-62307, 691, 4073, -40479, -4073, 98713, -61616, -3382], [1360, 633, 0, -73884, 1360, 58163, -28765, -1360], [-62023, 0, 1244, 63479, 2912, -60260, 119276, 1456], [-3868, -6521, -4737, 68649, -1784, 8605, -75170, -6521], [47010, 1705, -5616, 29036, -1705, -23420, 77751, 5616], [-32813, -6308, 6308, 68487, 2861, 18815, -25123, 0], [19531, 2843, 10957, 68126, 2843, 57169, -84814, 10957], [-117236, -2155, -5306, 76861, -3151, -111930, 74706, 2155], [-15607, 12790, 1546, 9940, -12790, -11486, 7123, -1546], [-1690, -3669, 0, 137606, -1690, -63371, 29851, 1690], [-33393, -1795, -1368, 65396, -1368, 33371, 31598, 427], [45335, 9166, 9939, 31120, -773, -55274, -21954, 9166], [27597, 3840, 1920, 15963, 0, -73114, 1920, -11634], [95501, -3348, -6696, -42031, 11439, 3348, 1563, 11439], [51040, 4100, 4100, -4946, -4946, 14890, 18990, -9892], [-120709, -141, -5471, 4266, -141, 9737, 116302, -5471], [-94727, 6272, 8446, 44052, -2174, 86281, -37780, 6272], [-31333, 6310, 11144, -68716, -6310, 57572, -93739, -11144], [115313, -6421, -3273, -159621, 3273, 47581, 108892, -3148], [-44364, 2540, -2540, 72512, -16216, 8908, -6368, 0], [63050, 5865, 22717, -4107, 16852, 40333, 1758, -5865], [-27216, -11549, 6580, 54012, 11549, -60592, 15247, -6580], [33597, -10172, -20344, -11491, 10615, 10172, -49273, 10615], [-118019, 80, 6676, 304164, 6676, 179469, 118099, 6596], [41459, 0, 482, -33826, 15266, 154971, -310424, 7633], [50498, -2363, -16664, 2205, 14301, -33834, -4568, -2363], [14669, -2101, -2101, 11114, 11114, 62561, 60460, 22228], [1883, -12540, 0, -214115, 1883, -1090, -5725, -1883], [-40421, 8233, -1512, 217650, 1512, -175717, -32188, 9745], [-62852, -19137, -19137, -1417, -1417, 169194, 150057, -2834], [85674, -4157, -10408, -54201, -6251, 96082, -58358, 4157], [188019, -16728, -8364, 194818, 0, -105717, -8364, 6799], [-163129, 11490, 22980, 95159, 27189, -11490, -72249, 27189], [-50980, -12406, 12406, 103358, 1398, -207612, 195206, 0], [88491, -6477, -32528, 141004, -32528, 262023, -94968, -26051], [-10565, -4430, 9893, 175084, -14323, 672, -179514, -4430], [-32881, 3769, 13038, 146292, -13038, -126449, -29112, -9269], [-182136, -4347, -4347, -9651, -9651, 16414, 12067, -19302], [-13139, -18735, 0, -281648, -13139, 155825, -87280, 13139], [-131018, 0, 2631, 118422, -25192, -27102, 51573, -12596], [-337345, 6862, -18032, -23470, 24894, 355377, 30332, 6862], [-153782, 2812, 10977, -78066, -2812, 67089, -229036, -10977], [211497, -22251, 1529, -86835, -1529, -126191, 189246, -23780], [339862, -541, 2192, -319986, -541, -322178, -20417, 2192], [61228, 2862, 1431, 41573, 0, 275049, 1431, -19655], [196580, 29413, -2254, -33108, -29413, 35362, 192885, 2254], [134554, -1371, -2742, -80932, -27310, 1371, 73527, -27310], [-27053, 17126, 0, -90761, -27053, -94508, 55817, 27053], [88533, 0, 5676, -83622, 9822, 123549, -252774, 4911], [-304579, 20148, 18872, 189432, -1276, -323451, 209580, -20148], [80567, 3067, 6134, -27044, 26479, -3067, 167762, 26479], [-294936, -17604, -17604, -5658, -5658, -195054, -212658, -11316], [158483, 1159, -9555, -189666, 1159, -180111, 32342, -9555], [-288255, 7296, 6555, 313166, 741, 281700, -305870, 7296], [101178, -34790, 34790, -195556, 6800, -48910, 14120, 0], [273989, -18432, -4480, -3132, -18432, 1348, -289289, -4480], [70495, -9704, -4852, 35358, 0, 172631, -4852, -35137], [-14800, 5944, -5944, 17048, -12552, 82464, -76520, 0], [128581, 8344, 36179, 236325, 36179, 328727, -120237, 27835], [-92463, 21182, 24709, 19966, 3527, -117172, 41148, -21182], [145481, -8560, 10913, -185738, -19473, -156394, 177178, -8560], [668855, -15194, -30388, -343953, -19051, 15194, 182051, -19051], [45, 60170, 0, -185973, 45, -64644, 62407, -45], [68709, -40433, -43841, 72194, -40433, 116035, -181336, -43841], [-53416, 16735, 17407, -200083, -672, 36009, 216818, 16735], [-200677, -20597, -23973, 229882, 20597, -205909, 8608, 23973], [395933, 17921, 7553, 286802, 17921, 279249, -664814, 7553], [133045, 19364, 9682, 132686, 0, -282443, 9682, -359], [21555, -16365, 0, 375990, 21555, -325813, 154724, -21555], [569313, 13470, 21018, -218690, 21018, 329605, -555843, 7548], [140632, -26745, -40197, 33793, 13452, -100435, -60538, -26745], [-301285, -11280, -5640, -317946, 0, -436485, -5640, -16661], [-104787, -17405, -15615, -129647, 15615, 250049, -122192, -1790], [252595, -889, -1778, -120236, 12123, 889, 33662, 12123], [-207621, 11931, 32125, -3134, 11931, -35259, 222686, 32125], [-361905, -2876, -18009, -6723, 18009, 386637, -364781, 15133], [405465, 22646, -22646, -817009, -6079, 145789, -123143, 0], [-359512, 30013, 30013, 11381, 11381, 133974, 163987, 22762], [182463, 9049, 713, 137043, 713, 318793, -173414, -8336], [165514, -23016, 1105, -35710, 23016, 34605, 106788, -1105], [-629524, -1424, -2848, 314491, -542, 1424, 129386, -542], [-202338, -24721, 24721, 464313, 59637, 368274, -392995, 0], [22487, -72066, 0, 540743, 22487, 393788, -232927, -22487], [-430081, 33122, 66244, 206255, -17571, -33122, -37005, -17571], [-438358, -15466, -15466, 28826, 28826, -74616, -90082, 57652], [-123890, 0, -26505, 131728, 15676, -451520, 929545, 7838], [-532089, 34608, -1442, 411500, -34608, -410058, -85981, 1442], [42157, 28226, 28226, 10339, 10339, -106259, -78033, 20678], [462601, 57536, 35988, -106828, 35988, 319785, -405065, -21548], [673086, -20395, -33519, -203515, -13124, 706605, -223910, 20395], [216421, 50228, 25114, 279336, 0, -134837, 25114, 62915], [114393, -52262, -96896, 220568, -96896, 431857, -166655, -44634], [89348, 0, -47283, -70150, 38396, 566232, -1085181, 19198], [578717, 49276, 64104, -527348, -14828, -642821, 576624, 49276], [275829, 8150, 16798, 98550, -16798, -391177, 283979, -8648], [-6032, 20085, 0, -567400, -6032, 475735, -227825, 6032], [573136, 0, 2781, -576381, -6490, -616445, 1230109, -3245]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_26_f_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_26_5_f_b();".
// 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_26_5_f_b(:prec:=8)
    chi := MakeCharacter_26_f();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 5));
    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_26_5_f_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_26_5_f_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_26_f();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,5,sign)));
    Vf := Kernel([<3,R![173765124, -3084588, 3495258, 61074, 54939, 468, 261, 0, 1]>],Snew);
    return Vf;
end function;