
// Make newform 900.3.f.f in Magma, downloaded from the LMFDB on 13 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_900_f();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_900_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_900_3_f_f();".
// 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_900_3_f_f();".
// 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 := [256, 0, 320, 0, 192, 0, 100, 0, 53, 0, 25, 0, 12, 0, 5, 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], [2240, 0, 1184, 0, 1512, 0, 35, 0, 467, 0, 96, 0, 115, 0, 11, 0], [-6144, 0, -5584, 0, -2156, 0, -1179, 0, -807, 0, -196, 0, -139, 0, -47, 0], [-28736, 0, -20192, 0, -11736, 0, -5959, 0, -2407, 0, -1136, 0, -471, 0, -127, 0], [-2816, 0, -2040, 0, -1650, 0, -861, 0, -339, 0, -74, 0, -93, 0, -35, 0], [-36672, 0, -24960, 0, -12016, 0, -7603, 0, -3675, 0, -1576, 0, -835, 0, -179, 0], [0, -19008, 0, -17152, 0, -10064, 0, -5541, 0, -2749, 0, -984, 0, -661, 0, -165], [0, -17472, 0, -10816, 0, -7568, 0, -2021, 0, -1469, 0, -536, 0, -213, 0, -101], [-7040, 0, -6088, 0, -2662, 0, -1497, 0, -667, 0, -318, 0, -185, 0, -59, 0], [0, 9152, 0, 7200, 0, 3168, 0, 1815, 0, 1135, 0, 440, 0, 231, 0, 71], [24064, 0, 20832, 0, 10376, 0, 5259, 0, 3099, 0, 1344, 0, 603, 0, 211, 0], [0, 36032, 0, 17152, 0, 6416, 0, 7631, 0, 3319, 0, 680, 0, 927, 0, 431], [0, 1344, 0, -17408, 0, -9520, 0, -5679, 0, -3383, 0, -1736, 0, -767, 0, -495], [0, -87104, 0, -63360, 0, -23440, 0, -14509, 0, -6853, 0, -3416, 0, -2333, 0, -621], [0, -104768, 0, -100352, 0, -44848, 0, -24817, 0, -12681, 0, -5528, 0, -2849, 0, -977], [0, 65344, 0, 50816, 0, 25168, 0, 14093, 0, 6757, 0, 3352, 0, 1661, 0, 525]];
    Rf_basisdens := [1, 2432, 1216, 2432, 608, 2432, 9728, 4864, 608, 2432, 1216, 9728, 9728, 9728, 9728, 4864];
    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_900_f();"
