
// Make newform 912.3.h.a in Magma, downloaded from the LMFDB on 09 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_912_h();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_912_h_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_912_3_h_a();".
// 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_912_3_h_a();".
// 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 := [2052, 0, 7296, 0, 6813, 0, 2636, 0, 462, 0, 36, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2952, 0, 8406, 0, 5243, 0, 1151, 0, 101, 0, 3], [-11400, -12732, -37464, -40908, -24042, -26059, -5330, -5749, -470, -505, -14, -15], [38484, 47040, 122724, 144360, 78177, 90944, 17247, 19980, 1515, 1752, 45, 52], [-11796, 0, -36612, 0, -22965, 0, -5023, 0, -439, 0, -13, 0], [-7828, 0, -24708, 0, -15669, 0, -3451, 0, -303, 0, -9, 0], [-4284, 167484, -10332, 523980, -6051, 332191, -1257, 73197, -105, 6429, -3, 191], [69048, -119148, 213264, -379476, 135042, -241247, 29802, -53217, 2622, -4677, 78, -139], [-87876, -46248, -272808, -144288, -172479, -90944, -37965, -19980, -3333, -1752, -99, -52], [247356, -47040, 768924, -144360, 486051, -90944, 106989, -19980, 9393, -1752, 279, -52]];
    Rf_basisdens := [1, 1, 1, 24, 96, 288, 48, 16, 288, 288, 144, 288];
    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_912_h();"
