
// Make newform 405.4.b.e in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_405_b();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_405_b_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_405_4_b_e();".
// 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_405_4_b_e();".
// 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 := [614656, 0, 4069504, 0, 6555196, 0, 2881141, 0, 571975, 0, 59128, 0, 3268, 0, 91, 0, 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, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 19, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [15782656, 0, 22574480, 0, 1226376, 0, -1713581, 0, -370126, 0, -29466, 0, -1022, 0, -13, 0], [17199616, 0, 85224032, 0, 36266220, 0, 5621959, 0, 387218, 0, 11574, 0, 94, 0, -1, 0], [-13692160, 0, -30262848, 0, 8366676, 0, 5902643, 0, 968298, 0, 68574, 0, 2222, 0, 27, 0], [-8294528, 0, -64228384, 0, -73691748, 0, -22981937, 0, -3084622, 0, -200394, 0, -6194, 0, -73, 0], [-833385728, -864930048, -2430051904, -3094154400, -1674133020, -1749552876, -443406929, -399823161, -55246030, -45044382, -3454794, -2626650, -104762, -75642, -1225, -849], [833385728, -864930048, 2430051904, -3094154400, 1674133020, -1749552876, 443406929, -399823161, 55246030, -45044382, 3454794, -2626650, 104762, -75642, 1225, -849], [-11354880, -17007872, -52858752, -49592896, -50432796, -34165980, -14215017, -9049121, -1750686, -1127470, -105210, -70506, -3018, -2138, -33, -25], [0, -100002400, 0, -13608404, 0, -63425913, 0, -25802659, 0, -3850424, 0, -263820, 0, -8407, 0, -101], [-11354880, 17007872, -52858752, 49592896, -50432796, 34165980, -14215017, 9049121, -1750686, 1127470, -105210, 70506, -3018, 2138, -33, 25], [0, 79369792, 0, -1116316120, 0, -1022927202, 0, -295408283, 0, -38436238, 0, -2465730, 0, -75908, 0, -895], [0, -640762624, 0, -1314355088, 0, -689377056, 0, -157923085, 0, -18206894, 0, -1088058, 0, -31990, 0, -365], [0, -475010752, 0, -1030303640, 0, -455445594, 0, -87674005, 0, -8743514, 0, -468198, 0, -12712, 0, -137]];
    Rf_basisdens := [1, 1, 1, 1, 176256, 352512, 117504, 176256, 34546176, 34546176, 705024, 2878848, 705024, 17273088, 5757696, 1016064];
    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_405_b();"