function MakeCharacter_900_f()
    N := 900;
    order := 2;
    char_gens := [451, 101, 577];
    v := [1, 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_900_f_Hecke();"
function MakeCharacter_900_f_Hecke(Kf)
    N := 900;
    order := 2;
    char_gens := [451, 101, 577];
    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], [-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 := 3;
    raw_aps := [[0, 0, 0, 0, 0, 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, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0], [-1, 2, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 2, 0, 2, 0, -1, -2, 0, 0, -2], [0, 0, 0, 0, 0, 0, 3, 1, 0, 2, 0, 0, 1, 1, 3, 3], [-1, -2, 0, 0, -3, 2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -4, -2, 0, 0, 0, -1, -2, 2, 3, -3], [10, -5, -6, 2, -2, -4, 0, 0, 3, 0, 2, 0, 0, 0, 0, 0], [-7, 4, -2, -2, -1, 2, 0, 0, 5, 0, -5, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 5, 4, 0, 12, 0, -1, 0, 2, 8, 6], [0, 0, 0, 0, 2, 4, 0, 0, -2, 0, -2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -4, 7, 0, 0, 0, -1, 7, 3, -7, 7], [0, 0, 0, 0, 0, 0, -4, 2, 0, 0, 0, -1, 2, -4, 5, -5], [0, 0, 0, 0, 0, 0, -1, -4, 0, -24, 0, 2, 4, 0, -1, 3], [5, -6, 0, 0, -1, -5, 0, 0, -5, 0, 0, 0, 0, 0, 0, 0], [-20, -10, -12, 4, -2, -4, 0, 0, 4, 0, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -8, 9, 0, 0, 0, 1, 9, -1, 1, -1], [2, 0, 0, 0, 2, 6, 0, 0, -2, 0, 8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 18, 8, 0, -5, 0, -2, 0, 4, 8, 4], [3, 14, 4, 4, 13, -6, 0, 0, 1, 0, -3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -4, 5, 0, 0, 0, 5, 5, -5, 9, -9], [8, -22, 0, 0, 2, 4, 0, 0, 20, 0, -2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -24, -2, 0, -37, 0, -2, -10, -6, -10, -14], [28, -9, -12, 4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -20, 4, 0, 0, 0, -7, 4, 1, 8, -8], [0, 0, 0, 0, 0, 0, -20, 7, 0, 0, 0, 1, 7, 13, 1, -1], [-42, -14, -24, 8, -4, -8, 0, 0, 2, 0, 4, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 31, 15, 0, 36, 0, -4, -1, 7, 15, 7], [0, 0, 0, 0, 0, 0, 12, -10, 0, 0, 0, 1, -10, 5, -6, 6], [1, -8, 6, 6, -13, -9, 0, 0, 5, 0, -8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -19, 3, 0, -32, 0, -4, -13, -5, -7, -15], [23, -14, 28, 28, -19, -12, 0, 0, 5, 0, 11, 0, 0, 0, 0, 0], [-82, -3, -6, 2, -2, -4, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0], [3, 4, -6, -6, 13, 8, 0, 0, -9, 0, 11, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -57, -8, 0, -10, 0, 1, -4, -6, 20, 22], [0, 0, 0, 0, 0, 0, -20, 7, 0, 0, 0, 15, 7, 25, 3, -3], [0, 0, 0, 0, 0, 0, 12, -8, 0, 0, 0, -17, -8, -12, -9, 9], [0, 0, 0, 0, 0, 0, 67, 14, 0, 28, 0, -2, 6, 10, -5, -9], [11, 14, 8, 8, 17, -25, 0, 0, -3, 0, -14, 0, 0, 0, 0, 0], [-90, -18, 12, -4, 8, 16, 0, 0, 18, 0, -8, 0, 0, 0, 0, 0], [-12, 22, -10, -10, 20, -2, 0, 0, 2, 0, -14, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 14, 6, 0, -77, 0, 0, 6, 6, 22, 22], [0, 0, 0, 0, 0, 0, 37, 6, 0, 80, 0, 0, 6, 6, -1, -1], [-45, 30, -20, -20, 5, 28, 0, 0, 25, 0, -17, 0, 0, 0, 0, 0], [31, -24, 26, 26, -19, 0, 0, 0, -5, 0, 31, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 28, -26, 0, 0, 0, 5, -26, -21, 24, -24], [0, 0, 0, 0, 0, 0, 40, -5, 0, 0, 0, 23, -5, 3, -15, 15], [-28, -12, -48, 16, 6, 12, 0, 0, -26, 0, -6, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -59, -11, 0, -58, 0, 0, -11, -11, -7, -7], [2, 10, 10, 10, 2, 22, 0, 0, 8, 0, 24, 0, 0, 0, 0, 0], [30, 4, -48, 16, 4, 8, 0, 0, -40, 0, -4, 0, 0, 0, 0, 0], [31, -10, 28, 28, -7, -41, 0, 0, -3, 0, -10, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 21, -23, 0, 24, 0, 12, 25, 1, -27, -3], [0, 0, 0, 0, 0, 0, -12, 52, 0, 0, 0, 47, 52, 20, -13, 13], [-150, 31, -6, 2, 6, 12, 0, 0, -41, 0, -6, 0, 0, 0, 0, 0], [-33, 48, -10, -10, 25, 12, 0, 0, 23, 0, -21, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -15, -16, 0, 12, 0, 5, 4, -6, -26, -16], [66, 4, -18, 6, 8, 16, 0, 0, -24, 0, -8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -48, 49, 0, 0, 0, 13, 49, 23, -11, 11], [0, 0, 0, 0, 0, 0, -5, 2, 0, 24, 0, -4, -14, -6, -27, -35], [0, 0, 0, 0, 0, 0, 60, 5, 0, 0, 0, 43, 5, -3, -19, 19], [-16, -20, 0, 0, -36, 34, 0, 0, 16, 0, 18, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 30, -22, 0, 91, 0, 16, 42, 10, 14, 46], [0, 0, 0, 0, 0, 0, 17, -30, 0, 60, 0, 16, 34, 2, -21, 11], [-75, 24, -26, -26, -25, 34, 0, 0, 49, 0, -41, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 18, 0, 0, -39, 0, 2, 8, 4, 4, 8], [0, 0, 0, 0, 0, 0, 24, -11, 0, 0, 0, 23, -11, 1, 9, -9], [-136, 82, 60, -20, 6, 12, 0, 0, -48, 0, -6, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 65, -19, 0, 18, 0, 16, 45, 13, -3, 29], [122, -102, 90, 90, -70, -52, 0, 0, -32, 0, 70, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -24, 30, 0, 0, 0, 11, 30, 21, -16, 16], [0, 0, 0, 0, 0, 0, -43, 44, 0, 30, 0, -21, -40, 2, 76, 34], [33, -10, 12, 12, 11, 16, 0, 0, -21, 0, 49, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 52, -8, 0, 0, 0, 43, -8, 14, -15, 15], [-120, -5, 0, 0, 24, 48, 0, 0, -19, 0, -24, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -3, 14, 0, 152, 0, -3, 2, 8, 54, 48], [112, 64, 42, -14, -10, -20, 0, 0, -26, 0, 10, 0, 0, 0, 0, 0], [90, 4, 60, -20, -4, -8, 0, 0, 40, 0, 4, 0, 0, 0, 0, 0], [-9, 16, -34, -34, 41, -39, 0, 0, -25, 0, -48, 0, 0, 0, 0, 0], [-24, 64, -12, 4, -10, -20, 0, 0, -62, 0, 10, 0, 0, 0, 0, 0], [28, 4, 24, 24, 8, 24, 0, 0, -4, 0, 52, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -106, 0, 0, 39, 0, -10, -40, -20, -4, -24], [-21, -10, -28, -28, -3, -48, 0, 0, -7, 0, -69, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 32, -53, 0, 0, 0, -33, -53, -77, 65, -65], [-70, 46, 96, -32, -20, -40, 0, 0, 38, 0, 20, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -52, 18, 0, -73, 0, -22, -70, -26, -82, -126], [10, 47, 18, -6, -6, -12, 0, 0, -29, 0, 6, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -24, -10, 0, 0, 0, -77, -10, -83, 40, -40], [0, 0, 0, 0, 0, 0, -60, -1, 0, 0, 0, -35, -1, 1, 25, -25], [-40, 10, -18, -18, -12, 22, 0, 0, 22, 0, -18, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -60, -8, 0, 0, 0, -67, -8, -7, 8, -8], [51, -48, -38, -38, 41, -17, 0, 0, -89, 0, 34, 0, 0, 0, 0, 0], [45, -118, 40, 40, -113, 34, 0, 0, -5, 0, 79, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -44, -8, 0, 0, 0, -13, -8, 50, -11, 11], [132, 37, 72, -24, -16, -32, 0, 0, 27, 0, 16, 0, 0, 0, 0, 0], [50, -54, -36, 12, 8, 16, 0, 0, 22, 0, -8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 48, 51, 0, 0, 0, 49, 51, -23, -27, 27], [82, 34, 72, -24, 20, 40, 0, 0, -6, 0, -20, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 28, 11, 0, 0, 0, 39, 11, 11, -11, 11], [0, 0, 0, 0, 0, 0, 77, 18, 0, -4, 0, 6, 42, 30, 97, 109], [0, 0, 0, 0, 0, 0, -24, 37, 0, 0, 0, 23, 37, -11, 21, -21], [748, -12, -18, 6, -18, -36, 0, 0, 18, 0, 18, 0, 0, 0, 0, 0], [97, -96, -26, -26, 27, -78, 0, 0, -123, 0, 19, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -168, -66, 0, -309, 0, 26, 38, -14, 58, 110], [0, 0, 0, 0, 0, 0, 20, 67, 0, 0, 0, 17, 67, -15, -55, 55], [0, 0, 0, 0, 0, 0, -213, 11, 0, -136, 0, -28, -101, -45, -29, -85], [102, -158, 50, 50, -106, -64, 0, 0, -52, 0, 38, 0, 0, 0, 0, 0], [-66, 96, 84, -28, 52, 104, 0, 0, -92, 0, -52, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 8, 50, 0, 0, 0, 95, 50, 99, -62, 62], [0, 0, 0, 0, 0, 0, -217, -70, 0, -76, 0, 23, 22, -24, 50, 96], [0, 0, 0, 0, 0, 0, -97, 15, 0, -258, 0, -12, -33, -9, 55, 31], [-25, -10, -80, -80, 45, 40, 0, 0, -55, 0, 15, 0, 0, 0, 0, 0], [-45, 12, -22, -22, -11, -14, 0, 0, 23, 0, -59, 0, 0, 0, 0, 0], [-98, -54, 54, -18, -8, -16, 0, 0, 98, 0, 8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -100, -13, 0, 0, 0, 31, -13, 101, 43, -43], [0, 0, 0, 0, 0, 0, -100, 132, 0, 0, 0, 55, 132, 66, -43, 43], [0, 0, 0, 0, 0, 0, -165, -20, 0, -80, 0, -8, -52, -36, -43, -59], [55, -90, -40, -40, 5, -47, 0, 0, -95, 0, 8, 0, 0, 0, 0, 0], [420, 58, 24, -8, 6, 12, 0, 0, -48, 0, -6, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 130, -68, 0, 59, 0, 30, 52, -8, -208, -148], [0, 0, 0, 0, 0, 0, 157, 68, 0, 384, 0, -24, -28, 20, -13, -61], [0, 0, 0, 0, 0, 0, 12, -1, 0, 0, 0, -59, -1, -51, -19, 19], [-11, 100, 26, 26, 63, 66, 0, 0, 37, 0, 55, 0, 0, 0, 0, 0], [-232, -197, -168, 56, -36, -72, 0, 0, 121, 0, 36, 0, 0, 0, 0, 0], [220, -124, -36, 12, -42, -84, 0, 0, 142, 0, 42, 0, 0, 0, 0, 0], [-50, -12, -56, -56, -6, 84, 0, 0, -6, 0, 34, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 36, -80, 0, 0, 0, -7, -80, -19, 56, -56], [0, 0, 0, 0, 0, 0, -157, -4, 0, -160, 0, -1, -8, -6, 122, 120], [53, -34, 60, 60, -41, -126, 0, 0, 7, 0, -73, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 116, 66, 0, 0, 0, 151, 66, 84, -115, 115], [29, -80, -6, -6, -45, 98, 0, 0, -35, 0, 127, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 17, 16, 0, -28, 0, -23, -76, -30, -174, -220], [-26, 218, 144, -48, 4, 8, 0, 0, -126, 0, -4, 0, 0, 0, 0, 0], [374, 176, 24, -8, -8, -16, 0, 0, -152, 0, 8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 63, 34, 0, 388, 0, -4, 18, 26, 97, 89], [0, 0, 0, 0, 0, 0, -128, 27, 0, 0, 0, -59, 27, 5, 37, -37], [0, 0, 0, 0, 0, 0, -227, -30, 0, 300, 0, -2, -38, -34, 25, 21], [662, -198, -42, 14, 44, 88, 0, 0, 126, 0, -44, 0, 0, 0, 0, 0], [-181, 128, -134, -134, 81, 156, 0, 0, 47, 0, -25, 0, 0, 0, 0, 0], [278, 133, 42, -14, -22, -44, 0, 0, -83, 0, 22, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -76, 96, 0, 0, 0, -7, 96, -37, 10, -10], [0, 0, 0, 0, 0, 0, -128, 91, 0, 0, 0, 15, 91, 119, -67, 67], [-262, -10, -36, 12, 32, 64, 0, 0, -46, 0, -32, 0, 0, 0, 0, 0], [54, 6, 110, 110, -50, 8, 0, 0, 56, 0, 62, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -361, -70, 0, 28, 0, 3, -58, -64, -26, -20], [0, 0, 0, 0, 0, 0, -209, -35, 0, -418, 0, 0, -35, -35, -1, -1], [-87, 26, 0, 0, -61, -8, 0, 0, 87, 0, -95, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 92, 18, 0, 0, 0, 31, 18, -82, 3, -3], [0, 0, 0, 0, 0, 0, -45, 28, 0, 178, 0, -19, -48, -10, 4, -34], [-332, -250, -288, 96, 26, 52, 0, 0, 32, 0, -26, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 92, -17, 0, 0, 0, 3, -17, -51, -21, 21], [0, 0, 0, 0, 0, 0, 244, -28, 0, 0, 0, 167, -28, 12, -61, 61], [0, 0, 0, 0, 0, 0, 80, -53, 0, 0, 0, -79, -53, -53, -53, 53], [-122, 72, -104, -104, 54, 20, 0, 0, 18, 0, -102, 0, 0, 0, 0, 0], [9, 18, 92, 92, -65, -14, 0, 0, 83, 0, -5, 0, 0, 0, 0, 0], [-126, 290, 60, -20, 4, 8, 0, 0, -254, 0, -4, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -188, -80, 0, -301, 0, 24, 16, -32, -28, 20], [1216, 65, 60, -20, 16, 32, 0, 0, -41, 0, -16, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 56, -159, 0, 0, 0, -133, -159, -151, 121, -121], [0, 0, 0, 0, 0, 0, 23, -119, 0, -108, 0, 72, 169, 25, 55, 199], [0, 0, 0, 0, 0, 0, -28, 8, 0, 0, 0, 1, 8, -41, 62, -62], [175, -70, 160, 160, -55, 39, 0, 0, -15, 0, 214, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -473, -143, 0, -450, 0, 24, -47, -95, -121, -73], [0, 0, 0, 0, 0, 0, -52, -110, 0, 0, 0, -81, -110, -40, 121, -121], [193, -168, 98, 98, -73, -104, 0, 0, -95, 0, 89, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 27, -130, 0, 198, 0, 55, 90, -20, -202, -92]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_900_f_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_900_3_f_f();".
// 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_900_3_f_f(:prec:=16)
    chi := MakeCharacter_900_f();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 3));
    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_900_3_f_f();".
// 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_900_3_f_f( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_900_f();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<7,R![65536, 0, -188416, 0, 12032, 0, -224, 0, 1]>,<29,R![1334416, 34688, -2152, -32, 1]>],Snew);
    return Vf;
end function;