function MakeCharacter_912_h()
    N := 912;
    order := 2;
    char_gens := [799, 229, 305, 97];
    v := [2, 2, 1, 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_912_h_Hecke();"
function MakeCharacter_912_h_Hecke( : Kf := false)
    N := 912;
    order := 2;
    char_gens := [799, 229, 305, 97];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := ISA(Type(Kf), Fld), 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]];
    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, -1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0], [0, -1, 0, 0, 1, 0, 1, 0, 1, -2, 0, 1], [-3, 0, -1, 0, 0, -2, 1, 0, 0, 0, 0, -2], [0, -1, 3, -2, -3, 0, -2, 1, 1, 0, 2, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, -5, -1, 3, 1, 0, 0, -1, -1, 2, 0, -1], [0, 0, -3, 0, 4, -3, 4, -3, -2, -2, 0, 1], [-5, -2, 0, 0, 0, 5, 3, -1, -2, -2, 2, -1], [-1, 0, 0, 0, 0, -1, -1, -5, 0, 0, 0, -1], [0, 7, 1, 0, -2, 1, -1, 2, 1, -1, -1, 0], [7, 0, -3, 0, 0, -4, 0, 2, 0, 0, 0, -4], [0, -6, 0, -7, 4, -4, 4, -4, 0, -4, 4, 4], [0, -11, 6, -4, -6, -6, -1, -1, -1, -3, 7, 5], [0, 9, 4, -2, -6, -2, -3, 1, -1, 1, 3, 1], [-5, 0, -5, 0, 0, -2, -4, 2, 0, 0, 0, -2], [34, 4, -9, 0, 0, -11, -10, 9, 4, 4, -4, 1], [0, 17, 5, -8, -10, 7, -7, 10, 5, -1, -5, -2], [9, 0, -12, 0, 0, -4, 3, -9, 0, 0, 0, -4], [-17, -5, -7, 0, 0, 10, 0, 1, -5, -5, 5, -5], [0, 10, -2, 2, 0, -14, 8, -6, -8, -8, 4, 6], [0, -15, -7, 4, 0, 3, 1, 4, -3, 1, -11, -6], [38, 1, 5, 0, 0, -11, -5, 14, 1, 1, -1, -8], [0, 9, 4, -1, 1, 0, 1, 0, 5, -6, 4, 5], [-27, 3, -1, 0, 0, -8, -10, 5, 3, 3, -3, 1], [0, -8, 7, 0, -4, -3, -6, -5, -2, 10, 12, 1], [-13, -3, -6, 0, 0, 23, 16, -6, -3, -3, 3, 14], [0, 20, -4, 2, 8, 6, -4, -6, -2, 18, 2, -8], [29, -5, 5, 0, 0, 16, 20, -5, -5, -5, 5, 1], [0, 35, 8, 12, -7, 22, -17, 12, 13, 14, -4, -9], [0, 25, 3, 8, 13, 2, 2, -9, 7, 2, 12, 5], [-19, 2, -13, 0, 0, 6, 14, 6, 2, 2, -2, 12], [0, 6, 6, 5, -20, -4, -8, 8, -6, 2, -2, -2], [13, -2, 28, 0, 0, 21, -23, 1, -2, -2, 2, 15], [-40, -4, -16, 0, 0, 6, 8, 26, -4, -4, 4, -6], [40, -2, 6, 0, 0, 16, 18, 22, -2, -2, 2, 10], [0, -18, 6, 12, 10, 6, 2, -2, 14, -8, 8, 8], [0, -28, -6, -2, 16, 10, 4, -2, 8, 0, -4, -2], [0, 30, 2, -20, -6, -2, 0, 4, 0, -6, -2, 2], [29, -5, -9, 0, 0, 20, -12, -13, -5, -5, 5, 5], [0, -36, -25, 7, 26, -14, 27, -13, -12, -16, -12, 2], [120, 4, -6, 0, 0, -22, -10, 20, 4, 4, -4, -10], [0, -23, -28, -9, 33, -16, 37, -12, -7, -34, -16, 9], [-59, 6, 16, 0, 0, -24, -13, 35, 6, 6, -6, -6], [-132, -5, -10, 0, 0, 6, -3, -7, -5, -5, 5, -9], [-53, 0, 40, 0, 0, 11, 5, 1, 0, 0, 0, 11], [0, 9, 6, 32, -26, -8, -13, 5, -15, 15, 1, -7], [73, -6, 27, 0, 0, 16, -10, 2, -6, -6, 6, -2], [0, -31, 2, 18, 7, 16, -13, -4, 5, 28, 6, -11], [0, -54, -3, -41, 8, -10, 7, -11, -6, 0, 8, 4], [-162, -5, -1, 0, 0, 1, -3, 14, -5, -5, 5, -14], [0, -85, 14, 6, 1, 18, -7, 10, 25, -10, 4, 7], [0, -10, -14, 34, -18, -8, -8, 2, -30, 28, -16, -22], [0, -38, 0, 13, 4, 16, -8, 4, 8, 12, -4, -8], [0, -37, 11, -40, -12, 15, -11, 16, 15, -5, -5, 0], [64, -16, 23, 0, 0, 40, -5, -7, -16, -16, 16, -8], [-183, 20, 27, 0, 0, -50, -26, 48, 20, 20, -20, 10], [0, 72, -8, 22, 12, 24, 6, 18, 22, -22, -26, -2], [-71, 8, -23, 0, 0, -42, 2, -22, 8, 8, -8, -18], [0, -42, -21, 12, 26, -13, 30, -9, -4, -30, -12, 9], [-146, -14, -34, 0, 0, 60, 20, 2, -14, -14, 14, 18], [0, 70, -25, 41, 18, 20, 15, 17, 10, -22, -42, -10], [68, -30, 39, 0, 0, 112, 19, -31, -30, -30, 30, 22], [0, -53, -12, 46, 42, 8, 13, -21, 9, 7, 9, 1], [-122, -4, -31, 0, 0, 7, 30, 7, -4, -4, 4, -5], [-86, -3, 23, 0, 0, -1, -5, 80, -3, -3, 3, -10], [0, -37, -18, 4, 7, -24, 15, -16, -27, 4, -2, -3], [-89, 2, -41, 0, 0, 28, 32, -64, 2, 2, -2, 34], [0, -42, 15, -84, -20, 34, -21, 33, 28, -6, -18, -6], [0, -68, -49, 21, 54, 2, 35, -17, -12, -4, -32, -14], [-82, -2, 40, 0, 0, 44, 4, -14, -2, -2, 2, 38], [-29, -23, -4, 0, 0, 77, 24, -44, -23, -23, 23, 8], [110, -2, -9, 0, 0, 17, 42, -21, -2, -2, 2, 11], [0, -37, 5, 8, -8, -35, 21, -6, -9, -41, 11, 26], [0, -36, 48, -53, -4, -26, 2, -20, 24, -32, 68, 50], [235, 14, 11, 0, 0, -28, -28, -12, 14, 14, -14, 14], [0, 166, 16, 14, -6, 44, -32, 18, 28, 30, -2, -16], [-26, -1, -17, 0, 0, 35, 1, 38, -1, -1, 1, 32], [0, 54, 24, -40, -12, 24, -28, 8, 20, 24, 16, -4], [39, 4, 43, 0, 0, -24, -25, -18, 4, 4, -4, -12], [0, -25, 35, 20, -24, 33, -29, 28, 39, -5, 7, 6], [-40, 14, -40, 0, 0, -4, -10, 52, 14, 14, -14, 38], [-127, -9, 11, 0, 0, -4, -26, 73, -9, -9, 9, -31], [0, -11, 8, 4, 3, -24, 19, -8, 3, -38, 16, 27], [0, 54, -2, -54, -14, -50, 22, -14, -30, -28, 12, 20], [181, 8, 18, 0, 0, 6, 3, -25, 8, 8, -8, 30], [0, 90, -26, -67, -2, -18, 26, 10, -18, -36, -36, 0], [47, 10, -47, 0, 0, -38, 68, -2, 10, 10, -10, -8], [0, 159, 40, -26, -25, 8, -19, 14, 29, -16, 26, 21], [0, -31, 16, -79, 7, 26, -3, 16, 39, -26, 0, 13], [187, 2, -42, 0, 0, 33, 7, -23, 2, 2, -2, 39], [0, -108, 4, -60, -28, 0, -22, 6, -18, 34, -2, -18], [203, -14, -49, 0, 0, 10, -18, -10, -14, -14, 14, -32], [0, -69, 35, -53, -27, 16, -16, 27, 35, -30, 8, 19], [0, 93, 11, -94, 6, -37, 23, -20, -3, -37, 31, 34], [0, -62, 62, -2, -38, -6, -34, -2, 22, 8, 64, 28], [22, 18, -81, 0, 0, -35, 30, 43, 18, 18, -18, 19], [63, -16, -35, 0, 0, 32, 48, 12, -16, -16, 16, -16], [96, 5, -75, 0, 0, -27, -59, -30, 5, 5, -5, -12], [0, 36, 14, 15, -46, -58, 12, 0, -32, -38, 14, 26], [0, -9, 13, -32, -78, -63, -19, -4, -69, 29, 17, -6], [0, -23, -39, 92, -8, -3, 7, 12, -35, 13, -51, -32], [-308, -30, 60, 0, 0, 98, 52, -54, -30, -30, 30, 8], [223, 34, -12, 0, 0, -132, -37, 97, 34, 34, -34, -30], [0, 57, 14, -70, -21, 52, -19, 54, 47, -30, -40, -5], [0, 110, 26, -62, 8, -14, 26, 4, 38, -82, 22, 52], [0, 196, -16, 16, 44, 40, -8, -12, 16, 44, -4, -24], [-164, 13, -17, 0, 0, 41, 3, 58, 13, 13, -13, 80], [43, 32, -82, 0, 0, -57, 21, -57, 32, 32, -32, 39], [-115, 4, 85, 0, 0, 50, 2, -38, 4, 4, -4, 62], [0, -179, -60, 16, 25, 6, 19, 0, -35, 22, -60, -41], [258, 28, -52, 0, 0, -110, -32, -26, 28, 28, -28, -26], [-23, -26, -5, 0, 0, 122, -20, -30, -26, -26, 26, 44], [0, -77, 77, -4, -48, -63, 5, -10, 19, -77, 87, 82], [-383, 14, 27, 0, 0, -82, 22, 18, 14, 14, -14, -40], [0, 118, 13, -55, -26, -44, 5, -13, -26, -10, 26, 18], [0, 84, 24, 21, -58, 54, -54, 58, 24, 26, -34, -30], [0, -70, -35, -70, 46, -57, 66, -37, -26, -60, 2, 31], [209, -33, 10, 0, 0, 97, 36, -14, -33, -33, 33, -2], [-340, -9, -45, 0, 0, 3, 119, -100, -9, -9, 9, -24], [0, 102, -39, 78, 22, -23, 18, -27, -44, 30, -12, -21], [0, 27, 25, 10, 62, 45, 11, -6, 81, -41, 31, 36], [-77, 0, 93, 0, 0, 52, -36, -50, 0, 0, 0, 52], [0, 111, 38, 13, 3, 28, -19, 6, 47, -6, 32, 19], [-180, -22, -8, 0, 0, 136, 36, -76, -22, -22, 22, 70], [0, 46, -33, 77, -48, 50, -43, 55, -26, 64, -88, -76], [-61, -6, 94, 0, 0, 42, -73, 87, -6, -6, 6, 24], [-42, 6, -48, 0, 0, -106, -42, -78, 6, 6, -6, -88], [139, 38, -19, 0, 0, -204, -88, 26, 38, 38, -38, -90], [0, -266, 60, -38, -42, 26, -20, 48, 66, -68, 12, 40], [73, 21, 85, 0, 0, -90, -130, 17, 21, 21, -21, -27], [-71, 22, 77, 0, 0, -22, 36, -32, 22, 22, -22, 44], [0, 89, 33, -100, -3, 50, -36, 17, 47, 22, 16, -3], [513, 14, -106, 0, 0, -126, -67, 111, 14, 14, -14, -84], [0, -91, 16, 20, -28, 52, -25, 55, 43, -21, -39, -9], [492, -26, -1, 0, 0, 107, 22, -43, -26, -26, 26, 29], [0, 216, 67, 58, -44, 31, -52, 23, 46, 14, 44, 15], [0, 9, -57, -66, 69, 50, 42, 23, 35, -50, -80, -15], [124, 5, 42, 0, 0, 26, -63, -37, 5, 5, -5, 41], [0, 310, -20, 93, 12, 74, -32, 30, 22, 54, -50, -52], [125, 2, -16, 0, 0, 108, -17, -25, 2, 2, -2, 114], [0, -52, -7, 54, -56, -41, 20, 35, -28, -68, -42, 13], [87, -11, -80, 0, 0, -3, -36, -80, -11, -11, 11, -36], [0, 28, 42, -174, 0, 16, -18, -2, 40, -4, 44, 24], [-384, 52, -12, 0, 0, -192, -10, -42, 52, 52, -52, -36], [0, -55, 61, -100, -42, 17, 3, 62, 81, -129, -1, 64], [-123, -28, -7, 0, 0, 6, 56, -92, -28, -28, 28, -78], [0, 83, 13, -20, -62, -33, -33, -4, -53, 57, 17, -20], [-111, 29, -14, 0, 0, 57, -24, 124, 29, 29, -29, 144], [0, -123, -2, 170, 51, 52, -21, -20, 29, 64, 18, -23], [39, -12, 121, 0, 0, 164, -4, 18, -12, -12, 12, 128], [0, 137, 73, 6, -116, 15, -47, 84, 41, -63, -11, 26], [-448, -37, 14, 0, 0, 190, 55, -135, -37, -37, 37, 79], [0, 98, -106, 152, 86, 28, 56, -2, -22, -4, -104, -50], [-304, 4, -155, 0, 0, -72, -19, -45, 4, 4, -4, -60], [0, 8, 99, 0, -96, 144, -153, 87, 90, 120, 12, -54], [393, -68, 34, 0, 0, 136, 49, -135, -68, -68, 68, -68], [0, -218, -13, -138, 14, 3, 14, 3, 4, -18, -16, 1], [0, 50, 8, -112, 92, 124, 0, 32, 132, -40, -24, 8], [0, -330, -72, -10, 86, -84, 88, -82, -68, -22, 10, 16], [360, 20, 42, 0, 0, -56, 136, -68, 20, 20, -20, 4], [0, 124, -122, 128, 136, 42, 42, -52, -38, 90, -70, -80], [0, -99, -1, 4, -4, 49, -33, 20, 15, 47, -21, -34], [0, -168, 46, -36, -60, -64, 2, -2, -16, -48, 48, 48], [-301, 4, 14, 0, 0, -97, 39, 111, 4, 4, -4, -85], [697, 26, 71, 0, 0, -46, -106, -54, 26, 26, -26, 32]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_912_h_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_912_3_h_a();".
// 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_912_3_h_a(:prec:=12)
    chi := MakeCharacter_912_h();
    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_912_3_h_a();".
// 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_912_3_h_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_912_h();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![2659392, 0, 2577312, 0, 865812, 0, 121344, 0, 6673, 0, 142, 0, 1]>],Snew);
    return Vf;
end function;