
// Make newform 25.9.c.c in Magma, downloaded from the LMFDB on 24 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_25_c();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_25_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_25_9_c_c();".
// 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_25_9_c_c();".
// 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 := [1000000, -80000, 3200, 133760, 221184, 50576, 4192, -2456, 1665, 124, 8, -4, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-93665468020000, 742617488427600, 2619570367020680, 391795974445792, 25122958585108, -29743835378214, 18307600018527, 485787845405, 33350532992, -45928215186, 12061467443, -449334647], [893767035735100000, -586491243793535600, 314446245222974520, 77705746695051688, 64053508653668192, -33522577801375186, 7803983586776523, -171099951179440, 65801651136208, -37023789923414, 6650619527307, -381080397548], [922317979047700000, -1196810894658951200, 309514999935977040, 82048639403653576, 74064999620016284, -40733398019692072, 8675411389531896, -211070404447705, 78139416210016, -43325832090128, 7533818317764, -435927172721], [477584608191700000, -355782590076255200, 166630693079745840, 41694360232978696, 34974606965024684, -18220487011478272, 4231435047360396, -94461295798645, 35763821961616, -20095877149928, 3608923885464, -207349351901], [-1133723541093860000, 173135939040904400, 211819995842916920, -241887606416273592, -157225538636164648, -20344818011353466, 12988417959142963, -3875122781812200, -337439888728952, -35907038981134, 14877294336467, -2727925523508], [1247625114598220000, -198729082677228800, -123042970649069840, 526070134489984584, 230071439819114596, 27648898660009532, -17351460615923476, 6217465685948625, 514100031045104, 49390928549668, -21153383834384, 4175127571641], [-610883057460620000, 93910105577124800, 106049680478950640, -149243933399361864, -88917144546491956, -11343535848559652, 7230531059293336, -2220383154537645, -191658965219744, -20060042759548, 8356009540724, -1550015596341], [383974712446124000, -196135089198878000, 26376040044011120, 83754911423788736, 51157179993258096, -2746934977689118, -1288692597374696, 909244071727231, 95492643662604, 181744291018, -2036265285124, 572380746383], [29397487192378875, -13691088598724000, 1840584763196960, 5851971198380288, 3580518768001248, -188808282377284, -89744414904848, 63244284483538, 6653307104727, 13469724484, -141775272712, 39828320474], [271880958159720000, 635765474055926400, -409047550686121080, 270676000135919688, 116931082369255632, 59286542830870044, -22488461054564617, 4949193516916155, 333658706564268, 80120961677856, -24100275366453, 3672375956607], [612803755717220000, 1364799133894076400, -1105783357863599080, 575827073848470688, 258903920872190332, 134211765950123694, -51744355689454067, 10989507276185255, 741572009869568, 182306064041706, -54768226676503, 8224243606507]];
    Rf_basisdens := [1, 5581520471420000, 8372280707130000, 8372280707130000, 1339564913140800, 8372280707130000, 8372280707130000, 1339564913140800, 111630409428400, 6976900589275, 558152047142000, 1116304094284000];
    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_25_c();"
function MakeCharacter_25_c()
    N := 25;
    order := 4;
    char_gens := [2];
    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_25_c_Hecke();"
