
// Make newform 1176.3.z.c in Magma, downloaded from the LMFDB on 03 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1176_z();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1176_z_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_1176_3_z_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_1176_3_z_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 := [529, -230, -153, -18, 78, -2, -7, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [-1034839, -193196, 469674, 213594, -71462, -33756, 873, 4244], [-46552, 57887, 12912, 5872, -1609, -928, 24, 149], [3637, -207, 1608, 488, -414, -222, 41, 33], [3514676, 215444, -974856, -443336, 173218, 70064, -1812, -6546], [-2603393, -2146717, 162453, 997968, 29696, -121832, -30909, 11533], [-691564, -299436, 39299, 189984, -26272, -16696, -2812, 2924], [-10829159, 3864944, 3003654, 1365974, -916372, -215876, 5583, 45244]];
    Rf_basisdens := [1, 658490, 9407, 2045, 329245, 329245, 47035, 658490];
    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_1176_z();"
function MakeCharacter_1176_z()
    N := 1176;
    order := 6;
    char_gens := [295, 589, 785, 1081];
    v := [6, 6, 6, 5];
    // 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_1176_z_Hecke();"
function MakeCharacter_1176_z_Hecke(Kf)
    N := 1176;
    order := 6;
    char_gens := [295, 589, 785, 1081];
    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], [0, 1, 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], [-1, -1, 0, 0, 0, 0, 0, 0], [1, -1, 0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [-5, 6, 0, 0, -1, 2, 0, 1], [1, -3, 0, 1, -2, -1, 0, -1], [-3, -3, -1, -3, 2, 0, 0, 1], [-7, 4, 0, 2, 3, 0, -1, 0], [-2, 14, -2, -3, 4, -1, -1, -2], [9, 0, 1, 2, 0, 0, -1, 0], [3, 7, 0, -6, 3, 0, 0, -4], [1, -30, 0, -9, 9, 1, 0, 2], [4, -10, -2, 4, -8, -2, -2, -2], [-10, -4, -1, -1, 0, -4, 1, 4], [2, 0, 0, 5, 4, 3, 1, 0], [1, -4, 0, 0, 16, -6, 0, -3], [6, 3, 3, -13, 5, 0, 0, 0], [-4, 8, 0, 8, 8, 12, 0, 0], [5, -8, 1, 1, 17, -4, 2, -2], [-49, 1, 1, -26, 0, 1, -1, -1], [12, 11, 2, -32, 15, 0, 0, -1], [8, 35, 4, -25, 23, 6, 2, 12], [-9, 14, -1, -3, 6, -4, -1, -4], [10, -10, 0, -6, -8, -8, 2, 0], [54, -115, 4, -7, 14, -7, 4, -7], [-14, -20, 2, -26, 12, 0, 0, 4], [17, -18, 0, 8, 3, -14, 5, 0], [-3, 83, -2, 4, -3, -2, -1, -4], [16, -7, 0, 0, 11, 18, 0, 9], [123, -5, 1, -28, 0, -5, -1, 5], [-31, 6, 4, -17, 0, 6, -4, -6], [-15, 11, 0, -7, -3, 3, -4, 0], [0, 4, 0, 0, 42, 8, 0, 4], [-12, 12, -5, -19, 38, -12, -5, -12], [10, -78, -4, 8, -6, 12, -2, 24], [-100, 95, -1, -1, 20, -12, -2, -6], [-8, -8, -4, -68, 36, 0, 0, 4], [-2, 96, -4, -42, 44, 0, -2, 0], [-71, 131, 7, 18, -36, -11, 7, -11], [-96, 60, 0, -15, -8, 17, -7, 0], [31, -43, 5, 5, -18, -14, 10, -7], [53, -85, -2, -3, 6, 21, -2, 21], [-4, -26, 2, 19, -20, -5, 1, -10], [9, -3, 0, 0, -4, 12, 0, 6], [3, 3, -5, -18, 0, 3, 5, -3], [-24, -32, 4, -32, 14, 0, 0, 4], [-204, 0, -2, 14, 0, 0, 2, 0], [-83, 168, -1, -26, 52, 2, -1, 2], [-29, -12, 0, 26, -13, 0, 0, -17], [-35, 20, 0, 23, 9, 19, 14, 0], [-6, -100, 14, 21, -28, -13, 7, -26], [54, -6, -4, 36, 0, -6, 4, 6], [157, 138, 4, 14, -9, 0, 0, 15], [61, -70, 3, 13, -26, 52, 3, 52], [-276, 126, 0, -13, -24, -13, 11, 0], [58, -52, 4, 4, -48, 20, 8, 10], [-64, -121, 9, 87, -48, 0, 0, 48], [99, -41, 0, 51, 52, 16, -1, 0], [302, -303, -6, -6, -25, -14, -12, -7], [163, 9, 3, 30, 0, 9, -3, -9], [-123, -122, 9, 21, -15, 0, 0, -10], [5, -32, 15, -10, 20, -22, 15, -22], [-82, 140, 17, 23, -46, -24, 17, -24], [14, 18, -4, 80, -38, 0, 0, 0], [-90, 37, 0, 24, 30, -22, -6, 0], [9, -5, -6, 131, -128, 12, -3, 24], [-17, -182, 14, -30, 23, -24, 7, -48], [213, -10, -12, 48, 0, -10, 12, 10], [249, -215, -9, -9, 52, 50, -18, 25], [-20, 44, 8, 10, -20, 4, 8, 4], [45, 17, 5, 163, -84, 0, 0, 23], [-20, 72, 12, 80, -86, -26, 6, -52], [-49, 5, -6, -28, 17, 0, 0, -48], [3, -86, -20, -87, 97, 13, -10, 26], [36, -42, 5, 39, 0, -42, -5, 42], [-26, 30, 0, -59, -44, 19, -15, 0], [55, -59, -3, -3, -174, -14, -6, -7], [65, -30, 0, 3, 27, -19, -24, 0], [-18, -26, -34, -9, 26, -1, -17, -2], [205, 225, -4, -76, 40, 0, 0, -16], [36, -116, -14, -10, 20, -44, -14, -44], [-453, -15, 8, -7, 0, -15, -8, 15], [47, -95, 5, 5, 0, -86, 10, -43], [53, -103, 8, -61, 122, 3, 8, 3], [-97, 59, 0, -25, 12, -16, -37, 0], [-1, 97, -14, -30, 37, 6, -7, 12], [97, -9, 19, -28, 0, -9, -19, 9], [40, 107, 16, 44, -52, 32, 8, 64], [-186, 370, -18, -42, 84, -2, -18, -2], [-22, 52, -7, 45, 0, 52, 7, -52], [-6, 0, 0, 1, -4, -1, 5, 0], [83, 83, 13, -89, 38, 0, 0, -13], [-113, 145, -10, -10, 21, 44, -20, 22], [68, -27, 8, -43, 0, -27, -8, 27], [-43, 68, -22, -104, 115, -32, -11, -64], [210, -392, -4, -48, 96, 28, -4, 28], [-177, 85, 0, -78, -82, -3, 4, 0], [26, -16, -20, 56, -18, 0, 0, 62], [-173, 50, 0, 38, 29, -64, 9, 0], [7, -6, 48, 35, -59, -17, 24, -34], [370, 12, 8, 30, 0, 12, -8, -12], [-320, 357, 13, 13, 102, 100, 26, 50], [252, 231, 25, 21, -23, 0, 0, -4], [56, 222, 28, -116, 102, 42, 14, 84], [-225, 210, 11, 11, -33, -8, 22, -4], [115, 63, 6, -106, 50, 0, 0, 46], [160, -307, 34, 79, -158, 13, 34, 13], [-150, 104, 0, 24, 8, 74, 16, 0], [606, -598, 2, 2, -118, 20, 4, 10], [151, -224, 22, 66, -132, 78, 22, 78], [-364, 169, 0, 55, 23, 6, 32, 0], [448, -418, 0, 0, 68, 60, 0, 30], [244, 0, 14, 118, 0, 0, -14, 0], [-105, -158, 1, -175, 87, 0, 0, 52], [61, 26, -5, -112, 0, 26, 5, -26], [-701, 689, -1, -1, 74, -26, -2, -13], [192, -494, 5, 9, -18, -110, 5, -110], [182, 156, 26, 154, -90, 0, 0, 0], [21, -379, 38, -29, 10, 2, 19, 4], [189, 9, -19, 22, 0, 9, 19, -9], [12, -53, 16, 70, -43, 0, 0, 49], [75, -6, 22, -124, 0, -6, -22, 6], [-125, 71, 0, 41, 50, 8, -9, 0], [122, -139, -9, -9, 119, -52, -18, -26], [293, -100, 0, -42, -3, 54, -39, 0], [-534, -31, -2, 10, 0, -31, 2, 31], [-32, 102, -48, -200, 224, -8, -24, -16], [212, -78, 0, 38, 60, 34, -22, 0], [-55, 214, -28, 61, -122, 104, -28, 104], [495, -276, 0, 9, 3, -51, 6, 0], [181, -218, -9, -9, 95, -92, -18, -46], [274, -70, 4, -128, 0, -70, -4, 70], [-26, -481, -28, -97, 111, -12, -14, -24], [-706, -26, -16, -6, 0, -26, 16, 26], [-160, 72, 0, 53, 84, -47, -31, 0], [-373, 776, -8, 52, -104, 30, -8, 30], [-218, -272, -10, -6, 8, 0, 0, 64], [-134, -30, -10, 18, -4, 0, 0, -94], [-360, 713, 2, 16, -32, -7, 2, -7], [-605, 607, 11, 11, 108, 26, 22, 13], [-40, 100, -16, 50, -100, 20, -16, 20], [5, 293, -8, -126, 130, 9, -4, 18], [276, -248, 2, 2, 232, 60, 4, 30], [125, 50, -5, -139, 0, 50, 5, -50], [-158, -123, -18, -244, 131, 0, 0, -17], [494, -952, 34, 106, -212, 36, 34, 36], [-123, 145, 38, 11, -22, -101, 38, -101], [270, 162, 22, -366, 172, 0, 0, 86], [170, -110, 0, -156, -142, -64, -14, 0], [4, -550, 48, -52, 28, -20, 24, -40], [-58, -204, -28, 332, -318, -44, -14, -88], [71, -219, 27, -180, 360, -77, 27, -77], [616, -6, -3, -269, 0, -6, 3, 6], [950, -528, 0, 144, 96, -58, 48, 0], [-259, 218, 21, 21, 179, -40, 42, -20], [447, 33, 15, -12, 0, 33, -15, -33], [45, -20, -14, -70, 77, 52, -7, 104], [-452, 182, 0, -55, -78, -65, 23, 0], [109, -232, -28, -18, 36, -14, -28, -14], [-803, -798, 20, -24, 2, 0, 0, -25], [12, 626, 72, 188, -224, -24, 36, -48], [361, -19, -23, -142, 0, -19, 23, 19], [105, -68, 16, -139, 0, -68, -16, 68], [-625, 279, 0, 76, 59, -50, 17, 0], [-790, 702, 8, 8, -56, -160, 16, -80], [-113, -141, -11, -185, 98, 0, 0, 39], [-143, 99, -28, -28, 71, -144, -56, -72], [230, 73, 12, 82, -47, 0, 0, 145], [195, -18, -12, -190, 0, -18, 12, 18], [565, -275, 0, 61, 24, 52, 37, 0], [-263, 296, 4, 4, -347, 74, 8, 37], [-258, 528, 10, 100, -200, 12, 10, 12], [6, -478, 4, -240, 238, 4, 2, 8], [1, 65, -34, -34, 262, 64, -68, 32], [99, 97, 24, 290, -157, 0, 0, -22], [20, 44, 4, -108, 216, 84, 4, 84], [562, -52, -35, 165, 0, -52, 35, 52], [731, -622, -8, -8, 130, 202, -16, 101], [124, -264, 8, -102, 204, -16, 8, -16], [51, 30, 0, -149, -171, 133, 22, 0], [-50, -339, 0, 305, -305, -50, 0, -100], [-348, 549, -34, 29, -58, -147, -34, -147], [139, 29, -4, 23, 0, 29, 4, -29], [-236, 140, 0, 133, 136, 41, -3, 0], [-422, 378, 36, 36, -128, -16, 72, -8], [192, 247, -29, -43, 36, 0, 0, -26], [578, -674, 20, 20, 210, -152, 40, -76], [-63, -188, 15, 199, -107, 0, 0, 110], [-58, 55, 56, -4, -24, -86, 28, -172], [-510, -358, -4, 140, -68, 0, 0, -148], [-172, 47, 0, -232, -258, -52, 26, 0], [-631, -78, 19, 65, 0, -78, -19, 78], [32, 470, -44, 212, -190, 54, -22, 108], [-404, 224, 0, -5, -24, 63, 19, 0], [882, -1023, 27, 27, 85, -228, 54, -114], [550, 584, 20, 212, -116, 0, 0, -54], [-564, 607, 18, 18, -109, 122, 36, 61], [-22, 240, -48, 34, -10, 2, -24, 4], [344, -646, -10, 200, -400, 42, -10, 42], [440, -256, 0, 59, 50, -63, 9, 0], [-32, 35, -41, -41, -44, -76, -82, -38], [-208, 334, 7, 31, -62, -82, 7, -82], [736, -316, 0, -28, 34, 42, -62, 0], [-86, 22, -90, 274, -92, 0, 0, -18], [-724, 1304, -30, -178, 356, -144, -30, -144], [-152, -287, 11, 585, -298, 0, 0, 124], [-212, 24, 0, -154, -170, -148, 16, 0], [-107, 1497, -36, -233, 251, -89, -18, -178], [802, -56, 2, 220, 0, -56, -2, 56], [-84, -98, -38, 174, -68, 0, 0, 52], [-61, -42, -56, 465, -437, -33, -28, -66], [441, -878, -53, -102, 204, 4, -53, 4], [569, 30, -17, 304, 0, 30, 17, -30], [-1165, 551, 0, 160, 145, -48, 15, 0], [-529, -609, 5, 155, -80, 0, 0, 75], [-149, -26, 0, -3, -59, -145, 56, 0], [-972, 1007, -25, -25, 162, 20, -50, 10], [-478, -494, 114, -358, 122, 0, 0, -98], [-6, 226, -50, 261, -236, 19, -25, 38], [-597, 123, 13, -116, 0, 123, -13, -123], [87, -496, -16, 101, -93, 95, -8, 190], [-6, -44, 5, 95, -190, -56, 5, -56], [-136, 82, 30, -119, 104, -151, 15, -302], [-19, 781, 22, 71, -82, -30, 11, -60], [-398, 789, -50, -35, 70, -7, -50, -7], [288, -108, -18, 10, 0, -108, 18, 108], [1168, -576, 0, -88, -70, -2, -18, 0], [-234, 260, 42, 42, -130, 136, 84, 68], [440, -129, 0, -93, -101, 190, 8, 0], [106, 808, 70, -289, 254, 71, 35, 142], [-366, 379, -26, -26, -443, -26, -52, -13], [-218, -160, -24, 420, -198, 0, 0, -34], [-1095, -106, -22, 27, 0, -106, 22, 106], [154, -126, 16, 16, -342, 88, 32, 44], [156, -428, 13, 35, -70, -116, 13, -116], [-339, -447, 33, -525, 246, 0, 0, 75], [414, -221, 0, -284, -264, -48, -20, 0], [179, -405, 42, 153, -174, 158, 21, 316], [-1342, -32, 18, -150, 0, -32, -18, 32], [-815, 1643, 87, 50, -100, 13, 87, 13], [167, -235, 9, 9, -422, -118, 18, -59], [-221, 224, 0, -116, -133, 244, 17, 0], [193, 283, -46, -240, 143, 0, 0, -44], [18, -1424, 4, -122, 120, 16, 2, 32], [480, -820, -32, -258, 516, 140, -32, 140], [1734, -798, 0, -63, -50, 125, -13, 0], [-801, 1640, -34, -103, 206, 38, -34, 38], [401, 289, -43, 227, -92, 0, 0, 155], [684, -750, -12, -12, -94, -156, -24, -78], [30, -28, -42, 172, 0, -28, 42, 28], [263, -43, -38, -187, 0, -43, 38, 43], [-1760, 956, 0, -147, -130, 135, -17, 0], [-1878, 1928, -10, -10, 168, 80, -20, 40], [523, -1065, -4, 25, -50, -19, -4, -19], [222, 161, -51, -481, 266, 0, 0, 112], [-7, 871, 24, -57, 45, -19, 12, -38], [550, -601, 12, 12, 219, -78, 24, -39], [15, 418, -37, -121, 79, 0, 0, -366], [96, -235, -16, 28, -56, -43, -16, -43], [825, -435, 0, 399, 385, -31, 14, 0], [-655, 710, -9, -9, 17, 92, -18, 46], [-384, -111, -68, -99, 0, -111, 68, 111], [582, 465, 76, -54, -11, 0, 0, 41], [-579, 1135, 24, 135, -270, -23, 24, -23], [-82, 96, -162, -98, 130, 0, 0, -16], [1993, -966, 0, -118, -201, 144, 83, 0], [1623, -80, 13, -316, 0, -80, -13, 80], [483, -923, 29, 18, -36, 43, 29, 43], [-1490, 144, 36, -132, 0, 144, -36, -144], [726, -933, 59, 59, 134, -296, 118, -148], [265, -142, 0, 155, 155, -19, 0, 0], [272, -212, -6, -6, 342, 108, -12, 54], [-541, -471, 10, -166, 78, 0, 0, -80], [6, -137, 0, -303, 303, 6, 0, 12], [-662, 1273, -64, -159, 318, -51, -64, -51], [68, 20, 0, -206, -150, 52, -56, 0], [-175, 61, -54, 368, -341, -148, -27, -296], [-1138, 1083, 26, 26, -397, -58, 52, -29], [-79, -86, -100, -591, 641, -29, -50, -58], [-460, 156, 0, -259, -282, -125, 23, 0], [-500, -696, 52, -84, 16, 0, 0, 144], [1147, -1165, -6, -6, 111, -48, -12, -24], [-226, 318, 48, 84, -168, -134, 48, -134], [215, -483, -118, -49, 98, -53, -118, -53], [-420, 200, 0, 170, 250, -100, -80, 0], [-24, -1886, 0, 28, -28, -24, 0, -48], [97, 51, 14, 14, -290, 324, 28, 162], [350, 185, 36, 232, 0, 185, -36, -185], [13, -31, -10, -504, 257, 0, 0, 54], [57, -137, -121, -24, 48, -23, -121, -23], [882, -776, 32, 32, -402, 276, 64, 138], [-431, -290, -16, -626, 321, 0, 0, -125], [-16, -30, -22, -217, 228, -5, -11, -10], [-382, 386, -6, -64, 128, -378, -6, -378], [133, 95, -22, -105, 0, 95, 22, -95], [1196, 1231, 5, 111, -58, 0, 0, -40], [655, -434, 0, 540, 473, -146, 67, 0], [-223, 483, -47, 368, -736, 37, -47, 37], [-2490, 1248, 0, -47, -48, 7, 1, 0], [-20, 312, -7, 185, -370, 272, -7, 272], [176, -76, 0, 170, 260, -66, -90, 0], [-9, -485, 62, 501, -532, -40, 31, -80], [144, -167, -35, -35, 198, -116, -70, -58]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1176_z_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1176_3_z_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_1176_3_z_c(:prec:=8)
    chi := MakeCharacter_1176_z();
    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_1176_3_z_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_1176_3_z_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1176_z();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![913936, 195024, -48268, -13260, 2861, 390, -53, -6, 1]>],Snew);
    return Vf;
end function;