
// Make newform 990.6.a.ba in Magma, downloaded from the LMFDB on 22 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_990_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_990_6_a_ba();".
// 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_990_6_a_ba();".
// 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 := [3072, -462, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-1, 3, 0], [-311, 8, 1]];
    Rf_basisdens := [1, 1, 1];
    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_990_a();"
function MakeCharacter_990_a()
    N := 990;
    order := 1;
    char_gens := [551, 397, 541];
    v := [1, 1, 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_990_a_Hecke( : Kf := Kf)
    return MakeCharacter_990_a();
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 := 6;
    raw_aps := [[4, 0, 0], [0, 0, 0], [-25, 0, 0], [91, -2, -1], [121, 0, 0], [-68, -13, 3], [209, 3, 10], [-575, 18, -11], [244, 9, -13], [-1825, -96, -17], [5887, -14, -13], [7157, -16, 53], [-5034, -46, 38], [2956, -244, -96], [4048, 51, 5], [-11305, 92, -141], [-4166, -16, 82], [2155, 696, -89], [-23790, 439, 51], [-4697, 424, 117], [380, 799, -77], [43374, -64, 490], [39362, -696, 190], [-44147, -180, 113], [73184, 674, -448], [89554, 100, 180], [-30594, -355, 37], [27752, 482, -162], [60074, 748, 760], [-32056, -78, 52], [42300, 3514, 966], [262259, 578, 363], [180428, -1802, -172], [51868, 3056, -96], [90361, -3178, 727], [154478, -5880, -2238], [16721, 1046, -2509], [152535, 1837, 1284], [318713, -3312, -905], [152088, 27, -717], [201544, 4546, -2166], [16530, -4190, 2490], [197036, -9488, 620], [-230589, -6223, 2398], [46006, 5075, -2531], [-46915, 5646, 993], [162477, 298, -2199], [-321264, -153, 3809], [394746, -8084, -422], [1007454, -668, -252], [-231947, 18365, 1708], [-65882, -4900, -7994], [-636818, -7798, -3582], [516634, -30, -976], [-304826, -27032, 1872], [-421597, 19908, 2617], [-636268, 1890, 7036], [-379280, 22148, 372], [1064606, -9265, 12101], [303218, 9038, -258], [1398534, 11328, -2902], [192712, 24881, -659], [-1052302, 1730, 6596], [-566987, -32308, 1915], [905266, 22112, 8808], [-999155, -6578, -13869], [1181276, -10544, -9992], [1010045, -15903, -6996], [236346, 36954, 1308], [-1995466, 6134, 9578], [-2248006, -24576, 1588], [2472768, 9084, -6564], [83122, 15689, 12981], [-1389204, 16257, -13579], [-1382198, -45664, -8934], [-1606076, -9509, -23103], [1209294, -10110, 10050], [1892574, 37196, 4660], [965031, -21752, -5621], [743236, 31424, 20574], [-1169832, 80838, 23382], [-104776, 9972, 6066], [-3631976, 3848, 5176], [1238732, -86062, -25948], [-3236696, 34836, 4108], [4188434, -17451, 2893], [-2113130, -74544, 680], [1263133, 102671, 16206], [-1351323, 117834, 17727], [2450348, 61899, 13809], [419965, 1983, -10876], [-6486508, 24312, 13156], [2395442, 6081, 39669], [1350535, -112242, -13405], [-1408528, -23624, 19612], [-3994240, -15156, 20032], [3562860, 124200, -1002], [-6590610, -9982, -30946], [2675816, -22850, 36106], [-4075263, 1126, -10365], [-1151188, 21996, 8784], [-8704568, -5073, 4127], [-3931510, -186166, 4188], [-1104936, -18364, -55582], [2405391, 119082, 16151], [-1431290, -20850, -32234], [630947, 36787, 56858], [-885548, 92129, -17627], [-3443235, -144208, -50281], [-1726134, -127482, 16274], [7560965, 21612, -42321], [1512500, 108337, 16765], [-1352524, 106874, -26712], [2336220, -172538, -52158], [8481257, -1920, 20259], [532391, 9078, 44485], [-9063489, 126685, 50796], [2126544, -6991, -30889], [4914889, 300360, -13723], [-6563155, -46142, -11743], [-3957762, -232342, -3530], [-8098949, 93777, -37562], [11643154, -101023, -6053], [7230939, -130247, -45620], [-5848494, 167218, -62040], [35733, 268952, 23081], [11782698, 54514, 32706], [-3484383, 50748, -20529], [-5094132, -247253, -22479], [-14012966, -160855, 17007], [3322624, -116248, 58092], [662873, 236568, 23095], [4834663, 17628, 50137], [-9045954, -99984, 52568], [-4283762, 42648, 29888], [8059398, -275870, 17970], [-3050741, 84972, -91633], [-12343964, -149434, -58650], [-8711090, 282836, 146176], [-11157846, -89634, 96534], [-2132101, -267302, 82027], [-13872222, -178502, -59690], [-7229278, -397443, 35313], [6201832, 100506, -80362], [-6443488, 346700, 99434], [22002456, -228284, -44132], [-8056004, -76051, -90663], [4639081, -14045, 155322], [7387794, 343350, -66076], [-19538580, 157591, 34333], [19737688, 87609, -43943], [-14204278, -303790, -98550], [-15602575, 83405, -7198], [-25899940, -345198, 18574], [-956885, 366913, 91676], [2956775, -23406, 47755], [-4305552, 556928, -2984], [-21679273, -165232, 56595], [-5685672, -211647, 38765], [-15086593, 59982, -165719], [15640683, -418657, 5582], [-14921937, 317769, -35250], [-14922647, -364124, 128363], [4467148, 188820, 42476], [-8023496, 326230, -175872], [4869428, 181939, 86801], [-6326104, -362316, 41676], [34954642, 121457, -43065], [-5839858, -546162, 146142], [660035, -290608, 286515], [-6250433, -394458, -55909], [-18490282, -597106, 56498], [-6296166, 714840, -40842], [35318967, -358937, -47484], [27922636, -321394, 182814], [-899341, -86494, 230757], [29529924, -5020, 226204], [-35491556, 358508, 85834], [9080161, 650630, 185841], [-24324165, -514818, -87847], [-16876112, 553775, -252063], [-21093717, -503086, -202285], [11145775, 527882, 162129], [-11322263, 697021, 14760], [-52894148, -165999, 78635], [-7078634, 248510, -52418], [37269806, 318117, -188289], [-28378014, 321445, 263349], [-6491722, 416376, 92508], [4508532, 1072996, -49568], [-26105696, 194014, -20188], [32446300, 814804, 54696], [-33110166, 567470, -213500], [-16349636, 150362, -336596], [54820160, 51484, -8356], [13745750, 680108, 134772], [48327240, -151838, -261144], [23627294, 186934, 29698], [6638892, -90961, 260903], [-19298605, 746004, 213001], [53941383, -393628, 281219], [-34385130, 107628, 188510], [5966867, -380452, -14653], [-7769844, 1016534, 212752], [20462828, -337422, 407950], [47208655, -899746, -319991], [-17402312, 428184, 175600], [35241044, -9018, -77570], [62860682, 788602, -185494], [-9989868, 65536, 65904], [20159885, -1005465, -73218], [-275624, 101392, 242490], [-23170002, -389075, -231099], [32818643, 1584415, -82210], [-45612124, -193040, 90740], [21462793, 430928, -209163], [-32226167, 472066, -79891], [-18618262, -549316, 177960], [38811190, 179173, 426693], [-17051179, 635716, -507955], [24770862, 1338990, -68638], [-7287070, 994848, -202770], [-69819875, -75490, -242465], [43096618, 1886177, 17133], [83614508, -564442, 25518], [-20753969, 1028126, -138243], [-57210702, -487026, 245406], [-69815225, 1166230, 356895], [32538196, -541246, 781806], [-32670636, -428684, -14732], [78425618, -406224, 201948], [-41130573, -451826, -96033], [-30732658, 1485284, 287966], [8288646, 587118, -222774], [50953506, 182369, -60287], [6537031, -520970, 778059], [10007821, -69134, -399553], [92198440, -1029115, -57143], [-32146072, -397584, -586148], [31564333, 63858, 580997], [38768243, -1679709, 72538], [-11665892, 1562432, 301368], [17036838, 1456001, 388969], [87131442, 137674, 398346], [-47641772, -1917317, -234093], [-96841574, 121228, 289818], [5464494, -145835, 33069], [-46628658, -234146, 65272], [38949213, 843274, 130665], [83515707, -271156, 107297], [14977520, -864249, -426165], [24310284, 2154784, -374438], [34343364, 316093, 310135], [-51140343, -59900, -432783], [36369346, 1507615, 450477], [110648843, 9886, 104783], [26214896, -1749246, -385212], [-4744574, -491524, 286650], [31294690, -598312, 707248], [-3398031, 213619, -509946], [96331332, -394370, 1122690], [-52161060, 542076, -770016], [-60051521, 110136, 402187], [-92046604, 1012531, 418027], [3637672, -800212, -692798], [-40044604, -1123200, -105120], [-1784076, 595338, -513516], [57447185, -465166, -845889], [-47132380, 1772712, 598428], [17192148, -2160759, 499449], [-34046414, -52024, -935532], [50144369, -832687, -793786], [-52824468, -1839218, -526464], [33412946, 660216, 59982], [-25493565, 1340387, 208852], [-131505532, 1338575, 365165], [48128742, 378585, 778605], [-48545214, -563606, 264906], [-42322094, -3067830, 179590], [-42366551, -245130, 12521], [-52898151, 1408016, -1376137], [90503812, 549764, 129672], [-20394784, 318072, -902804], [-7308281, -964546, 590421], [47104660, 2072084, -373944], [94149393, -934454, -629279], [102389762, -900486, 498510], [-50375344, -1181035, 516561], [-16339251, -2685580, -894173], [244887210, -519940, -212728], [-63550480, -430326, -85112], [97447174, 488639, 260311], [-99473815, 1688825, 131916], [-201762451, -1349854, 199953], [-16848488, -1365493, -1102161], [78350314, 865440, -661384], [-52298412, -1820706, 403502], [-39310891, 1375328, 481881], [-27532380, 985112, -1294984], [-171693686, -811254, -76316], [13690165, 3334555, -780934], [-103121810, 2635483, 158085], [-115130224, -1623652, 430340], [77356078, -44277, 1619675], [-95425770, 702580, 1030626], [141781596, -1704784, -126146], [-977070, 994313, 1133105], [-47357660, -1046604, -1522850], [-74092703, -2362932, -170521], [84244562, 4302041, 297743], [81850868, 1487968, -980320], [-178905646, 1562032, 197624], [-266873736, 996004, 350506], [-66014085, 1922539, 812922], [236612529, -568516, 529955], [-209743362, -2417554, 305638], [166020514, -232218, -160828], [-131859860, 4093840, 792636], [-197030594, 3805990, 1356614], [19592008, 2175364, -1338918], [7356587, 1756510, -811265], [62944210, -3133714, 487698], [-29015802, -631254, -1644246], [-210645184, 407491, -479003], [39764415, 2763953, -1355290], [-190685971, 1996666, -626537], [126066102, 1570426, -177516], [-24043618, 2594627, 804011], [141105929, -172974, -1124507], [-92096978, -2956785, 236057], [-29010459, 2182204, 1664097], [-76984130, -6873648, -126124], [13866140, -4584864, 190548], [148218922, 418278, -739072], [-1932119, -1602418, -751599], [253788913, 2266849, -676194], [-48337482, 3179694, 699506], [-301065419, -1939263, -361648], [165034955, -99842, -732635], [221186367, 4411234, -568305], [56673434, -4426008, -1117548], [185068882, -2193312, 22148], [-240782481, -1639066, 438761], [125463269, -2216230, 2678165], [-123725113, -6902028, 149107], [-72624671, -4052898, -654559], [-133059072, -1173898, 665056], [-48385423, 2520775, 790720], [231788388, 4372532, -626320], [-83262335, -3870276, -1214527], [118999141, 1093058, 1208121], [118806346, -1487924, -1194172], [-98900440, 4366616, 1818666], [-213865551, -4113854, -485763], [-259130533, 1253520, -1752297], [268800195, 4406547, -62760], [177520877, 800302, 566393], [166240253, -2117066, -755059], [77632688, 1175843, 3197103], [-109942610, 3615355, -1654185], [90012452, -1177805, 1549171], [-76081144, -2230068, -1158230], [183323398, -3590469, -131137], [7654333, -5376646, -2519231], [180587451, 2262435, 50138], [-413034000, -1963370, -341388], [98324516, 1133447, -890421], [98148123, -5116232, 65253], [-188154228, 1628614, 1580520], [452147924, -1391162, -367006], [38263132, 678030, 784858], [-136851340, 3504758, -2376798], [142324729, -2283638, 1332915], [90853278, -1111988, 1983342], [234865318, -3913592, -1687024], [-37476352, 1130918, 1791822], [150121414, -2168468, -837330], [-40217013, 1777495, -1466952], [-69683288, -3957864, 1384118], [-12276459, 3826043, -887990], [115959792, -2126748, -1613802], [-116362846, -3737468, -400144], [61259984, 1908730, -1250630], [93923147, 5521751, -1903452], [-84404008, -934096, 1447148], [463273242, -3166569, -4305], [-253434084, -2032718, 459426], [-170059641, 6172414, 394197], [361428236, 717414, 1922190], [304557128, 7261497, -1152113], [263140027, 588222, -849491], [-69958847, 1116452, 628729], [-287624608, 4908088, 1051004], [-195510094, 427983, -3781413], [137843748, 3527226, 1326666], [-163003012, 3848073, -2727183], [140325006, 1154992, 1196730], [-233064457, 7112918, 1222653], [30215506, -2557446, -464264], [162568141, 7027632, 1861601], [-166695167, -2921506, 1303467], [10206062, 4001818, -655570], [108956292, 469108, -156564], [-342104352, -2973836, -1641446], [146962990, 389608, 735348], [230757230, 2597556, 2900694], [15654211, -4007526, -615899], [-70768462, -4350108, -2872136], [124980757, -7094389, 1232424], [-82779958, 6672028, 3915422], [-253681852, 3547581, -2820963], [254053698, 2893721, -1275181], [-210579534, -3308375, -156935], [-94934348, -9982936, 1065984], [-121489652, -5615389, 452175], [80051948, 1548798, -190760], [-58314412, 5366288, 2361996], [315798482, -3226925, 1660747], [-77088566, -3005876, 2154312], [-121135999, 696458, 469845], [58794616, 5459044, -375762], [373140426, -7021, 1124725], [67370650, 4014781, -2668431], [-81260337, -10477042, -1282045], [-19624486, -1430280, -3700200], [-597347599, 1923692, -208167], [335291643, -75997, 1213922], [-32386360, -3804416, -263482], [246388292, 168118, 75250], [-156175042, 3090080, -4821246]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_990_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_990_6_a_ba();".
// 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_990_6_a_ba(:prec:=3)
    chi := MakeCharacter_990_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 6));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(2999) - 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_990_6_a_ba();".
// 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_990_6_a_ba( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_990_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<7,R![5952592, -17472, -273, 1]>,<17,R![1839018960, -2850906, -627, 1]>],Snew);
    return Vf;
end function;