function MakeCharacter_25_c_Hecke(Kf)
    N := 25;
    order := 4;
    char_gens := [2];
    char_values := [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, 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+1)]];
    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 := 9;
    raw_aps := [[0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, -42, 18, 4, 0, 0, 0, 0, 0, 0, 0], [-9843, 0, 0, 0, 0, 0, 0, 0, 21, -22, 0, 0], [0, 0, 0, 0, 0, 906, -270, 258, 0, 0, 0, 0], [0, 0, -134, 1134, 1149, 0, 0, 0, 0, 0, 0, 0], [0, -14875, 0, 0, 0, 0, 0, 0, 0, 0, 369, -214], [0, 0, 0, 0, 0, -7822, -3294, -2154, 0, 0, 0, 0], [0, -401550, 0, 0, 0, 0, 0, 0, 0, 0, 978, -740], [268642, 0, 0, 0, 0, 0, 0, 0, 2358, 1244, 0, 0], [0, 0, -85098, -14094, -20464, 0, 0, 0, 0, 0, 0, 0], [911697, 0, 0, 0, 0, 0, 0, 0, -2712, -4016, 0, 0], [0, 0, 0, 0, 0, -7998, 4698, 64228, 0, 0, 0, 0], [0, 0, 58680, 50112, -2382, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -139196, -45036, 125742, 0, 0, 0, 0], [0, -4117950, 0, 0, 0, 0, 0, 0, 0, 0, -28980, 9312], [-1966468, 0, 0, 0, 0, 0, 0, 0, -24750, 5500, 0, 0], [0, 0, -286419, 78939, -614361, 0, 0, 0, 0, 0, 0, 0], [-3989238, 0, 0, 0, 0, 0, 0, 0, 3000, 77000, 0, 0], [0, 0, 0, 0, 0, -603222, -125694, 80197, 0, 0, 0, 0], [0, -2874200, 0, 0, 0, 0, 0, 0, 0, 0, 94914, 62668], [0, 0, 0, 0, 0, -1479865, 204687, -91563, 0, 0, 0, 0], [0, -10559775, 0, 0, 0, 0, 0, 0, 0, 0, -12066, -162700], [0, 0, -2576040, -21528, 1318124, 0, 0, 0, 0, 0, 0, 0], [25859352, 0, 0, 0, 0, 0, 0, 0, -89718, -240724, 0, 0], [0, 0, 0, 0, 0, 3681624, -151776, 711986, 0, 0, 0, 0], [0, 0, -5274807, 1670463, 259491, 0, 0, 0, 0, 0, 0, 0], [0, -24388400, 0, 0, 0, 0, 0, 0, 0, 0, 5958, -45644], [0, 0, 0, 0, 0, -3054624, 1110240, -3582627, 0, 0, 0, 0], [0, 0, 2608254, -2841390, -2120598, 0, 0, 0, 0, 0, 0, 0], [197727642, 0, 0, 0, 0, 0, 0, 0, -371124, 520368, 0, 0], [0, 0, 6583492, 2313036, 6487095, 0, 0, 0, 0, 0, 0, 0], [0, -83881975, 0, 0, 0, 0, 0, 0, 0, 0, -1221633, 30654], [0, 442005450, 0, 0, 0, 0, 0, 0, 0, 0, -1154598, -248884], [197224252, 0, 0, 0, 0, 0, 0, 0, -917838, -694884, 0, 0], [0, 0, 10255188, 2758428, 8527618, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 16463601, -3254535, 1477359, 0, 0, 0, 0], [0, 0, 23533376, -4078296, 6033510, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -14328332, 11831076, 8269920, 0, 0, 0, 0], [0, -290798925, 0, 0, 0, 0, 0, 0, 0, 0, 2105403, -2474210], [-48647858, 0, 0, 0, 0, 0, 0, 0, -2122740, 1056680, 0, 0], [924299622, 0, 0, 0, 0, 0, 0, 0, 1786122, -344604, 0, 0], [0, 0, 0, 0, 0, 31360962, -4442022, 15218065, 0, 0, 0, 0], [0, 0, -28514500, -2816748, 10637118, 0, 0, 0, 0, 0, 0, 0], [0, -1786597400, 0, 0, 0, 0, 0, 0, 0, 0, 519156, -1949352], [369830657, 0, 0, 0, 0, 0, 0, 0, 3396717, 576106, 0, 0], [0, 0, 0, 0, 0, 61543908, -11521404, -4381228, 0, 0, 0, 0], [0, 0, 66822014, 7262730, -27590016, 0, 0, 0, 0, 0, 0, 0], [0, 1320974900, 0, 0, 0, 0, 0, 0, 0, 0, 9096300, -3474904], [0, 0, 0, 0, 0, -84105180, -33372108, 40685844, 0, 0, 0, 0], [0, 296398050, 0, 0, 0, 0, 0, 0, 0, 0, -5184384, 2418056], [-2871678403, 0, 0, 0, 0, 0, 0, 0, -11349810, -337580, 0, 0], [2387054877, 0, 0, 0, 0, 0, 0, 0, 8277315, 2358670, 0, 0], [0, 0, -19596812, -50075172, 67540356, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -43522854, -9980550, -41789646, 0, 0, 0, 0], [0, -549036600, 0, 0, 0, 0, 0, 0, 0, 0, -20491032, 10618768], [3537156062, 0, 0, 0, 0, 0, 0, 0, -15032502, 6317764, 0, 0], [0, 0, -86227206, -14629410, 95117510, 0, 0, 0, 0, 0, 0, 0], [-2837511858, 0, 0, 0, 0, 0, 0, 0, 1944708, 10407544, 0, 0], [0, 0, 0, 0, 0, 198610155, 32623947, -125570941, 0, 0, 0, 0], [0, 0, 0, 0, 0, -40512458, -41357682, 137782644, 0, 0, 0, 0], [0, 0, -39646287, 69794703, -39113015, 0, 0, 0, 0, 0, 0, 0], [-1980801768, 0, 0, 0, 0, 0, 0, 0, 33286218, -7982276, 0, 0], [0, 0, 0, 0, 0, -108788604, -138703500, -163016700, 0, 0, 0, 0], [0, 0, -283922704, 9770544, 200062740, 0, 0, 0, 0, 0, 0, 0], [10920872567, 0, 0, 0, 0, 0, 0, 0, -35159121, 25800222, 0, 0], [0, 0, -3821208, 2466936, 3092871, 0, 0, 0, 0, 0, 0, 0], [0, 0, -517887795, -17915013, -229330473, 0, 0, 0, 0, 0, 0, 0], [0, 3249562100, 0, 0, 0, 0, 0, 0, 0, 0, 35904006, 40276628], [0, 0, 0, 0, 0, 4073244, -36776916, 103973124, 0, 0, 0, 0], [0, -7306573500, 0, 0, 0, 0, 0, 0, 0, 0, -14838858, 33830868], [0, 0, 569308716, -191157516, -98340948, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 44922288, 232829136, 231746522, 0, 0, 0, 0], [0, -4090122625, 0, 0, 0, 0, 0, 0, 0, 0, -4325949, -40783906], [0, 0, 0, 0, 0, -375362990, 40786362, 161163468, 0, 0, 0, 0], [0, 14225976150, 0, 0, 0, 0, 0, 0, 0, 0, 16283892, 6094904], [0, 0, 69477540, 368977932, -375932680, 0, 0, 0, 0, 0, 0, 0], [-20671078773, 0, 0, 0, 0, 0, 0, 0, 49332966, 44457988, 0, 0], [0, -22166748475, 0, 0, 0, 0, 0, 0, 0, 0, 983556, 53013080], [0, -10512938325, 0, 0, 0, 0, 0, 0, 0, 0, -578553, -6900730], [3138467512, 0, 0, 0, 0, 0, 0, 0, 42010488, -53786416, 0, 0], [-11382909708, 0, 0, 0, 0, 0, 0, 0, 16772226, 62900668, 0, 0], [0, 0, 0, 0, 0, 1636178130, -75023478, 276808127, 0, 0, 0, 0], [0, 16406063050, 0, 0, 0, 0, 0, 0, 0, 0, 48734856, -32556584], [0, 0, 0, 0, 0, -550277723, 493549173, 126651441, 0, 0, 0, 0], [0, 11333426925, 0, 0, 0, 0, 0, 0, 0, 0, 57610698, -56178596], [0, 0, -1036231452, -323638452, -608859819, 0, 0, 0, 0, 0, 0, 0], [28011557532, 0, 0, 0, 0, 0, 0, 0, -10349988, -8882584, 0, 0], [0, 0, 0, 0, 0, -1078742124, -29859660, -731187380, 0, 0, 0, 0], [0, 0, -1131303094, 205142814, 872195916, 0, 0, 0, 0, 0, 0, 0], [0, 58073487750, 0, 0, 0, 0, 0, 0, 0, 0, 16356006, -78785796], [0, 0, -750741738, 157243626, 599794086, 0, 0, 0, 0, 0, 0, 0], [-73491416178, 0, 0, 0, 0, 0, 0, 0, 70819104, -37958728, 0, 0], [0, 20319929650, 0, 0, 0, 0, 0, 0, 0, 0, -101144556, 59282992], [0, 0, 0, 0, 0, 2145757484, -484097796, 305711208, 0, 0, 0, 0], [0, 2056725150, 0, 0, 0, 0, 0, 0, 0, 0, -232421244, -32410600], [-3811380063, 0, 0, 0, 0, 0, 0, 0, -75556752, -94296736, 0, 0], [0, 0, 0, 0, 0, -2550096597, -428827869, 309663821, 0, 0, 0, 0], [40696539272, 0, 0, 0, 0, 0, 0, 0, 9065016, -66380112, 0, 0], [0, 0, 1327039005, 373572387, -231116387, 0, 0, 0, 0, 0, 0, 0], [0, 0, -3361003422, -780873642, -595609554, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -1459996914, -927249930, 1412742276, 0, 0, 0, 0], [0, 21853773675, 0, 0, 0, 0, 0, 0, 0, 0, 324774072, -19566000], [15659857862, 0, 0, 0, 0, 0, 0, 0, -107247096, 57277672, 0, 0], [0, 0, 986641344, -433287360, -1629067351, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1663997707, -1908922059, 380075427, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -265146028, 1334539908, 2403243177, 0, 0, 0, 0], [0, -29692062900, 0, 0, 0, 0, 0, 0, 0, 0, -32202594, 76742628], [109398130177, 0, 0, 0, 0, 0, 0, 0, 29825190, -267303580, 0, 0], [0, 0, -7231934412, -11655972, 912354824, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -4085919204, -1578604500, 249701786, 0, 0, 0, 0], [0, 0, -2768802044, -477421236, 1501929288, 0, 0, 0, 0, 0, 0, 0], [0, -151662669950, 0, 0, 0, 0, 0, 0, 0, 0, -174582648, -211243800], [-28603584958, 0, 0, 0, 0, 0, 0, 0, 387927882, -383870924, 0, 0], [-13942754778, 0, 0, 0, 0, 0, 0, 0, -549259068, -245294024, 0, 0], [0, 0, 0, 0, 0, -5998103898, -1417944402, 3381334860, 0, 0, 0, 0], [0, 0, 2552201720, -823027608, 2366363352, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 3081060454, -1267825986, 576687624, 0, 0, 0, 0], [0, -167698664925, 0, 0, 0, 0, 0, 0, 0, 0, -117264351, -365173646], [10355410282, 0, 0, 0, 0, 0, 0, 0, 372059298, 227107164, 0, 0], [0, 0, 0, 0, 0, -5698551252, 3064184316, -622257248, 0, 0, 0, 0], [0, 0, 365949444, 1165741740, -221311488, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 3120238615, -2509566273, 3369286581, 0, 0, 0, 0], [53460829747, 0, 0, 0, 0, 0, 0, 0, 486028917, 559120706, 0, 0], [-144380679198, 0, 0, 0, 0, 0, 0, 0, 165067518, 242893124, 0, 0], [0, 140330665100, 0, 0, 0, 0, 0, 0, 0, 0, -434217312, -370085184], [0, 134476774800, 0, 0, 0, 0, 0, 0, 0, 0, -1104420318, -111943540], [0, 0, 4180308504, -666804240, -3347680610, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 4474221210, 2329034562, -2253021570, 0, 0, 0, 0], [0, -192795081250, 0, 0, 0, 0, 0, 0, 0, 0, 65082528, 452415272], [0, 0, 0, 0, 0, -9052603698, 826806798, -6911161578, 0, 0, 0, 0], [161042437702, 0, 0, 0, 0, 0, 0, 0, 318085128, 58590104, 0, 0], [0, 0, 1202975448, 2135427048, 10201060180, 0, 0, 0, 0, 0, 0, 0], [-25811181693, 0, 0, 0, 0, 0, 0, 0, 202481352, -748072464, 0, 0], [0, 115330965775, 0, 0, 0, 0, 0, 0, 0, 0, 777159198, 680967508], [0, 0, 0, 0, 0, -1083197302, -591538734, 1575566454, 0, 0, 0, 0], [0, 0, 5133184782, 661900266, -9987021212, 0, 0, 0, 0, 0, 0, 0], [0, 0, -5525238940, -529523028, 4888635270, 0, 0, 0, 0, 0, 0, 0], [0, 127777203450, 0, 0, 0, 0, 0, 0, 0, 0, 188666244, -651482856], [-90758437118, 0, 0, 0, 0, 0, 0, 0, 683567064, -244565448, 0, 0], [18185426562, 0, 0, 0, 0, 0, 0, 0, 672052332, 909687176, 0, 0], [0, 0, 0, 0, 0, 14489940948, -383832684, -9807046860, 0, 0, 0, 0], [0, 0, 3267333769, -520337385, -6732105711, 0, 0, 0, 0, 0, 0, 0], [0, -277759627750, 0, 0, 0, 0, 0, 0, 0, 0, 202620546, 151411644], [0, 25614916200, 0, 0, 0, 0, 0, 0, 0, 0, -68542560, 1359801408], [0, 0, 0, 0, 0, 22293194484, -4554983196, 11914607550, 0, 0, 0, 0], [0, 0, -18490308272, 475294608, 4039768245, 0, 0, 0, 0, 0, 0, 0], [0, -370650762575, 0, 0, 0, 0, 0, 0, 0, 0, 1015381215, -259936418], [0, 0, 0, 0, 0, -14167567904, 4191053400, -14254890114, 0, 0, 0, 0], [0, 0, 23754674364, -3548822220, 2434657036, 0, 0, 0, 0, 0, 0, 0], [-291595716558, 0, 0, 0, 0, 0, 0, 0, -1066654692, -616045656, 0, 0], [0, 0, 0, 0, 0, 7325363175, -4422666393, 9087176639, 0, 0, 0, 0], [0, 0, 10540605352, 11363142456, -7139908896, 0, 0, 0, 0, 0, 0, 0], [0, 0, 18926663898, -4846325202, -4522789708, 0, 0, 0, 0, 0, 0, 0], [527612595732, 0, 0, 0, 0, 0, 0, 0, -405734004, -1035818472, 0, 0], [0, 679268859650, 0, 0, 0, 0, 0, 0, 0, 0, -80984502, -142803612], [0, 401532193050, 0, 0, 0, 0, 0, 0, 0, 0, 153643944, 709988528], [0, 0, 1987728402, 10569702006, -3319935437, 0, 0, 0, 0, 0, 0, 0], [227844526722, 0, 0, 0, 0, 0, 0, 0, -2517149154, -654478172, 0, 0], [0, 0, 1784969170, 1592366742, -16182707844, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2968832184, 9076464504, -5309254383, 0, 0, 0, 0], [0, 0, -31221456084, -5157256716, 3638554940, 0, 0, 0, 0, 0, 0, 0], [392534274987, 0, 0, 0, 0, 0, 0, 0, 1317233331, 424215558, 0, 0], [0, 0, 15056313654, -6963056190, -3646926855, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 19065364250, -1289310318, -18711697704, 0, 0, 0, 0], [-201619619728, 0, 0, 0, 0, 0, 0, 0, -977572638, 34568716, 0, 0], [0, 0, -28125850560, -6605254368, -9844078272, 0, 0, 0, 0, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_25_c_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_25_9_c_c();".
// 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_25_9_c_c(:prec:=12)
    chi := MakeCharacter_25_c();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 9));
    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_25_9_c_c();".
// 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_25_9_c_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_25_c();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,9,sign)));
    Vf := Kernel([<2,R![2985984, 0, 0, 0, 392912788608, 0, 0, 0, 1341657, 0, 0, 0, 1]>],Snew);
    return Vf;
end function;