
// Make newform 2736.3.o.n in Magma, downloaded from the LMFDB on 24 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_2736_o();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_2736_o_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_2736_3_o_n();".
// 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_2736_3_o_n();".
// 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 := [2628, 1320, -1022, -568, 215, 80, -22, -4, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [-36, -108, 88, 39, -17, -3, 1, 0], [141048, 43908, -48322, -8574, 5735, 447, -316, 21], [-22482, 58884, -14624, -6602, 5536, -491, -443, 85], [-1097676, -450156, 298294, 98488, -24725, -5399, 157, 163], [-106308, 192396, 71114, -25468, -13711, 3341, 863, -205], [-9900, 15792, 11572, -6224, -2180, 760, 112, -32], [-19476, 30864, 23324, -12457, -4495, 1511, 287, -82]];
    Rf_basisdens := [1, 45, 4365, 13095, 26190, 26190, 2619, 4365];
    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_2736_o();"
function MakeCharacter_2736_o()
    N := 2736;
    order := 2;
    char_gens := [1711, 2053, 1217, 1009];
    v := [2, 2, 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_2736_o_Hecke();"
function MakeCharacter_2736_o_Hecke(Kf)
    N := 2736;
    order := 2;
    char_gens := [1711, 2053, 1217, 1009];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [-1, 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, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [-1, -1, 0, -1, 0, 0, 0, 0], [1, 0, 0, -1, 0, 0, 0, 0], [1, 0, 0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0, -1, -1], [-1, 1, 0, -1, 0, 0, 0, 0], [5, 1, -1, 0, 0, -1, 0, -1], [-8, 1, 0, -3, 0, -1, 0, 0], [0, 0, -1, 0, 1, 0, 2, -2], [0, 0, -2, 0, 0, 0, -1, 0], [0, 0, 0, 0, 0, 0, -5, -2], [0, 0, 3, 0, 1, 0, -5, 1], [-11, -4, 0, 1, 0, -2, 0, 0], [-23, 2, 0, 0, 0, -1, 0, 0], [0, 0, -5, 0, 1, 0, -3, 1], [0, 0, 2, 0, 2, 0, 3, 7], [-19, 8, 0, 5, 0, -2, 0, 0], [0, 0, 0, 0, -2, 0, 2, -7], [0, 0, 2, 0, 2, 0, -9, 1], [-43, -2, 0, 5, 0, 2, 0, 0], [0, 0, 6, 0, -2, 0, -12, 9], [16, -11, 0, -3, 0, -1, 0, 0], [0, 0, -3, 0, -1, 0, 11, -3], [0, 0, 0, 0, -4, 0, -3, -3], [38, -16, 0, 0, 0, 4, 0, 0], [0, 0, 0, 0, 4, 0, 2, -4], [0, 0, 0, 0, 4, 0, 4, -4], [0, 0, -4, 0, 0, 0, 4, 3], [0, 0, -5, 0, 5, 0, 4, 0], [0, 0, 0, 0, 2, 0, 8, 17], [-23, -22, 0, 0, 0, -1, 0, 0], [-1, -17, 0, 3, 0, -8, 0, 0], [73, -16, 0, 15, 0, 4, 0, 0], [-25, 33, 0, 15, 0, 4, 0, 0], [0, 0, 10, 0, -2, 0, 11, -3], [14, 16, 0, 18, 0, -4, 0, 0], [10, -34, 0, 0, 0, -2, 0, 0], [0, 0, -10, 0, -6, 0, -8, -9], [0, 0, 15, 0, 1, 0, 10, 11], [0, 0, 10, 0, 2, 0, -8, -3], [0, 0, -6, 0, 2, 0, -6, -18], [49, -18, 0, 20, 0, -5, 0, 0], [0, 0, 10, 0, -2, 0, 10, -13], [134, 32, 0, 0, 0, -8, 0, 0], [-59, -16, 0, -35, 0, -2, 0, 0], [0, 0, -16, 0, -6, 0, 15, 11], [0, 0, -20, 0, 4, 0, 27, -20], [0, 0, -10, 0, 2, 0, 9, -5], [-7, -36, 0, -5, 0, -6, 0, 0], [-1, 21, 0, 27, 0, -8, 0, 0], [61, 36, 0, -10, 0, -11, 0, 0], [0, 0, 14, 0, 6, 0, -9, -10], [109, 10, 0, -10, 0, -11, 0, 0], [0, 0, 25, 0, -1, 0, -14, 27], [265, -8, 0, -16, 0, 7, 0, 0], [0, 0, -9, 0, -3, 0, -9, -15], [-26, -36, 0, -30, 0, -12, 0, 0], [-103, 0, 0, -41, 0, -6, 0, 0], [0, 0, -1, 0, -7, 0, 24, -15], [-59, 64, 0, 29, 0, 2, 0, 0], [0, 0, 5, 0, 3, 0, -56, -17], [0, 0, -10, 0, 6, 0, 22, 27], [-83, 4, 0, 10, 0, -15, 0, 0], [230, 40, 0, -6, 0, -4, 0, 0], [0, 0, -5, 0, 1, 0, 15, -24], [0, 0, -18, 0, -10, 0, -12, -9], [0, 0, -20, 0, 0, 0, -11, 29], [-23, 34, 0, 52, 0, 3, 0, 0], [-7, 10, 0, 35, 0, -10, 0, 0], [62, 20, 0, -36, 0, 4, 0, 0], [109, 52, 0, 70, 0, -3, 0, 0], [-50, -36, 0, -42, 0, 24, 0, 0], [0, 0, 20, 0, 8, 0, -14, 30], [0, 0, 12, 0, 8, 0, -26, -32], [0, 0, -20, 0, 0, 0, -7, 26], [-49, -43, 0, -5, 0, 8, 0, 0], [-223, -18, 0, 3, 0, 6, 0, 0], [0, 0, 1, 0, -1, 0, 28, -18], [0, 0, -18, 0, -2, 0, 5, -34], [268, 43, 0, 15, 0, -7, 0, 0], [0, 0, -2, 0, 2, 0, 57, -20], [0, 0, 2, 0, 6, 0, 31, 13], [0, 0, 10, 0, -10, 0, -20, -13], [0, 0, 10, 0, 18, 0, 8, 3], [-191, -62, 0, -56, 0, -9, 0, 0], [0, 0, -25, 0, 9, 0, -8, -7], [245, 90, 0, 45, 0, -30, 0, 0], [-1, -23, 0, 35, 0, 0, 0, 0], [13, -32, 0, -7, 0, -22, 0, 0], [277, -34, 0, -38, 0, 9, 0, 0], [364, -17, 0, 75, 0, 5, 0, 0], [0, 0, 0, 0, 10, 0, -57, -3], [172, -5, 0, -45, 0, -19, 0, 0], [289, 40, 0, 55, 0, -4, 0, 0], [-332, 43, 0, 39, 0, 17, 0, 0], [0, 0, -19, 0, 7, 0, 59, -16], [0, 0, -1, 0, 9, 0, -44, -16], [0, 0, 10, 0, -24, 0, -30, 10], [77, -42, 0, 45, 0, 42, 0, 0], [0, 0, -10, 0, -22, 0, 7, -3], [-553, -33, 0, -41, 0, 20, 0, 0], [0, 0, 0, 0, 8, 0, 77, -12], [0, 0, 31, 0, -19, 0, -47, 18], [334, -36, 0, 30, 0, -12, 0, 0], [-379, 120, 0, 13, 0, 6, 0, 0], [-443, 58, 0, 26, 0, 1, 0, 0], [14, 68, 0, -24, 0, 4, 0, 0], [0, 0, 46, 0, -18, 0, -46, 19], [0, 0, -6, 0, 18, 0, -57, 27], [0, 0, -40, 0, -2, 0, 61, -45], [53, -100, 0, 29, 0, -2, 0, 0], [-49, 63, 0, 55, 0, 8, 0, 0], [202, -22, 0, -120, 0, 22, 0, 0], [-335, 76, 0, 55, 0, 8, 0, 0], [0, 0, 43, 0, 17, 0, 61, 72], [-395, 8, 0, 13, 0, -14, 0, 0], [-155, 90, 0, -66, 0, -19, 0, 0], [-385, -93, 0, -89, 0, 20, 0, 0], [0, 0, -4, 0, -4, 0, -24, 42], [0, 0, -24, 0, 4, 0, 18, -18], [0, 0, 70, 0, -18, 0, -17, 17], [0, 0, -55, 0, -1, 0, 78, -2], [0, 0, -30, 0, -6, 0, -27, -41], [253, 12, 0, 45, 0, 18, 0, 0], [326, -88, 0, 60, 0, 40, 0, 0], [134, -144, 0, -90, 0, 12, 0, 0], [-323, 82, 0, 50, 0, 49, 0, 0], [-731, -12, 0, -15, 0, -30, 0, 0], [350, -108, 0, -18, 0, -36, 0, 0], [145, -112, 0, 75, 0, 16, 0, 0], [0, 0, -70, 0, 18, 0, 58, -59], [0, 0, -4, 0, -8, 0, -14, 30], [-367, -20, 0, 27, 0, 50, 0, 0], [119, -43, 0, 55, 0, -28, 0, 0], [389, 24, 0, -35, 0, -42, 0, 0], [0, 0, 15, 0, -3, 0, 93, -32], [0, 0, 50, 0, 4, 0, 24, -4], [0, 0, -5, 0, 37, 0, -6, -10], [887, 101, 0, -5, 0, 8, 0, 0], [0, 0, -38, 0, 30, 0, -49, 15], [-385, -57, 0, -5, 0, 32, 0, 0], [529, -28, 0, -93, 0, -20, 0, 0], [0, 0, -50, 0, -6, 0, 68, -11], [0, 0, -22, 0, -38, 0, -12, 8], [0, 0, -8, 0, 8, 0, -98, -38], [122, 180, 0, 132, 0, -24, 0, 0], [0, 0, -75, 0, -1, 0, 71, -68], [217, 52, 0, -5, 0, 32, 0, 0], [0, 0, -20, 0, -4, 0, -89, -26], [0, 0, 40, 0, 4, 0, 2, -24], [-769, 67, 0, 15, 0, -20, 0, 0], [-47, -132, 0, -13, 0, 24, 0, 0], [0, 0, 10, 0, 14, 0, -17, -7], [0, 0, -10, 0, 40, 0, -75, -22], [0, 0, 92, 0, 0, 0, -68, 58], [514, 122, 0, 0, 0, 10, 0, 0], [302, 44, 0, 120, 0, -8, 0, 0], [-343, -42, 0, -69, 0, 6, 0, 0], [0, 0, -95, 0, 7, 0, 30, -39], [-632, 73, 0, 9, 0, -13, 0, 0], [0, 0, 85, 0, 3, 0, -82, 0], [250, 194, 0, 60, 0, 22, 0, 0], [0, 0, -40, 0, 0, 0, 76, -62], [0, 0, -55, 0, -13, 0, 21, -93], [0, 0, -20, 0, 24, 0, -46, -4], [0, 0, -6, 0, -12, 0, 35, -22], [-235, -92, 0, -3, 0, 62, 0, 0], [0, 0, -12, 0, 20, 0, -36, 75], [-433, -3, 0, -9, 0, 28, 0, 0], [0, 0, -12, 0, 0, 0, 3, -128], [0, 0, 108, 0, -12, 0, -39, 30], [-428, 139, 0, 75, 0, 5, 0, 0], [-286, 124, 0, 132, 0, 56, 0, 0], [0, 0, -32, 0, 18, 0, -95, -43], [-649, 21, 0, 75, 0, -68, 0, 0], [-86, -106, 0, -60, 0, -14, 0, 0], [143, -71, 0, 95, 0, 24, 0, 0], [0, 0, -110, 0, 4, 0, 34, -34], [17, -58, 0, -65, 0, -26, 0, 0], [-11, -192, 0, -3, 0, -42, 0, 0], [0, 0, -18, 0, -38, 0, -41, 5], [0, 0, 70, 0, 14, 0, 16, 152], [0, 0, -35, 0, -25, 0, -107, 12], [-167, -196, 0, -32, 0, -9, 0, 0], [-793, 183, 0, 115, 0, 20, 0, 0], [0, 0, -10, 0, -26, 0, -42, -22], [0, 0, 20, 0, 2, 0, -109, 31], [0, 0, 76, 0, 36, 0, 60, 139], [-320, 121, 0, -15, 0, 11, 0, 0], [0, 0, -20, 0, -4, 0, 114, -107], [-263, 40, 0, 44, 0, 19, 0, 0], [0, 0, -120, 0, 32, 0, 57, -48], [0, 0, -45, 0, 1, 0, -35, -47], [-8, -83, 0, 81, 0, -37, 0, 0], [0, 0, 45, 0, -9, 0, -63, 162], [1097, 74, 0, -5, 0, -2, 0, 0], [1046, -36, 0, 174, 0, 12, 0, 0], [758, -28, 0, -108, 0, 16, 0, 0], [409, -152, 0, -100, 0, -5, 0, 0], [0, 0, -3, 0, -13, 0, 14, 45], [0, 0, 54, 0, -20, 0, 41, 62], [0, 0, -80, 0, 4, 0, -16, -9], [0, 0, -28, 0, -28, 0, 104, -65], [-788, 187, 0, 75, 0, 29, 0, 0], [-529, -219, 0, -33, 0, 100, 0, 0], [-11, -124, 0, -95, 0, 34, 0, 0], [0, 0, -40, 0, -12, 0, 94, -32], [23, 215, 0, -85, 0, -36, 0, 0], [0, 0, 72, 0, 12, 0, -22, 2], [182, 16, 0, -6, 0, 92, 0, 0], [-802, 80, 0, -60, 0, 52, 0, 0], [1189, -28, 0, 13, 0, -26, 0, 0], [0, 0, -40, 0, 4, 0, 32, 76], [0, 0, 66, 0, 2, 0, -22, 91], [0, 0, 32, 0, -52, 0, -59, 54], [1030, 72, 0, -42, 0, -72, 0, 0], [0, 0, 17, 0, 39, 0, 112, 105], [0, 0, -60, 0, 36, 0, 21, -46], [-73, -91, 0, -53, 0, -52, 0, 0], [0, 0, 56, 0, -8, 0, -41, 9], [0, 0, 60, 0, 4, 0, -101, 124], [0, 0, 77, 0, -29, 0, 38, 84], [-215, 100, 0, 163, 0, -28, 0, 0], [0, 0, 50, 0, 2, 0, 39, 5], [-1195, -156, 0, -155, 0, 30, 0, 0], [0, 0, -35, 0, 7, 0, -21, 6], [0, 0, -6, 0, -38, 0, 136, 3], [0, 0, 100, 0, -18, 0, 121, -73], [313, -340, 0, -20, 0, -45, 0, 0], [641, 224, 0, -61, 0, -38, 0, 0], [0, 0, -56, 0, 24, 0, -97, -60], [0, 0, 2, 0, -44, 0, 119, 82], [0, 0, -25, 0, -35, 0, -37, -126], [-287, 288, 0, 215, 0, 36, 0, 0], [-647, -312, 0, -132, 0, 83, 0, 0], [-307, -290, 0, 5, 0, 2, 0, 0], [1655, -87, 0, 27, 0, -8, 0, 0], [-788, 91, 0, 75, 0, -19, 0, 0], [0, 0, 94, 0, 34, 0, 108, 145], [0, 0, 20, 0, 28, 0, -118, -58], [157, -328, 0, 25, 0, 22, 0, 0], [-50, 228, 0, 246, 0, 48, 0, 0], [0, 0, 98, 0, 38, 0, -121, 79], [0, 0, 205, 0, 35, 0, -74, 140], [2101, 38, 0, 70, 0, 21, 0, 0], [-695, 176, 0, -129, 0, -8, 0, 0], [0, 0, 2, 0, 38, 0, 186, -71], [0, 0, 88, 0, 36, 0, -10, 6], [361, -6, 0, -52, 0, 43, 0, 0], [386, 28, 0, 72, 0, 56, 0, 0], [-577, -121, 0, -205, 0, 12, 0, 0], [424, 193, 0, 225, 0, -85, 0, 0], [0, 0, 12, 0, -4, 0, -132, 249], [479, 91, 0, -117, 0, -104, 0, 0], [-104, 13, 0, -195, 0, -49, 0, 0], [-907, -58, 0, -35, 0, -14, 0, 0], [0, 0, 10, 0, -38, 0, -72, 73], [0, 0, -85, 0, -7, 0, 105, 121], [518, 184, 0, 42, 0, -28, 0, 0], [0, 0, -20, 0, -28, 0, -127, -132], [0, 0, 90, 0, 18, 0, -21, 39], [-571, 38, 0, -35, 0, -110, 0, 0], [0, 0, -80, 0, 20, 0, 36, -164], [1319, -239, 0, 23, 0, 36, 0, 0], [0, 0, 62, 0, 16, 0, 107, 106], [0, 0, 69, 0, -25, 0, 41, 107], [311, -101, 0, 15, 0, 16, 0, 0], [0, 0, -90, 0, -46, 0, 41, -187], [-1561, 127, 0, -9, 0, -44, 0, 0], [0, 0, 0, 0, -8, 0, -345, 36], [0, 0, -90, 0, 12, 0, 11, -4], [41, 140, 0, 11, 0, 58, 0, 0], [-1199, 32, 0, 135, 0, -80, 0, 0], [0, 0, 20, 0, 28, 0, -268, -47], [730, -238, 0, -156, 0, 22, 0, 0], [913, -134, 0, -272, 0, -33, 0, 0], [0, 0, 32, 0, 56, 0, 141, 38], [0, 0, -18, 0, 6, 0, 153, -201], [553, -10, 0, -60, 0, -133, 0, 0], [0, 0, -30, 0, -2, 0, 37, 287], [-398, 50, 0, 0, 0, -62, 0, 0], [121, 420, 0, 216, 0, 23, 0, 0], [0, 0, 106, 0, 46, 0, -185, -1], [1957, 192, 0, 189, 0, -30, 0, 0], [13, 122, 0, 10, 0, 33, 0, 0], [-79, -68, 0, -141, 0, 26, 0, 0], [0, 0, 5, 0, 15, 0, -137, -108], [-263, -4, 0, 75, 0, -116, 0, 0], [0, 0, -21, 0, 17, 0, -97, 214], [-682, -256, 0, -120, 0, 112, 0, 0], [-251, 332, 0, -90, 0, -43, 0, 0], [0, 0, 15, 0, 29, 0, -1, 116], [0, 0, -226, 0, -42, 0, 13, -233], [0, 0, 70, 0, -62, 0, 15, -29], [350, 20, 0, 60, 0, -140, 0, 0], [0, 0, 172, 0, 32, 0, -220, 18], [-1753, 141, 0, 171, 0, -20, 0, 0], [0, 0, -92, 0, -8, 0, 15, -196], [1969, 112, 0, -101, 0, 8, 0, 0], [581, 60, 0, -131, 0, 30, 0, 0], [0, 0, 85, 0, -69, 0, 8, 155], [-779, 184, 0, 65, 0, 26, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_2736_o_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_2736_3_o_n();".
// 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_2736_3_o_n(:prec:=8)
    chi := MakeCharacter_2736_o();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 3));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(1999) - 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_2736_3_o_n();".
// 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_2736_3_o_n( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_2736_o();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![804, 36, -83, 2, 1]>,<7,R![760, 120, -71, -6, 1]>],Snew);
    return Vf;
end function;