function MakeCharacter_405_b()
    N := 405;
    order := 2;
    char_gens := [326, 82];
    v := [2, 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_405_b_Hecke();"
function MakeCharacter_405_b_Hecke(Kf)
    N := 405;
    order := 2;
    char_gens := [326, 82];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 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 := 4;
    raw_aps := [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0], [-5, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, -1], [0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 1, 1, -1, 0, 0, -1], [0, 0, -1, 0, 1, 0, -1, -2, -1, 1, 1, 0, 1, 0, 0, 0], [0, 0, 0, -1, 0, 0, 0, 0, -1, -1, 2, 1, -2, -3, -1, 1], [28, 0, -7, 0, -1, -1, 1, -1, 0, 0, -2, 0, -2, 0, 0, 0], [1, 0, 0, 0, -2, -5, -2, -1, -4, 4, -2, 0, -2, 0, 0, 0], [0, -23, 0, 6, 0, 0, 0, 0, -6, -6, -1, -7, 1, 1, 2, 0], [-38, 0, -2, 0, 4, -1, 2, -3, 1, -1, 0, 0, 0, 0, 0, 0], [0, 35, 0, 1, 0, 0, 0, 0, -9, -9, -1, -3, 1, 2, 2, 1], [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, 3, 5, -3, 6, 8, 0], [0, -1, 0, -3, 0, 0, 0, 0, 1, 1, 2, -5, -2, -12, 5, 1], [125, 0, -27, 0, -3, 1, -3, -1, 3, -3, -2, 0, -2, 0, 0, 0], [6, 0, -3, 0, 6, 1, 2, -8, -9, 9, 5, 0, 5, 0, 0, 0], [0, -22, 0, -5, 0, 0, 0, 0, -12, -12, 1, 7, -1, -7, 18, 1], [-191, 0, -2, 0, 2, -9, -8, -3, -1, 1, -3, 0, -3, 0, 0, 0], [0, 89, 0, 6, 0, 0, 0, 0, -3, -3, -5, 7, 5, -7, 7, -6], [5, 0, -8, 0, 3, -3, -9, 0, -3, 3, -6, 0, -6, 0, 0, 0], [0, -22, 0, 13, 0, 0, 0, 0, -11, -11, -2, 3, 2, 15, -19, 5], [250, 0, -23, 0, -11, 5, 11, 15, -1, 1, -3, 0, -3, 0, 0, 0], [0, 4, 0, -25, 0, 0, 0, 0, 15, 15, -7, 22, 7, -23, -34, -1], [-441, 0, 8, 0, -5, -1, -1, -14, 1, -1, 5, 0, 5, 0, 0, 0], [0, 160, 0, 15, 0, 0, 0, 0, 12, 12, 6, 8, -6, -5, -7, -9], [0, -25, 0, -11, 0, 0, 0, 0, 9, 9, 3, 34, -3, -6, -26, -15], [-57, 0, 31, 0, -3, 10, 11, -2, 24, -24, -5, 0, -5, 0, 0, 0], [0, 51, 0, -15, 0, 0, 0, 0, 10, 10, 6, 7, -6, 12, 1, 9], [0, 12, 0, -6, 0, 0, 0, 0, 39, 39, -15, -43, 15, 36, -4, 6], [-749, 0, -22, 0, -19, 17, 7, 32, -23, 23, -23, 0, -23, 0, 0, 0], [0, 96, 0, -7, 0, 0, 0, 0, -37, -37, 17, 14, -17, 27, 18, 1], [-197, 0, 57, 0, -15, 23, 1, 5, 45, -45, 14, 0, 14, 0, 0, 0], [287, 0, 43, 0, 7, -20, -19, -14, 3, -3, -25, 0, -25, 0, 0, 0], [184, 0, -24, 0, -21, 2, 1, 11, 48, -48, 17, 0, 17, 0, 0, 0], [0, 21, 0, -15, 0, 0, 0, 0, 78, 78, 22, 1, -22, 6, 1, 9], [0, 308, 0, 17, 0, 0, 0, 0, 63, 63, 26, -12, -26, 17, 19, 17], [0, 67, 0, 9, 0, 0, 0, 0, 45, 45, 18, 2, -18, 24, -7, -15], [0, -80, 0, 0, 0, 0, 0, 0, 51, 51, 21, 38, -21, -48, 14, -18], [215, 0, 156, 0, 8, 51, -8, -7, -59, 59, 4, 0, 4, 0, 0, 0], [4, 0, 7, 0, -5, -47, -11, 11, 119, -119, -6, 0, -6, 0, 0, 0], [-1258, 0, -210, 0, -1, -18, -5, 17, -64, 64, -32, 0, -32, 0, 0, 0], [0, 273, 0, 31, 0, 0, 0, 0, 105, 105, -24, 43, 24, 0, -42, 37], [0, 207, 0, -5, 0, 0, 0, 0, 41, 41, 9, -35, -9, 66, 19, 33], [203, 0, -144, 0, 42, -15, 0, -3, 81, -81, 15, 0, 15, 0, 0, 0], [66, 0, -60, 0, 3, 4, -7, -23, 96, -96, -31, 0, -31, 0, 0, 0], [0, 225, 0, -65, 0, 0, 0, 0, 81, 81, 37, 6, -37, -60, -25, -47], [0, 18, 0, -10, 0, 0, 0, 0, 104, 104, -22, -90, 22, 12, -23, 10], [460, 0, -79, 0, 15, 41, 7, 29, 90, -90, 19, 0, 19, 0, 0, 0], [0, 188, 0, -128, 0, 0, 0, 0, -93, -93, 6, -2, -6, -132, -59, -18], [695, 0, 248, 0, -31, -83, -17, 6, -51, 51, -15, 0, -15, 0, 0, 0], [-185, 0, -4, 0, 27, 26, 19, -7, 99, -99, -2, 0, -2, 0, 0, 0], [-2445, 0, -111, 0, -38, -35, -40, -54, 123, -123, 9, 0, 9, 0, 0, 0], [0, -77, 0, -48, 0, 0, 0, 0, -90, -90, -6, 167, 6, 69, -79, 18], [0, 468, 0, -111, 0, 0, 0, 0, -14, -14, -18, 124, 18, -51, -53, 33], [1245, 0, 223, 0, -3, 14, 45, 26, 0, 0, 58, 0, 58, 0, 0, 0], [439, 0, -232, 0, -4, 147, 28, 53, -71, 71, -18, 0, -18, 0, 0, 0], [0, 472, 0, 39, 0, 0, 0, 0, 12, 12, 37, -88, -37, 73, 137, 33], [-2380, 0, -143, 0, -36, 69, 24, 46, 95, -95, 56, 0, 56, 0, 0, 0], [0, -341, 0, 30, 0, 0, 0, 0, -66, -66, -3, 166, 3, 103, -20, -18], [0, 56, 0, -41, 0, 0, 0, 0, -62, -62, -41, -148, 41, -87, 145, -7], [0, 968, 0, -90, 0, 0, 0, 0, -72, -72, -14, 165, 14, -130, -129, 18], [-2876, 0, -240, 0, 55, -6, 17, -5, -98, 98, 71, 0, 71, 0, 0, 0], [0, -760, 0, 60, 0, 0, 0, 0, 24, 24, -93, -32, 93, 80, -155, 12], [0, -661, 0, 82, 0, 0, 0, 0, 19, 19, -47, -89, 47, 63, -96, -16], [-958, 0, 342, 0, 10, -10, 36, 42, -85, 85, -65, 0, -65, 0, 0, 0], [0, 1012, 0, -85, 0, 0, 0, 0, 39, 39, -17, -94, 17, -263, -108, -1], [0, -129, 0, -75, 0, 0, 0, 0, -47, -47, -21, 153, 21, -198, -12, -87], [943, 0, -9, 0, 16, -44, -44, -49, 50, -50, -32, 0, -32, 0, 0, 0], [0, -645, 0, 36, 0, 0, 0, 0, -188, -188, -18, 155, 18, -75, 113, -78], [3148, 0, -160, 0, 7, -20, -7, 17, 251, -251, -23, 0, -23, 0, 0, 0], [0, 1044, 0, -53, 0, 0, 0, 0, -174, -174, -47, 46, 47, -237, 129, -11], [0, -1011, 0, -181, 0, 0, 0, 0, 66, 66, 50, 113, -50, -180, 81, -25], [192, 0, 189, 0, 14, -22, -28, 73, -110, 110, -119, 0, -119, 0, 0, 0], [0, 340, 0, -159, 0, 0, 0, 0, 240, 240, 45, -90, -45, 297, 195, -9], [2442, 0, 83, 0, -120, 73, 96, 124, 229, -229, -55, 0, -55, 0, 0, 0], [0, 1542, 0, -98, 0, 0, 0, 0, 42, 42, -22, 118, 22, 216, 90, -74], [-3088, 0, -67, 0, 20, -2, -92, -117, -123, 123, 15, 0, 15, 0, 0, 0], [-1373, 0, -161, 0, 83, -81, -83, 65, 85, -85, -77, 0, -77, 0, 0, 0], [3608, 0, -114, 0, -53, 86, 113, 89, -186, 186, -29, 0, -29, 0, 0, 0], [2548, 0, -720, 0, 16, -44, -116, -52, 119, -119, 40, 0, 40, 0, 0, 0], [-3307, 0, 108, 0, -33, 145, 141, 44, 10, -10, 55, 0, 55, 0, 0, 0], [0, -1657, 0, -21, 0, 0, 0, 0, 174, 174, 13, -97, -13, -22, 242, -81], [679, 0, -496, 0, 45, -37, 73, -16, -207, 207, 4, 0, 4, 0, 0, 0], [0, 63, 0, 242, 0, 0, 0, 0, 227, 227, 8, 206, -8, 531, -285, 100], [3880, 0, -513, 0, 14, -74, -104, -53, -424, 424, -4, 0, -4, 0, 0, 0], [0, 1994, 0, 106, 0, 0, 0, 0, 222, 222, -67, -74, 67, 200, -105, 58], [-3042, 0, 113, 0, 77, -201, -167, -191, -146, 146, -55, 0, -55, 0, 0, 0], [0, -1733, 0, -126, 0, 0, 0, 0, -171, -171, 78, 315, -78, -5, -222, -36], [0, 781, 0, -67, 0, 0, 0, 0, 372, 372, 28, 321, -28, -156, -100, -97], [4287, 0, -272, 0, -71, 93, -37, -106, -53, 53, 91, 0, 91, 0, 0, 0], [0, 1267, 0, 350, 0, 0, 0, 0, -222, -222, 3, -211, -3, 127, -264, 146], [-2228, 0, -237, 0, -18, 50, -90, 103, 295, -295, -4, 0, -4, 0, 0, 0], [2476, 0, -21, 0, -206, -218, 46, 47, -1, 1, -134, 0, -134, 0, 0, 0], [0, 69, 0, -197, 0, 0, 0, 0, -526, -526, 57, -70, -57, 96, 59, -63], [4421, 0, -629, 0, 236, 98, -44, 49, -156, 156, 44, 0, 44, 0, 0, 0], [-1482, 0, 346, 0, -71, 69, 89, 248, 387, -387, -47, 0, -47, 0, 0, 0], [0, -659, 0, -141, 0, 0, 0, 0, -132, -132, -46, 20, 46, 274, 11, 33], [2025, 0, -999, 0, -32, -18, -22, -149, 413, -413, 17, 0, 17, 0, 0, 0], [0, 1478, 0, -74, 0, 0, 0, 0, -105, -105, 107, 353, -107, 20, -299, -8], [0, 962, 0, -56, 0, 0, 0, 0, -336, -336, -111, -32, 111, -330, -26, -162], [0, -243, 0, 96, 0, 0, 0, 0, -365, -365, -18, 100, 18, 39, 67, 186], [1553, 0, 589, 0, -139, -103, -113, 43, -343, 343, -109, 0, -109, 0, 0, 0], [1927, 0, -293, 0, -121, 243, 31, 101, -173, 173, -92, 0, -92, 0, 0, 0], [0, 514, 0, 385, 0, 0, 0, 0, 330, 330, -116, -302, 116, -119, 162, -41], [0, -1796, 0, -222, 0, 0, 0, 0, -147, -147, 81, -5, -81, -78, 475, -12], [0, 509, 0, 180, 0, 0, 0, 0, -44, -44, 35, -7, -35, -45, -192, 190], [3335, 0, 258, 0, -99, -71, 219, -100, 285, -285, 151, 0, 151, 0, 0, 0], [-2257, 0, 1079, 0, 13, -289, -21, -201, 431, -431, -15, 0, -15, 0, 0, 0], [0, 2424, 0, -252, 0, 0, 0, 0, -432, -432, 124, 27, -124, -186, 348, 54], [0, -1264, 0, 91, 0, 0, 0, 0, 27, 27, 219, 168, -219, 17, -97, 181], [0, -308, 0, 99, 0, 0, 0, 0, -285, -285, -75, -202, 75, 393, 176, -93], [4050, 0, 201, 0, 161, 362, -91, -74, -296, 296, 318, 0, 318, 0, 0, 0], [-413, 0, 858, 0, 63, -37, 1, 92, -432, 432, 123, 0, 123, 0, 0, 0], [4945, 0, -430, 0, -89, -68, 155, 281, -243, 243, -110, 0, -110, 0, 0, 0], [0, 113, 0, 42, 0, 0, 0, 0, -135, -135, -298, -36, 298, -175, -219, 60], [0, -2801, 0, -409, 0, 0, 0, 0, 72, 72, 94, 278, -94, -330, -197, -25], [0, -1237, 0, -92, 0, 0, 0, 0, 301, 301, 124, 77, -124, -411, -158, -28], [3253, 0, 84, 0, 57, -277, -117, 148, 465, -465, -151, 0, -151, 0, 0, 0], [-4354, 0, 1164, 0, -38, -400, 24, -30, 113, -113, -149, 0, -149, 0, 0, 0], [0, 419, 0, 122, 0, 0, 0, 0, 171, 171, -92, 285, 92, 227, -14, -202], [0, 3207, 0, 264, 0, 0, 0, 0, -443, -443, 126, 169, -126, -159, -152, 132], [0, 427, 0, 11, 0, 0, 0, 0, 396, 396, 70, -285, -70, 708, -136, 185], [5299, 0, -1052, 0, -109, 45, 217, -52, -611, 611, -47, 0, -47, 0, 0, 0], [5120, 0, 385, 0, -132, 9, -288, -134, 238, -238, -103, 0, -103, 0, 0, 0], [-1788, 0, -333, 0, -133, 149, 191, 367, 82, -82, -201, 0, -201, 0, 0, 0], [3260, 0, 400, 0, 230, -352, 46, -38, -338, 338, -268, 0, -268, 0, 0, 0], [0, 614, 0, 68, 0, 0, 0, 0, -882, -882, -17, 615, 17, 44, -296, 68], [0, 1236, 0, 458, 0, 0, 0, 0, -207, -207, 152, -60, -152, 270, 16, -82], [-5299, 0, -623, 0, -67, 193, 63, 111, -938, 938, 83, 0, 83, 0, 0, 0], [0, 2643, 0, -276, 0, 0, 0, 0, 148, 148, 3, -34, -3, 411, 434, -234], [1011, 0, -466, 0, -160, -73, -190, 31, -770, 770, 131, 0, 131, 0, 0, 0], [0, 3000, 0, -389, 0, 0, 0, 0, -213, -213, -100, 266, 100, 165, 37, 271], [4009, 0, 1415, 0, -282, 330, 360, 371, 136, -136, -278, 0, -278, 0, 0, 0], [6121, 0, -233, 0, 218, 186, -8, -217, 148, -148, 82, 0, 82, 0, 0, 0], [0, -1778, 0, 8, 0, 0, 0, 0, -570, -570, 130, 542, -130, -258, 178, -304], [0, 1084, 0, -339, 0, 0, 0, 0, -882, -882, 309, -270, -309, -599, 441, -177], [0, -4713, 0, -388, 0, 0, 0, 0, 227, 227, 260, 493, -260, -543, 788, -140], [3866, 0, -291, 0, 126, -80, -144, -565, -26, 26, 214, 0, 214, 0, 0, 0], [2262, 0, -1785, 0, -2, -264, -328, -35, -592, 592, -139, 0, -139, 0, 0, 0], [6686, 0, 439, 0, 372, 369, -120, -356, 341, -341, 257, 0, 257, 0, 0, 0], [0, 2742, 0, 182, 0, 0, 0, 0, -1326, -1326, 74, -155, -74, 186, 134, 152], [0, 1994, 0, 312, 0, 0, 0, 0, -755, -755, -7, 527, 7, -198, -90, 214], [1406, 0, -291, 0, 138, 81, -228, -408, -180, 180, -54, 0, -54, 0, 0, 0], [2837, 0, 448, 0, -52, 155, 364, 157, -292, 292, -40, 0, -40, 0, 0, 0], [0, 89, 0, 82, 0, 0, 0, 0, 99, 99, 233, 633, -233, -871, 200, -116], [0, -3156, 0, -691, 0, 0, 0, 0, -232, -232, 41, 352, -41, -93, -967, -137], [2786, 0, 7, 0, 207, -366, -201, -66, -852, 852, 240, 0, 240, 0, 0, 0], [0, 1813, 0, -43, 0, 0, 0, 0, 420, 420, -71, -454, 71, -330, 505, -157], [0, -1710, 0, 739, 0, 0, 0, 0, 462, 462, -252, -16, 252, 351, -401, -221], [10441, 0, 501, 0, 293, 64, -11, -134, -148, 148, 83, 0, 83, 0, 0, 0], [0, 1783, 0, 646, 0, 0, 0, 0, -528, -528, 55, -88, -55, -377, 373, -26], [0, 144, 0, 131, 0, 0, 0, 0, -370, -370, -4, 340, 4, 555, -661, 223], [0, 2503, 0, -58, 0, 0, 0, 0, -795, -795, 2, -38, -2, 667, 473, -124], [1158, 0, 988, 0, 22, -888, -454, -382, -335, 335, 52, 0, 52, 0, 0, 0], [6011, 0, 1614, 0, -135, -327, -231, -48, -432, 432, 12, 0, 12, 0, 0, 0], [10708, 0, -2164, 0, -126, -258, -12, 236, 171, -171, -161, 0, -161, 0, 0, 0], [0, -823, 0, -17, 0, 0, 0, 0, 405, 405, 399, 807, -399, -892, 587, -35], [8836, 0, -65, 0, 35, 303, -83, 273, -464, 464, 258, 0, 258, 0, 0, 0], [0, 5210, 0, 865, 0, 0, 0, 0, 694, 694, -353, -213, 353, -21, -76, -301], [0, 1370, 0, -578, 0, 0, 0, 0, 387, 387, -438, 736, 438, -708, -503, 48], [0, -2814, 0, 607, 0, 0, 0, 0, -477, -477, -564, -1041, 564, 231, 407, 337], [-1725, 0, 1114, 0, 270, 467, -90, 401, -237, 237, 94, 0, 94, 0, 0, 0], [0, 6810, 0, 18, 0, 0, 0, 0, -434, -434, -213, 738, 213, 36, 381, -354], [0, 1256, 0, -443, 0, 0, 0, 0, 151, 151, -212, 201, 212, 303, 191, -505], [-3972, 0, 460, 0, -264, -488, 32, -152, -744, 744, -320, 0, -320, 0, 0, 0], [0, -1937, 0, -127, 0, 0, 0, 0, 462, 462, -43, -1783, 43, -944, 789, 227]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_405_b_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_405_4_b_e();".
// 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_405_4_b_e(:prec:=16)
    chi := MakeCharacter_405_b();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 4));
    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_405_4_b_e();".
// 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_405_4_b_e( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_405_b();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![614656, 0, 4069504, 0, 6555196, 0, 2881141, 0, 571975, 0, 59128, 0, 3268, 0, 91, 0, 1]>,<11,R![137637673416, -26757336852, -809472312, 158752116, 4235328, -160551, -3975, 45, 1]>],Snew);
    return Vf;
end function;