
// Make newform 576.3.o.g in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_576_o();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_576_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_576_3_o_g();".
// 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_576_3_o_g();".
// 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 := [65536, -49152, 28672, -30720, 19456, -9216, 6784, -3648, 1552, -912, 424, -144, 76, -30, 7, -3, 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], [1769472, -634880, 258048, -372736, 187904, -58368, 63104, -26384, 7664, -6280, 2224, -204, 394, -83, -17, -1], [-122880, 57344, -7168, 26112, -13824, 3392, -3584, 1616, -176, 328, -72, -8, -22, 5, 3, -1], [-40960, 57344, 11264, 7680, -8704, 192, -864, 1456, 224, 136, -128, -36, -8, 15, 5, -1], [4341760, -5967872, 3497984, -2111488, 1502720, -863488, 407040, -247728, 117520, -47768, 23440, -9380, 2630, -1273, 333, -27], [-286720, 786432, -929792, 241664, -334080, 234112, -105376, 62224, -37088, 9048, -6984, 3440, -628, 371, -179, -17], [-622592, -348160, -323584, 14336, 38912, 23040, 9920, -20816, -112, -5448, 1600, -180, 534, -279, -37, -41], [7045120, -2363392, 1673216, -1829888, 894464, -428416, 352128, -120656, 63664, -39144, 12352, -4100, 2762, -723, 135, -49], [131072, -98304, 135168, -76800, 45312, -33408, 18272, -8592, 5376, -2424, 984, -504, 176, -51, 27, -3], [-2179072, -1241088, 894976, 500736, 113664, -146048, -81088, -19088, 17296, 8344, 2256, -652, -1090, -223, 283, 71], [786432, 774144, 204800, -211968, -105472, -9984, 38880, 10000, 864, -5128, -488, -120, 708, 23, 1, -53], [-3866624, 1183744, -751616, 1309696, -428544, 235648, -237888, 83728, -39184, 29928, -7728, 3692, -2590, 535, -147, 113], [524288, -520192, 1368064, -1042432, 727552, -454400, 273024, -145104, 78896, -39528, 17744, -8044, 3442, -1103, 459, -149], [1146880, -1658880, 813056, -707584, 457728, -256384, 168064, -85744, 43280, -22904, 9984, -4124, 1918, -593, 221, -75], [2146304, -4124672, 2381824, -1999872, 1183744, -712064, 435648, -237328, 101072, -59240, 24080, -10156, 4102, -1455, 459, -193], [-1040384, 83968, -621056, 575744, -205312, 196512, -133440, 46048, -33120, 18080, -5420, 3126, -1510, 277, -163, 59]];
    Rf_basisdens := [1, 540672, 24576, 24576, 540672, 270336, 540672, 540672, 24576, 540672, 270336, 540672, 540672, 270336, 540672, 135168];
    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_576_o();"
function MakeCharacter_576_o()
    N := 576;
    order := 6;
    char_gens := [127, 325, 65];
    v := [3, 6, 2];
    // 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_576_o_Hecke();"
