
// Make newform 912.3.h.c 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_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_912_3_h_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 := [34596, 0, 84236, 0, 44345, 0, 9728, 0, 1030, 0, 52, 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], [-26118, 0, -38617, 0, -11876, 0, -1338, 0, -62, 0, -1, 0], [0, 248202, 0, -181685, 0, -37996, 0, 2334, 0, 554, 0, 19], [0, -269484, 0, -230032, 0, -67259, 0, -7923, 0, -395, 0, -7], [0, -573918, 0, -394469, 0, -47668, 0, 2334, 0, 554, 0, 19], [24552, -823914, 685286, -1046357, 148087, -355459, 3255, -49218, -713, -2977, -31, -65], [-813006, 1647828, -2046713, 2092714, -808294, 710918, -117924, 98436, -7192, 5954, -155, 130], [-900054, -1608066, -2046713, -1625087, -808294, -489550, -117924, -64410, -7192, -3820, -155, -83], [-11104758, 1647828, -13266605, 2092714, -4261570, 710918, -605616, 98436, -38812, 5954, -899, 130], [-813006, -1727352, -2046713, -3027968, -808294, -1153654, -117924, -166488, -7192, -10222, -155, -224], [0, 134334, 0, -467627, 0, -221368, 0, -34026, 0, -2134, 0, -47], [2661102, -1244826, 8725601, -3495595, 3768298, -1375022, 591108, -200514, 38812, -12356, 899, -271]];
    Rf_basisdens := [1, 1872, 87048, 29016, 58032, 87048, 174096, 87048, 174096, 174096, 29016, 174096];
    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, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0], [0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0], [3, 0, 0, 0, 0, 2, -1, -1, 0, -1, 0, 0], [0, 0, -2, -1, 2, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, -1, 0, -2, 0, 0, -1, 0, 2, 0, 0], [-2, 0, -3, 2, 3, 0, 0, -2, 0, 4, -3, 0], [5, 2, 0, 0, 0, 4, 7, 1, 0, 1, 0, 0], [9, 6, 0, 0, 0, 4, 1, -1, -2, -1, 1, -2], [1, 0, -5, -4, 3, 0, -3, 1, 0, 1, -3, 0], [-5, 3, 0, 0, 0, 1, -5, 0, 2, 0, 2, -4], [2, 0, -1, 3, 4, 0, -6, 2, 0, 2, 0, 0], [3, 0, 5, -2, -3, 0, -9, 3, 0, 3, 3, 0], [-1, 0, -4, 0, -6, 0, -3, -1, 0, 5, -5, 0], [-3, -5, 0, 0, 0, -3, -6, -2, -1, -2, -1, 2], [-34, 4, 0, 0, 0, 4, 4, 2, 0, 2, 3, -6], [-7, 0, -2, 4, 2, 0, 9, -7, 0, 5, -1, 0], [-3, 7, 0, 0, 0, 1, 4, -2, 1, -2, -5, 10], [-2, 0, 0, 0, 0, -10, -4, 4, 0, 4, 3, -6], [5, 0, 1, 2, 2, 0, -18, 5, 0, 8, -4, 0], [-7, 0, -11, 10, 1, 0, 9, -7, 0, 5, -1, 0], [-47, -4, 0, 0, 0, 6, 9, 1, -4, 1, 2, -4], [4, 0, 2, 4, -18, 0, -6, 4, 0, -2, 6, 0], [70, 10, 0, 0, 0, -8, -14, -2, 0, -2, 0, 0], [-2, 0, -8, 6, 4, 0, 0, -2, 0, 4, -2, 0], [-6, 2, 0, 0, 0, 6, 12, 2, -6, 2, 3, -6], [10, 0, -5, -6, 5, 0, -12, 10, 0, -8, 1, 0], [-16, 10, 0, 0, 0, 14, 14, -2, 0, -2, -3, 6], [10, 0, 3, 3, 0, 0, -12, 10, 0, -8, 2, 0], [-8, 0, -6, -7, -6, 0, 18, -8, 0, -2, 6, 0], [-33, -15, 0, 0, 0, 3, -3, -2, 4, -2, -2, 4], [4, 0, 2, -3, 6, 0, -6, 4, 0, -2, 12, 0], [53, 20, 0, 0, 0, 20, 5, -7, 4, -7, -5, 10], [-20, -4, 0, 0, 0, -4, 32, 8, -4, 8, -4, 8], [-62, -12, 0, 0, 0, -12, 0, 6, -6, 6, 6, -12], [8, 0, 6, -14, -14, 0, 6, 8, 0, -22, 3, 0], [4, 0, -9, 14, -7, 0, -6, 4, 0, -2, 14, 0], [4, 0, 14, 14, -22, 0, -6, 4, 0, -2, 9, 0], [-42, 24, 0, 0, 0, -4, -4, 4, 4, 4, 4, -8], [4, 0, 5, -9, 8, 0, 6, 4, 0, -14, 8, 0], [-90, 26, 0, 0, 0, -6, 36, 14, 6, 14, -3, 6], [14, 0, 16, 0, 8, 0, -18, 14, 0, -10, -8, 0], [-15, -3, 0, 0, 0, -9, 21, 8, -6, 8, 0, 0], [149, -4, 0, 0, 0, 14, -7, -5, 8, -5, -1, 2], [19, 0, 0, 0, 0, -8, 1, 11, 12, 11, 6, -12], [-13, 0, -26, 2, 10, 0, 9, -13, 0, 17, -13, 0], [-15, 31, 0, 0, 0, -11, 22, 12, 5, 12, -1, 2], [-4, 0, 24, 9, 24, 0, 24, -4, 0, -16, 22, 0], [10, 0, 15, 5, -28, 0, 6, 10, 0, -26, 28, 0], [65, 26, 0, 0, 0, 28, 37, 7, 2, 7, 5, -10], [-12, 0, -9, 17, 0, 0, 0, -12, 0, 24, -16, 0], [-4, 0, 15, -4, 1, 0, 30, -4, 0, -22, 0, 0], [12, 0, 9, -33, 36, 0, -18, 12, 0, -6, -10, 0], [7, 0, 11, -6, 39, 0, -21, 7, 0, 7, -9, 0], [-10, 4, 0, 0, 0, -24, 6, 2, 4, 2, -14, 28], [127, -37, 0, 0, 0, -35, -8, 6, 5, 6, -7, 14], [-8, 0, -11, -46, -21, 0, 18, -8, 0, -2, 16, 0], [133, 33, 0, 0, 0, -1, 65, 24, -2, 24, 4, -8], [-12, 0, 5, 4, -5, 0, 30, -12, 0, -6, -20, 0], [110, 32, 0, 0, 0, 10, -8, -16, -4, -16, -13, 26], [8, 0, 53, 9, -16, 0, 12, 8, 0, -28, 26, 0], [100, 0, 0, 0, 0, 8, 20, 0, 0, 0, -6, 12], [3, 0, 3, -8, -5, 0, -33, 3, 0, 27, -8, 0], [226, -28, 0, 0, 0, -50, -20, 8, 4, 8, -5, 10], [161, 16, 0, 0, 0, -30, -87, -19, 0, -19, 0, 0], [-20, 0, 11, 61, 0, 0, 30, -20, 0, 10, -6, 0], [139, 5, 0, 0, 0, 7, 22, 12, -1, 12, 11, -22], [14, 0, 18, 24, -42, 0, -42, 14, 0, 14, -6, 0], [14, 0, -21, -15, 0, 0, -78, 14, 0, 50, 2, 0], [-52, 20, 0, 0, 0, -24, -78, -16, -6, -16, 6, -12], [-136, 26, 0, 0, 0, 42, 36, -12, -2, -12, -14, 28], [-162, 54, 0, 0, 0, 24, -18, -2, 4, -2, 16, -32], [-7, 0, -20, -62, 24, 0, 39, -7, 0, -25, 32, 0], [-2, 0, 20, -9, -12, 0, 24, -2, 0, -20, -2, 0], [-165, -7, 0, 0, 0, 11, -22, -16, -5, -16, -5, 10], [18, 0, 45, 44, -21, 0, -48, 18, 0, 12, 11, 0], [-63, 56, 0, 0, 0, 74, 11, -35, -4, -35, -19, 38], [-43, 0, 9, 32, -10, 0, 78, -43, 0, 8, -2, 0], [91, -28, 0, 0, 0, -2, 37, 19, -8, 19, 13, -26], [-1, 0, 34, -30, 18, 0, 33, -1, 0, -31, 35, 0], [36, -60, 0, 0, 0, 8, 8, 2, 0, 2, 3, -6], [32, -62, 0, 0, 0, -16, 2, 8, -4, 8, 5, -10], [-10, 0, -33, 17, 28, 0, 24, -10, 0, -4, -64, 0], [8, 0, -3, -20, -13, 0, 6, 8, 0, -22, -4, 0], [-143, -7, 0, 0, 0, -69, -30, 8, -5, 8, -5, 10], [-18, 0, -18, 83, -14, 0, 12, -18, 0, 24, -10, 0], [-139, -11, 0, 0, 0, -17, 7, -20, -8, -20, -38, 76], [0, 0, -5, -25, 16, 0, -42, 0, 0, 42, -34, 0], [-11, 0, -33, 32, 22, 0, 24, -11, 0, -2, -58, 0], [95, 96, 0, 0, 0, 6, -57, -19, 8, -19, -1, 2], [13, 0, 9, 16, -10, 0, -60, 13, 0, 34, -44, 0], [-83, -17, 0, 0, 0, 9, 15, 10, -8, 10, 16, -32], [-11, 0, 47, 24, 30, 0, -12, -11, 0, 34, 30, 0], [21, 0, -7, -14, 25, 0, -3, 21, 0, -39, 18, 0], [-6, 0, 19, 20, -11, 0, 12, -6, 0, 0, -31, 0], [-102, 22, 0, 0, 0, 62, 110, 24, 20, 24, 2, -4], [197, -117, 0, 0, 0, -3, -30, -18, -9, -18, -9, 18], [5, 34, 0, 0, 0, 30, -75, -37, 4, -37, -5, 10], [34, 0, 10, -27, -98, 0, -42, 34, 0, -26, 42, 0], [17, 0, -48, -64, 8, 0, -3, 17, 0, -31, 4, 0], [3, 0, 21, 50, 81, 0, -57, 3, 0, 51, -20, 0], [162, -40, 0, 0, 0, 12, -6, 14, 16, 14, 22, -44], [29, -13, 0, 0, 0, 109, 10, -34, 19, -34, -11, 22], [28, 0, 11, 3, -36, 0, -72, 28, 0, 16, 46, 0], [-44, 0, -8, 50, 12, 0, 78, -44, 0, 10, 22, 0], [-26, 0, -50, 8, -10, 0, -6, -26, 0, 58, -39, 0], [-113, -30, 0, 0, 0, -40, -139, -31, -2, -31, 4, -8], [-95, 30, 0, 0, 0, -48, -27, 9, -24, 9, 15, -30], [211, -101, 0, 0, 0, -39, -30, 28, 21, 28, 27, -54], [-48, 0, -6, 25, 10, 0, 114, -48, 0, -18, 16, 0], [62, -66, 0, 0, 0, -22, -16, 24, 26, 24, 20, -40], [335, -9, 0, 0, 0, -75, 93, 52, -12, 52, 0, 0], [-7, 0, 31, 34, -5, 0, -39, -7, 0, 53, -50, 0], [75, -63, 0, 0, 0, -49, -43, 22, 20, 22, 20, -40], [10, 0, -15, -63, -20, 0, -36, 10, 0, 16, -18, 0], [-20, 0, -54, 3, 42, 0, 42, -20, 0, -2, -48, 0], [8, 0, -10, 82, -28, 0, -36, 8, 0, 20, 26, 0], [-8, 6, 0, 0, 0, 46, -20, -12, -14, -12, 22, -44], [-155, 6, 0, 0, 0, 0, -45, -25, 6, -25, -18, 36], [10, 0, 75, 10, 29, 0, 72, 10, 0, -92, 59, 0], [39, 0, 36, -6, 110, 0, -45, 39, 0, -33, -9, 0], [211, 23, 0, 0, 0, 149, 71, -12, -22, -12, 32, -64], [66, 0, -26, 0, 26, 0, -138, 66, 0, 6, -10, 0], [246, -116, 0, 0, 0, 24, -30, -34, -8, -34, -20, 40], [20, 0, -43, 27, -52, 0, -78, 20, 0, 38, -74, 0], [399, -103, 0, 0, 0, 75, -3, -30, -24, -30, 6, -12], [-488, 20, 0, 0, 0, -44, -38, 8, -30, 8, 24, -48], [393, 75, 0, 0, 0, -79, -37, -18, -12, -18, -42, 84], [20, 0, -36, 64, 50, 0, -42, 20, 0, 2, 1, 0], [68, -92, 0, 0, 0, 62, -136, -46, -4, -46, 32, -64], [465, 73, 0, 0, 0, 39, 102, 30, -3, 30, 15, -30], [-12, 0, 62, 5, -82, 0, 90, -12, 0, -66, 18, 0], [-13, 79, 0, 0, 0, 5, -10, 12, -15, 12, 33, -66], [23, 0, 27, -64, -157, 0, -21, 23, 0, -25, 48, 0], [-52, -100, 0, 0, 0, -136, -28, 36, 24, 36, -12, 24], [42, 0, 83, 48, -51, 0, -120, 42, 0, 36, -1, 0], [42, 0, -72, -133, 68, 0, -114, 42, 0, 30, -20, 0], [227, -50, 0, 0, 0, -46, 107, 13, -12, 13, -51, 102], [-30, 0, 30, 29, 14, 0, 90, -30, 0, -30, 18, 0], [-575, 69, 0, 0, 0, 47, 95, -8, 0, -8, -36, 72], [50, 0, -42, -128, 26, 0, -78, 50, 0, -22, 15, 0], [-308, 66, 0, 0, 0, 114, -108, -60, 2, -60, 20, -40], [-20, 0, 30, -18, -56, 0, 0, -20, 0, 40, 2, 0], [552, -130, 0, 0, 0, -142, -4, 36, -6, 36, -12, 24], [41, 0, 21, 24, -27, 0, -99, 41, 0, 17, -8, 0], [445, -27, 0, 0, 0, 35, -163, -76, -22, -76, -4, 8], [-3, 0, -44, 24, -48, 0, 81, -3, 0, -75, 40, 0], [522, -64, 0, 0, 0, 60, 60, -12, 8, -12, -22, 44], [-26, 0, -30, 81, 42, 0, -36, -26, 0, 88, -24, 0], [-593, -57, 0, 0, 0, -35, 55, 48, 26, 48, 14, -28], [53, 0, -12, 8, 58, 0, -105, 53, 0, -1, -25, 0], [-517, -82, 0, 0, 0, -172, -7, 47, -20, 47, -2, 4], [62, 0, -24, 10, -68, 0, -132, 62, 0, 8, 26, 0], [454, 76, 0, 0, 0, -4, 8, 46, 14, 46, 56, -112], [66, 0, 72, 16, -12, 0, -156, 66, 0, 24, -42, 0], [-155, 209, 0, 0, 0, 15, 66, -10, 1, -10, -41, 82], [28, 0, -23, -54, -89, 0, -126, 28, 0, 70, 12, 0], [-45, 0, -37, 0, 6, 0, 54, -45, 0, 36, 16, 0], [-10, 0, 87, -104, -39, 0, 84, -10, 0, -64, 57, 0], [-16, 80, 0, 0, 0, 88, 88, 20, 20, 20, 20, -40], [50, 0, 6, 0, 52, 0, -168, 50, 0, 68, -70, 0], [-27, 0, -99, 6, 41, 0, 105, -27, 0, -51, 3, 0], [-28, 0, 0, 72, -12, 0, 72, -28, 0, -16, 26, 0], [147, -180, 0, 0, 0, -46, -55, -11, 8, -11, -16, 32], [69, -177, 0, 0, 0, -159, -54, 30, 19, 30, -17, 34]];
    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_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_912_3_h_c(: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_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_912_3_h_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_912_h();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![6718464, 0, 10134720, 0, 4159881, 0, 398684, 0, 14238, 0, 204, 0, 1]>],Snew);
    return Vf;
end function;