
// Make newform 14.10.c.b in Magma, downloaded from the LMFDB on 02 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_14_c();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_14_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_14_10_c_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_14_10_c_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 := [5038160400, -286546260, 16368349, -137923, 4038, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [-3390681949200, -44277546197779, 181829734103, -10923076698, 2705071, -2716901], [166009397495697, -1153921789020, 65915341423, 146824014, 16261026, -4027], [2597186800681200, 28003708179344409, -139277523654233, 8366833294278, 53013142539, 2081085611], [133935551353629480, 1908449358635081, 26700567042283, 3747785917342, 35795315171, 694639239], [105641374520591910, -4412132311683371, 96406628067317, -77151616502, 9199967499, -352672159]];
    Rf_basisdens := [1, 778518660033660, 690992893521, 2335555980100980, 778518660033660, 389259330016830];
    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_14_c();"
function MakeCharacter_14_c()
    N := 14;
    order := 3;
    char_gens := [3];
    v := [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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_14_c_Hecke();"
function MakeCharacter_14_c_Hecke( : Kf := false)
    N := 14;
    order := 3;
    char_gens := [3];
    char_values := [[-1, -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 := 10;
    raw_aps := [[16, 16, 0, 0, 0, 0], [0, -24, 0, -1, 0, 0], [-364, -364, 4, -5, 2, -3], [-1812, -1353, -12, 18, -1, -11], [0, -931, -37, -127, 111, -37], [6211, 0, -565, -1, -1, -2], [0, -7180, 167, -1282, -501, 167], [407143, 407143, 39, 234, -546, 819], [-657482, -657482, 13499, -12847, -1304, 1956], [-865283, 0, -12191, -947, -947, -1894], [0, 3114553, -2455, -26965, 7365, -2455], [-8597411, -8597411, -25866, 24804, 2124, -3186], [64929, 0, 32649, 9093, 9093, 18186], [966848, 0, 40716, -1524, -1524, -3048], [16121205, 16121205, 101733, -77040, -49386, 74079], [0, -34049691, -15204, 82950, 45612, -15204], [0, -48055016, 11500, 20587, -34500, 11500], [93456245, 93456245, 342266, -417556, 150580, -225870], [0, -56626530, 142306, 403891, -426918, 142306], [156335774, 0, 721994, -14686, -14686, -29372], [0, -204934671, 61354, -1149536, -184062, 61354], [65385458, 65385458, 2047031, -1794499, -505064, 757596], [-357354022, 0, -1569286, 275042, 275042, 550084], [269250885, 269250885, -3257028, 2845428, 823200, -1234800], [-754077081, 0, -1333445, -323297, -323297, -646594], [0, -323879780, -1114247, -547376, 3342741, -1114247], [1154185756, 1154185756, 1215519, -918729, -593580, 890370], [-494907045, -494907045, -8791869, 9586254, -1588770, 2383155], [0, 523379466, 1364215, -3519464, -4092645, 1364215], [-1308652409, 0, 4452331, 255151, 255151, 510302], [-1503929702, 0, -550906, -879826, -879826, -1759652], [-309787390, -309787390, -11876099, 13022485, -2292772, 3439158], [0, 3678227212, -312917, 27166330, 938751, -312917], [1436419110, 0, -10947674, -226658, -226658, -453316], [2374061460, 2374061460, 30086268, -26720805, -6730926, 10096389], [0, 6066488061, -2617295, 4440463, 7851885, -2617295], [0, -8935329157, 6498, -18155250, -19494, 6498], [5294498584, 5294498584, -67231527, 65085003, 4293048, -6439572], [4130127007, 0, 25422265, 4805533, 4805533, 9611066], [3866377895, 3866377895, 12313558, -13142402, 1657688, -2486532], [0, 3021120621, -3027585, -104150043, 9082755, -3027585], [-4122628394, 0, -6249856, -121456, -121456, -242912], [-3627330699, -3627330699, -98260899, 98782704, -1043610, 1565415], [0, -8036384398, -7420983, -92884566, 22262949, -7420983], [-5005040191, 0, 101500421, -3185983, -3185983, -6371966], [0, 2372346251, -2130957, 80504331, 6392871, -2130957], [7749598790, 0, 73167054, 19104870, 19104870, 38209740], [-40396397038, 0, -30275154, -17305578, -17305578, -34611156], [0, 1070267883, -3326991, 125673825, 9980973, -3326991], [24090969906, 24090969906, -281480096, 258818137, 45323918, -67985877], [-24407609858, -24407609858, 143368022, -163923571, 41111098, -61666647], [15368939757, 0, -30513261, 33509727, 33509727, 67019454], [0, -25971746053, -19185780, 64536384, 57557340, -19185780], [-8654932767, 0, 356413227, 28220919, 28220919, 56441838], [-24236454000, -24236454000, -273963330, 322213647, -96500634, 144750951], [0, 10381750344, 54738402, -239474103, -164215206, 54738402], [0, 22626188875, 5297770, 20151910, -15893310, 5297770], [1216315028, 1216315028, 637210139, -586415233, -101589812, 152384718], [0, -2398597927, -1038840, -530676306, 3116520, -1038840], [63543051419, 0, 71106431, 77735891, 77735891, 155471782], [0, 29273258121, 52226407, -282248879, -156679221, 52226407], [100177258302, 0, -501622200, -68132088, -68132088, -136264176], [57103553520, 0, -372059420, -37711868, -37711868, -75423736], [0, 65998796422, -38658092, -24514427, 115974276, -38658092], [-51793492173, -51793492173, -217553672, 220056034, -5004724, 7507086], [47580275703, 47580275703, 498346638, -634574994, 272456712, -408685068], [-92595261362, -92595261362, 469665297, -322883535, -293563524, 440345286], [-81184439147, 0, 1704822269, 152640521, 152640521, 305281042], [0, 12510255984, -149682012, -1308188373, 449046036, -149682012], [176593129797, 0, 663420313, -83851931, -83851931, -167703862], [0, 101688727314, 23498073, -395058534, -70494219, 23498073], [59705688671, 59705688671, 287921533, -507555830, 439268594, -658902891], [0, -91368255820, -195673830, -982089483, 587021490, -195673830], [-59648085021, -59648085021, -1255840598, 1088537290, 334606616, -501909924], [-7695928389, 0, -844694927, -6203627, -6203627, -12407254], [64991413075, 64991413075, 204425657, -417173458, 425495602, -638243403], [0, 405686870500, 269133889, -1308290384, -807401667, 269133889], [364270217366, 364270217366, 824676500, -863660275, 77967550, -116951325], [327914774160, 327914774160, -687153834, 1013901807, -653495946, 980243919], [0, -556738562968, -116479257, 2165068938, 349437771, -116479257], [-375249039000, 0, -1624189476, -36831876, -36831876, -73663752], [-194836474913, 0, -2447506489, 181065419, 181065419, 362130838], [0, -200489863485, 138734319, 5461797759, -416202957, 138734319], [-390275493997, 0, -1415666529, 612821715, 612821715, 1225643430], [1044843327683, 1044843327683, -1512111907, 1553625806, -83027798, 124541697], [-434804769431, -434804769431, 1630462487, -1501082788, -258759398, 388139097], [-299674718339, 0, -1978151867, -33297743, -33297743, -66595486], [-491766101037, -491766101037, -4876918256, 4246476514, 1260883484, -1891325226], [307719472033, 0, 3379217773, -820548887, -820548887, -1641097774], [-140221058568, 0, -3614808872, 464282968, 464282968, 928565936], [-262928608480, -262928608480, 7252078993, -7495081997, 486006008, -729009012], [0, 593099922662, 174854504, 2205433481, -524563512, 174854504], [0, 331206540524, 1262135454, 1096590225, -3786406362, 1262135454], [566811670035, 0, 3030064137, 41778381, 41778381, 83556762], [54092669352, 54092669352, -2717984399, 3262335739, -1088702680, 1633054020], [-175352647134, 0, 6215992950, 967312734, 967312734, 1934625468], [-1357632479076, -1357632479076, -2645130696, 2376568563, 537124266, -805686399], [0, 380981477067, -87264600, -5568918084, 261793800, -87264600], [2217474097183, 2217474097183, -883400325, 992279634, -217758618, 326637927], [1062799782500, 1062799782500, 11877375896, -12120152005, 485552218, -728328327], [-1392671698319, 0, 8850551363, -640679377, -640679377, -1281358754], [0, 984097164802, -77839169, 9142076488, 233517507, -77839169], [0, -646167650818, 19711898, 17779856555, -59135694, 19711898], [1685945698299, 1685945698299, 15834799080, -16245304662, 821011164, -1231516746], [0, 634646135713, 1845056735, -6028105711, -5535170205, 1845056735], [0, -833542588449, 1177750336, -22829741024, -3533251008, 1177750336], [-2642969781508, 0, -2658343696, -690404992, -690404992, -1380809984], [-517870992666, -517870992666, -590661294, 2808689157, -4436055726, 6654083589], [0, -2922318095058, -594112548, -268141563, 1782337644, -594112548], [1668458950439, 0, 474345651, -1707712905, -1707712905, -3415425810], [1060846137887, 1060846137887, 19332557537, -21551208646, 4437302218, -6655953327], [0, 1416398498194, 619054283, 13996706420, -1857162849, 619054283], [970838023553, 0, 26040080297, -720872635, -720872635, -1441745270], [0, 35312244594, -1388051054, 2406794383, 4164153162, -1388051054], [-1853139251266, 0, 11610914010, -2019873102, -2019873102, -4039746204], [0, -2540295866173, 2251329164, -13000678600, -6753987492, 2251329164], [-3517438099000, 0, 2984373276, 826786140, 826786140, 1653572280], [0, -340572540522, -1847335668, -10080312435, 5542007004, -1847335668], [-1572873332997, -1572873332997, 23900909358, -20679414894, -6442988928, 9664483392], [4545804287546, 0, -20285351014, -77552446, -77552446, -155104892], [0, 1509471817311, 233241034, 43192657522, -699723102, 233241034], [-4221111865987, 0, -10033024923, 1999192497, 1999192497, 3998384994], [-3106144450722, -3106144450722, 15282727128, -18410366139, 6255278022, -9382917033], [0, -7479420933501, -1333059843, 11928598341, 3999179529, -1333059843], [3968292453142, 3968292453142, -28245011667, 29765184777, -3040346220, 4560519330], [7103089155082, 0, -3891229100, 1151755684, 1151755684, 2303511368], [-2761505994659, -2761505994659, 21125677350, -21567104604, 882854508, -1324281762], [675934493148, 675934493148, -41056243509, 43717867335, -5323247652, 7984871478], [-1623159723774, 0, -37423298762, -159898274, -159898274, -319796548], [5867901857099, 5867901857099, -67409476378, 65904913730, 3009125296, -4513687944], [0, 1034312635831, 317728181, -19688085847, -953184543, 317728181], [1109224694154, 0, 8727808638, -3786581850, -3786581850, -7573163700], [-96155270551, -96155270551, -4677243667, 12499878980, -15645270626, 23467905939], [-5069344767023, 0, -13784298139, 6391604417, 6391604417, 12783208834], [-6225750100952, -6225750100952, 36013308722, -35759222953, -508171538, 762257307], [1541930048505, 0, 78692077129, -4798004795, -4798004795, -9596009590], [0, -1961616369992, 2868309085, 80496618472, -8604927255, 2868309085], [0, -3761648683868, 5467831484, -16459313233, -16403494452, 5467831484], [2567116228137, 0, 67903685301, -1432647759, -1432647759, -2865295518], [0, 2629834902481, -234592358, -52017003920, 703777074, -234592358], [8717029592004, 0, -3719330360, -1984790312, -1984790312, -3969580624], [1949597891278, 1949597891278, -7350331504, 3502022357, 7696618294, -11544927441], [0, 16022046821166, 2216752204, 18085559605, -6650256612, 2216752204], [478599288180, 0, -17265866712, 8254086360, 8254086360, 16508172720], [0, 506161023102, -5402649221, 89710108024, 16207947663, -5402649221], [-1673929372240, 0, -48927979048, -2740465192, -2740465192, -5480930384], [1756324576019, 0, 67759156611, -10036148265, -10036148265, -20072296530], [0, 3757994765001, 9101682042, -88182302568, -27305046126, 9101682042], [8966459421073, 8966459421073, 70345512375, -69015475068, -2660074614, 3990111921], [-4128884372782, -4128884372782, 82211218255, -79160183747, -6102069016, 9153103524], [6687280260768, 6687280260768, 57166862440, -42474317801, -29385089278, 44077633917], [10170398966202, 0, 33596389560, 13329883368, 13329883368, 26659766736], [-9337272344422, 0, -57309905958, -7483564062, -7483564062, -14967128124], [1285992970401, 1285992970401, -60439561959, 63861912012, -6844700106, 10267050159], [0, 1634646378100, 10701373160, 43447289915, -32104119480, 10701373160], [2836868226408, 0, -192023625624, 7200801000, 7200801000, 14401602000], [202652933091, 202652933091, 1241183533, -4281633362, 6080899658, -9121349487], [12653698828371, 12653698828371, 57712980996, -64119003054, 12812044116, -19218066174], [-19505868237178, 0, -36754397340, 9974203284, 9974203284, 19948406568], [0, 1086378782089, 2947775620, -15625685462, -8843326860, 2947775620], [-3177199565602, -3177199565602, -8451211907, -16951110959, 50804645732, -76206968598], [-2444490134665, 0, 113520172547, 14479246151, 14479246151, 28958492302], [17911812524330, 0, 80236747134, -13701916698, -13701916698, -27403833396], [-21056524739970, -21056524739970, -99985548495, 105361244769, -10751392548, 16127088822], [0, -18733910049606, 12187661097, -5777493822, -36562983291, 12187661097], [0, -12375196622031, 13566978381, -38465320857, -40700935143, 13566978381], [0, -16724919064078, -24587749332, 74688374289, 73763247996, -24587749332], [0, 4147563934799, -11263594302, 217872681498, 33790782906, -11263594302]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_14_c_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_14_10_c_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_14_10_c_b(:prec:=6)
    chi := MakeCharacter_14_c();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 10));
    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_14_10_c_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_14_10_c_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_14_c();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<3,R![5717239655625, -75455153775, 1165610574, -2541603, 36598, -71, 1]>],Snew);
    return Vf;
end function;