function MakeCharacter_576_o_Hecke(Kf)
    N := 576;
    order := 6;
    char_gens := [127, 325, 65];
    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], [0, -1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1], [2, 0, 0, 0, -1, 0, 0, 0, 3, 0, 0, 0, -1, 0, 0, 0], [0, 0, 1, -1, 0, -1, -4, 0, 0, 0, 1, -4, 0, 1, 0, 0], [0, 0, 2, -2, 0, 2, -1, 0, 0, -2, 0, -1, 0, -3, 0, 0], [-4, 4, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, -2, 3], [0, 0, -2, 2, 0, 0, 3, 0, 0, 0, 0, -1, 0, 5, 0, 0], [-1, 0, 0, 0, -6, 0, 0, 3, 1, 0, 0, 0, -6, 0, 3, 0], [0, 10, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, -2, 0, 0, 3], [0, 0, 6, -1, 0, 0, 0, 0, 0, 2, -6, -5, 0, 0, 0, 0], [0, 0, -4, -5, 0, 0, -6, 0, 0, 3, -2, 3, 0, 0, 0, 0], [7, 0, 0, 0, -4, 0, 0, 1, 3, 0, 0, 0, -4, 0, 1, 0], [0, 0, -3, 3, 0, 6, -3, 0, 0, -6, 0, 6, 0, -2, 0, 0], [6, -6, 0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 0, 0, -12, 7], [0, 0, -2, 2, 0, 1, 11, 0, 0, -1, 0, -9, 0, -3, 0, 0], [0, 0, -21, -6, 0, -5, 17, 0, 0, 0, -1, 17, 0, -1, 0, 0], [4, 0, 0, 0, 3, 0, 0, 12, 5, 0, 0, 0, 3, 0, 12, 0], [0, 0, -6, 22, 0, 0, 5, 0, 0, -4, 11, -11, 0, 0, 0, 0], [0, 0, -21, -6, 0, 0, -26, 0, 0, 1, -5, 1, 0, 0, 0, 0], [-25, 0, 0, 0, -4, 0, 0, 3, -9, 0, 0, 0, -4, 0, 3, 0], [-16, 16, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -9, 1], [41, -41, 0, 0, -4, 0, 0, 0, -6, 0, 0, 0, 0, 0, 3, -6], [0, 0, 19, -19, 0, 3, 9, 0, 0, -3, 0, -28, 0, -4, 0, 0], [0, 0, -39, 21, 0, -7, 34, 0, 0, 0, 13, 34, 0, 13, 0, 0], [-25, 0, 0, 0, 0, 0, 0, 9, 7, 0, 0, 0, 0, 0, 9, 0], [0, 46, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -3, 0, 0, -12], [0, 0, -30, 18, 0, 6, 12, 0, 0, 0, 18, 12, 0, 18, 0, 0], [0, 0, -37, 37, 0, -13, 23, 0, 0, 13, 0, 14, 0, 11, 0, 0], [94, -94, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 17, 3], [0, 0, 31, -31, 0, -2, 5, 0, 0, 2, 0, -36, 0, -12, 0, 0], [0, 8, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 24, 0, 0, 9], [0, 0, 36, 22, 0, 0, 23, 0, 0, 8, -13, -35, 0, 0, 0, 0], [0, -3, 0, 0, 0, 0, 0, -21, 0, 0, 0, 0, -12, 0, 0, -22], [0, 0, 14, -2, 0, -8, -20, 0, 0, 0, 2, -20, 0, 2, 0, 0], [0, 0, -33, 33, 0, 9, 21, 0, 0, -9, 0, 12, 0, -10, 0, 0], [113, -113, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, 0], [0, 0, -18, -36, 0, 14, -14, 0, 0, 0, -2, -14, 0, -2, 0, 0], [49, 0, 0, 0, 24, 0, 0, -3, -27, 0, 0, 0, 24, 0, -3, 0], [0, 0, 2, -65, 0, 0, -24, 0, 0, -15, -26, 39, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 12, 0, 0, -29], [-38, 0, 0, 0, 28, 0, 0, 6, -24, 0, 0, 0, 28, 0, 6, 0], [0, 0, 39, -24, 0, 3, -69, 0, 0, 0, 3, -69, 0, 3, 0, 0], [0, 0, 6, -6, 0, 2, 13, 0, 0, -2, 0, -19, 0, 38, 0, 0], [0, 0, -6, -29, 0, 0, -44, 0, 0, -15, -38, -9, 0, 0, 0, 0], [0, 0, -16, -38, 0, 0, -25, 0, 0, -25, -9, 29, 0, 0, 0, 0], [0, -123, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 6, 0, 0, 8], [-97, 0, 0, 0, 23, 0, 0, 21, -18, 0, 0, 0, 23, 0, 21, 0], [0, 0, 18, -18, 0, -30, -9, 0, 0, 30, 0, -9, 0, -37, 0, 0], [-81, 81, 0, 0, 30, 0, 0, 0, 8, 0, 0, 0, 0, 0, 30, 8], [0, 0, 75, -57, 0, 3, -18, 0, 0, 0, -57, -18, 0, -57, 0, 0], [0, 109, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, -30, 0, 0, 18], [0, 0, -18, -18, 0, 0, -19, 0, 0, 14, -1, 17, 0, 0, 0, 0], [-137, 0, 0, 0, -26, 0, 0, -21, 21, 0, 0, 0, -26, 0, -21, 0], [0, 0, -20, -46, 0, -22, -10, 0, 0, 0, -8, -10, 0, -8, 0, 0], [55, -55, 0, 0, -18, 0, 0, 0, 38, 0, 0, 0, 0, 0, 45, 38], [85, -85, 0, 0, -39, 0, 0, 0, -15, 0, 0, 0, 0, 0, -4, -15], [0, 0, -87, 87, 0, -19, 43, 0, 0, 19, 0, 44, 0, 29, 0, 0], [0, 89, 0, 0, 0, 0, 0, -23, 0, 0, 0, 0, -24, 0, 0, 18], [0, 0, 63, 15, 0, 3, -54, 0, 0, 0, 3, -54, 0, 3, 0, 0], [0, 0, -16, 16, 0, 8, 35, 0, 0, -8, 0, -19, 0, 45, 0, 0], [-51, 51, 0, 0, -12, 0, 0, 0, 8, 0, 0, 0, 0, 0, 6, 8], [140, -140, 0, 0, 6, 0, 0, 0, -15, 0, 0, 0, 0, 0, -32, -15], [0, 0, -51, -37, 0, 0, -13, 0, 0, -18, 38, 75, 0, 0, 0, 0], [0, -79, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, -30, 0, 0, 38], [0, 0, 108, -108, 0, -21, -81, 0, 0, 21, 0, -27, 0, 31, 0, 0], [-101, 101, 0, 0, 42, 0, 0, 0, -34, 0, 0, 0, 0, 0, -21, -34], [166, -166, 0, 0, 40, 0, 0, 0, 51, 0, 0, 0, 0, 0, 15, 51], [0, 0, -18, -36, 0, -32, -70, 0, 0, 0, 26, -70, 0, 26, 0, 0], [0, 0, -60, -26, 0, 0, -21, 0, 0, 46, 39, 65, 0, 0, 0, 0], [0, 28, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 12, 0, 0, -23], [0, 0, -168, 111, 0, -48, 135, 0, 0, 0, 72, 135, 0, 72, 0, 0], [0, 0, 19, -19, 0, 13, -59, 0, 0, -13, 0, 40, 0, 28, 0, 0], [203, -203, 0, 0, 50, 0, 0, 0, 6, 0, 0, 0, 0, 0, -39, 6], [119, 0, 0, 0, -84, 0, 0, 33, 19, 0, 0, 0, -84, 0, 33, 0], [0, 496, 0, 0, 0, 0, 0, -19, 0, 0, 0, 0, 18, 0, 0, -27], [0, 93, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, -48, 0, 0, -20], [0, 0, -52, 52, 0, -4, 89, 0, 0, 4, 0, -37, 0, -46, 0, 0], [-132, 132, 0, 0, 24, 0, 0, 0, -5, 0, 0, 0, 0, 0, 24, -5], [0, 0, 66, 96, 0, -4, 34, 0, 0, 0, -2, 34, 0, -2, 0, 0], [82, 0, 0, 0, 9, 0, 0, -54, 5, 0, 0, 0, 9, 0, -54, 0], [0, 0, 18, -8, 0, 0, 51, 0, 0, -50, 33, 41, 0, 0, 0, 0], [0, 0, 160, -61, 0, 0, 42, 0, 0, 36, -118, -57, 0, 0, 0, 0], [-394, 0, 0, 0, 37, 0, 0, 50, -3, 0, 0, 0, 37, 0, 50, 0], [-90, 90, 0, 0, -54, 0, 0, 0, 29, 0, 0, 0, 0, 0, -45, 29], [320, -320, 0, 0, -76, 0, 0, 0, 51, 0, 0, 0, 0, 0, 42, 51], [0, 0, -56, 56, 0, 30, -57, 0, 0, -30, 0, 113, 0, 41, 0, 0], [0, 0, 87, -159, 0, -51, -84, 0, 0, 0, -81, -84, 0, -81, 0, 0], [0, 0, 124, -16, 0, 0, 133, 0, 0, 22, 9, 25, 0, 0, 0, 0], [0, 0, -22, 40, 0, -44, 82, 0, 0, 0, -10, 82, 0, -10, 0, 0], [0, 0, 53, -53, 0, 44, -103, 0, 0, -44, 0, 50, 0, 56, 0, 0], [0, 0, 21, -21, 0, -70, -35, 0, 0, 70, 0, 14, 0, -16, 0, 0], [0, 0, 45, -126, 0, -27, -93, 0, 0, 0, -39, -93, 0, -39, 0, 0], [0, 224, 0, 0, 0, 0, 0, -108, 0, 0, 0, 0, -52, 0, 0, -51], [-277, 0, 0, 0, -53, 0, 0, -13, 6, 0, 0, 0, -53, 0, -13, 0], [0, 0, -101, 56, 0, 53, 119, 0, 0, 0, 19, 119, 0, 19, 0, 0], [-238, 0, 0, 0, 60, 0, 0, 6, -32, 0, 0, 0, 60, 0, 6, 0], [0, 0, 96, -88, 0, 0, 29, 0, 0, -33, -67, 21, 0, 0, 0, 0], [-227, 0, 0, 0, -62, 0, 0, 123, -69, 0, 0, 0, -62, 0, 123, 0], [0, 0, 146, -146, 0, 65, -37, 0, 0, -65, 0, -109, 0, -7, 0, 0], [-167, 167, 0, 0, 84, 0, 0, 0, -84, 0, 0, 0, 0, 0, 50, -84], [0, 0, -198, 198, 0, -1, 31, 0, 0, 1, 0, 167, 0, 101, 0, 0], [76, 0, 0, 0, 33, 0, 0, 78, -61, 0, 0, 0, 33, 0, 78, 0], [0, 0, 82, 107, 0, 0, 168, 0, 0, 18, 86, -21, 0, 0, 0, 0], [-313, 0, 0, 0, 62, 0, 0, -39, -63, 0, 0, 0, 62, 0, -39, 0], [0, 0, 107, -107, 0, -19, 77, 0, 0, 19, 0, -184, 0, -42, 0, 0], [204, -204, 0, 0, 78, 0, 0, 0, 11, 0, 0, 0, 0, 0, -21, 11], [0, 0, -127, 127, 0, -85, 25, 0, 0, 85, 0, 102, 0, 36, 0, 0], [-197, 0, 0, 0, 60, 0, 0, -39, 15, 0, 0, 0, 60, 0, -39, 0], [0, 136, 0, 0, 0, 0, 0, -91, 0, 0, 0, 0, 48, 0, 0, 39], [0, 0, -90, -106, 0, 0, -79, 0, 0, 27, 11, 117, 0, 0, 0, 0], [0, 0, 40, 194, 0, 50, 2, 0, 0, 0, 76, 2, 0, 76, 0, 0], [571, -571, 0, 0, -6, 0, 0, 0, -72, 0, 0, 0, 0, 0, 26, -72], [0, 0, 154, -154, 0, -17, -121, 0, 0, 17, 0, -33, 0, 15, 0, 0], [0, 0, 42, -60, 0, 56, -2, 0, 0, 0, -50, -2, 0, -50, 0, 0], [0, 179, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 44, 0, 0, 120], [0, 0, 79, 29, 0, 0, 15, 0, 0, 54, -64, -93, 0, 0, 0, 0], [0, -93, 0, 0, 0, 0, 0, -45, 0, 0, 0, 0, -90, 0, 0, -10], [255, -255, 0, 0, -3, 0, 0, 0, -37, 0, 0, 0, 0, 0, -30, -37], [-247, 247, 0, 0, -16, 0, 0, 0, -66, 0, 0, 0, 0, 0, 75, -66], [0, 0, 81, 117, 0, -11, 74, 0, 0, 0, -19, 74, 0, -19, 0, 0], [0, 0, -63, 170, 0, 0, 8, 0, 0, 27, 71, -99, 0, 0, 0, 0], [-443, 0, 0, 0, 52, 0, 0, -99, -99, 0, 0, 0, 52, 0, -99, 0], [-27, 27, 0, 0, 78, 0, 0, 0, -152, 0, 0, 0, 0, 0, -39, -152], [0, 0, 180, -36, 0, 12, -96, 0, 0, 0, -60, -96, 0, -60, 0, 0], [0, 0, 210, -86, 0, 0, 125, 0, 0, 38, -85, 1, 0, 0, 0, 0], [0, -38, 0, 0, 0, 0, 0, -102, 0, 0, 0, 0, 6, 0, 0, -107], [0, 0, 114, 15, 0, 6, -39, 0, 0, 0, -30, -39, 0, -30, 0, 0], [0, 0, -129, 129, 0, -9, 33, 0, 0, 9, 0, 96, 0, 104, 0, 0], [0, 0, -229, 229, 0, 77, 85, 0, 0, -77, 0, 144, 0, 0, 0, 0], [22, 0, 0, 0, -48, 0, 0, 60, 0, 0, 0, 0, -48, 0, 60, 0], [0, -215, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, -15, 0, 0, -21], [0, -6, 0, 0, 0, 0, 0, -147, 0, 0, 0, 0, 87, 0, 0, -2], [-227, 0, 0, 0, 16, 0, 0, 21, 129, 0, 0, 0, 16, 0, 21, 0], [0, 0, -5, 5, 0, 79, -49, 0, 0, -79, 0, 54, 0, 51, 0, 0], [0, 80, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 84, 0, 0, 21], [110, 0, 0, 0, 65, 0, 0, -114, -15, 0, 0, 0, 65, 0, -114, 0], [0, 0, 99, -375, 0, -63, -48, 0, 0, 0, -213, -48, 0, -213, 0, 0], [-166, 166, 0, 0, 42, 0, 0, 0, 39, 0, 0, 0, 0, 0, -122, 39], [0, 0, 170, -170, 0, -28, -125, 0, 0, 28, 0, -45, 0, -45, 0, 0], [0, 0, 90, 36, 0, 58, -106, 0, 0, 0, 26, -106, 0, 26, 0, 0], [-371, 0, 0, 0, 78, 0, 0, -93, 39, 0, 0, 0, 78, 0, -93, 0], [0, 0, -68, -193, 0, 0, -62, 0, 0, -95, 6, 199, 0, 0, 0, 0], [-218, 218, 0, 0, -42, 0, 0, 0, 23, 0, 0, 0, 0, 0, -78, 23], [-347, 347, 0, 0, -21, 0, 0, 0, 123, 0, 0, 0, 0, 0, -118, 123], [0, 0, -84, 84, 0, 29, 67, 0, 0, -29, 0, 17, 0, -7, 0, 0], [0, 0, 84, -138, 0, -70, -62, 0, 0, 0, -80, -62, 0, -80, 0, 0], [0, 336, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 60, 0, 0, 125], [-421, 0, 0, 0, 16, 0, 0, 131, -9, 0, 0, 0, 16, 0, 131, 0], [0, 0, -113, 269, 0, 5, 80, 0, 0, 0, 151, 80, 0, 151, 0, 0], [0, 0, -148, 148, 0, -46, 263, 0, 0, 46, 0, -115, 0, 15, 0, 0], [0, 0, 48, -7, 0, 0, 32, 0, 0, 48, -16, -9, 0, 0, 0, 0], [0, 0, 16, -142, 0, 0, -101, 0, 0, 58, -117, 25, 0, 0, 0, 0], [0, 0, 194, 124, 0, -44, -2, 0, 0, 0, -34, -2, 0, -34, 0, 0], [175, -175, 0, 0, -27, 0, 0, 0, 3, 0, 0, 0, 0, 0, -118, 3], [43, 0, 0, 0, -30, 0, 0, 33, -31, 0, 0, 0, -30, 0, 33, 0], [0, 953, 0, 0, 0, 0, 0, -47, 0, 0, 0, 0, -54, 0, 0, -24], [0, 0, -126, 108, 0, 0, -161, 0, 0, 97, -35, -143, 0, 0, 0, 0], [290, 0, 0, 0, -31, 0, 0, 18, -3, 0, 0, 0, -31, 0, 18, 0], [0, 0, 4, -4, 0, 24, 99, 0, 0, -24, 0, -103, 0, 161, 0, 0], [0, 0, -15, -12, 0, -29, 65, 0, 0, 0, -31, 65, 0, -31, 0, 0], [0, 379, 0, 0, 0, 0, 0, 108, 0, 0, 0, 0, 16, 0, 0, 186], [0, 0, -46, 136, 0, 0, 51, 0, 0, 30, 97, -39, 0, 0, 0, 0], [0, 0, -132, -198, 0, -18, -162, 0, 0, 0, 48, -162, 0, 48, 0, 0], [-3, 3, 0, 0, 84, 0, 0, 0, 190, 0, 0, 0, 0, 0, -69, 190]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_576_o_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_576_3_o_g();".
// 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_576_3_o_g(:prec:=16)
    chi := MakeCharacter_576_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(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_576_3_o_g();".
// 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_576_3_o_g( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_576_o();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![87616, 75480, 49337, 15291, 3870, 351, 62, 3, 1]>,<7,R![4430766096, 0, -13013727948, 0, 37316185677, 0, -2633438061, 0, 141530490, 0, -2674161, 0, 37002, 0, -225, 0, 1]>],Snew);
    return Vf;
end function;