
// Make newform 9072.2.a.bk in Magma, downloaded from the LMFDB on 09 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_9072_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_9072_2_a_bk();".
// 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_9072_2_a_bk();".
// 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 := [-6, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rfbasis := [Kf.1^i : i in [0..Degree(Kf)-1]];
    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_9072_a();"
function MakeCharacter_9072_a()
    N := 9072;
    order := 1;
    char_gens := [1135, 6805, 3809, 2593];
    v := [1, 1, 1, 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;

function MakeCharacter_9072_a_Hecke( : Kf := Kf)
    return MakeCharacter_9072_a();
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 := 2;
    raw_aps := [[0, 0], [0, 0], [1, 1], [1, 0], [-2, 0], [0, -2], [2, 0], [-5, -1], [1, 0], [-2, 2], [-6, 0], [2, -4], [0, -4], [-2, 2], [0, 4], [-6, 2], [2, 0], [9, 1], [8, -2], [-5, -2], [-2, 2], [-3, -2], [-2, 0], [-12, 2], [-2, -2], [-5, 5], [-14, 0], [12, 0], [-2, -6], [-11, -2], [3, 0], [11, 1], [-2, -4], [-7, -1], [-6, 0], [5, 0], [-1, 3], [10, -4], [-4, -6], [-8, -2], [-6, 6], [-3, 3], [-9, -2], [-13, 2], [2, -6], [-2, -2], [-8, 2], [16, 2], [3, -1], [-11, -5], [-7, 0], [3, 4], [-4, -2], [-15, 1], [18, 4], [-21, 2], [-11, 3], [-12, -2], [-4, 6], [-19, 0], [23, -1], [15, 5], [-13, 5], [-16, 6], [10, 6], [6, -6], [10, 6], [6, 12], [0, 8], [16, 2], [-6, 0], [-1, -4], [4, -4], [-2, 2], [2, 10], [-2, -2], [-20, 2], [24, -6], [-15, 2], [-4, 4], [-27, 1], [18, -2], [-12, 8], [2, 4], [-12, -4], [10, -2], [1, -8], [7, 10], [13, 3], [11, 6], [-10, 0], [10, 8], [7, -12], [-6, 4], [-4, -12], [0, -10], [-12, -2], [-24, -6], [7, -3], [6, 10], [-12, -8], [-8, 2], [13, -11], [-30, 0], [-24, 4], [4, 8], [1, 7], [0, -6], [24, -4], [2, -6], [-6, 6], [0, 6], [14, 12], [-13, 7], [-23, 2], [17, 10], [10, -12], [36, -6], [0, -4], [10, -6], [7, 1], [11, 8], [0, -6], [-42, 4], [-29, 9], [22, 12], [8, -8], [0, 4], [-16, -10], [-15, 1], [6, 8], [-36, 0], [-21, -8], [-6, 12], [2, 0], [10, 18], [7, -11], [-18, -12], [9, 11], [-26, -4], [2, 0], [20, 8], [-16, -12], [12, -10], [16, 6], [40, 2], [-7, -13], [-30, 2], [10, 0], [-7, 2], [-2, -10], [0, -8], [10, -4], [24, 4], [12, 6], [-3, 20], [11, -6], [0, -14], [26, -8], [1, 1], [-28, 10], [26, 12], [-5, 8], [27, 11], [-18, 8], [-6, -16], [-8, -4], [35, -7], [-34, 4], [3, -17], [-22, -10], [13, 3], [-27, -6], [-27, 12], [12, 20], [-20, 0], [6, -10], [-4, 2], [34, -4], [-1, 21], [33, -4], [-2, -16], [-14, -2], [22, 10], [-19, 0], [24, 14], [30, -4], [31, -3], [-21, 0], [-36, -6], [-8, -12], [18, -12], [-28, 6], [23, 7], [18, 6], [-4, -2], [-13, -10], [-8, -4], [-6, 18], [36, 2], [30, -10], [-6, 6], [-1, 13], [0, -10], [27, -7], [9, 5], [34, 10], [24, -8], [-6, -8], [13, -5], [17, -6], [-8, 2], [36, 8], [35, 1], [48, 2], [-10, 0], [-43, -10], [32, -4], [16, 12], [32, -6], [52, 6], [-22, 18], [9, -24], [56, 4], [-30, 16], [-28, -6], [-4, -8], [-1, -4], [-12, 4], [12, 6], [-36, -2], [-19, -21], [29, 2], [18, -8], [-29, 5], [18, -10], [-44, -4], [-6, 12], [36, -6], [-10, -12], [-68, 2], [-2, 8], [-20, 6], [6, 8], [14, 2], [48, -10], [-30, 2], [-53, -3], [-32, 6], [15, 6], [-32, 0], [12, -20], [45, 2], [4, -12], [-64, -2], [-20, -14], [2, -12], [-3, 9], [7, -23], [-16, 22], [-16, 16], [-16, -6], [16, 10], [55, 1], [-60, -2], [50, 0], [30, -8], [4, 4], [-40, -4], [-12, 18], [-12, 6], [-8, -10], [-36, 14], [-32, 8], [-2, 10], [12, -8], [-20, -24], [30, 10], [10, -20], [15, 23], [-12, 0], [24, -4], [18, 18], [-19, 5], [-9, 17], [-17, 0], [21, 20], [-40, -8], [-14, -2], [66, -2], [0, -6], [-69, 5], [-9, -30], [14, 0], [14, 8], [57, 11], [34, -6], [27, -17], [66, 0], [-6, -28], [28, -20], [-36, -18], [-37, -18], [24, -2], [34, 12], [-25, -12], [56, -4], [-7, -7], [-20, 24], [-34, 6], [-18, -6], [34, -4], [-2, -8], [-2, 32], [-19, -6], [20, 4], [-3, 5], [-13, 14], [26, 8], [42, -4], [-38, -8], [-53, 8], [-24, 2], [23, 10], [7, -6], [8, 12], [40, -10], [50, 16], [31, -4], [50, 10], [50, -10], [20, -22], [-12, 22], [-35, 11], [14, 16], [-13, -29], [-30, -2], [22, 24], [-46, -14], [44, -6], [-46, -18], [-3, 6], [0, -18], [-27, -22], [48, -4], [78, 0], [23, -25], [52, -16], [18, -14], [48, 6], [-35, 17], [-67, 4], [0, 28], [-12, -10], [64, 10], [-10, 32], [-22, 14], [15, -25], [-67, 4], [16, -8], [16, -12], [38, -22], [20, 8], [40, 0], [26, 24], [-49, 6], [48, -10], [48, -16], [19, -22], [-32, -2], [-58, -8], [-15, 6], [16, 2], [26, 4], [-14, 12], [3, -15], [-53, -12], [-8, 2], [-10, -14], [32, 26], [33, 11], [-5, 10], [-1, -6], [-33, 12], [-31, -1], [-4, -4], [-8, -28], [-11, -11], [-34, -24], [64, -8], [-58, -12], [-33, -19], [-74, 4], [-35, 13], [-76, 0], [15, -12], [44, 16], [2, -22], [-18, -32], [-70, 2], [-7, -11], [-15, -16], [56, 20], [-8, -20], [-21, -29], [-26, 14], [-26, -12], [63, 14], [-11, -17], [10, -4], [-80, 4], [26, -12], [16, 18], [6, 8], [41, 4], [53, -13], [-80, -4], [-46, 8], [-42, -8], [32, 2], [26, -4], [-31, 9], [1, -30], [21, -23], [-28, -8], [-8, -38], [-16, -10], [21, 0], [-63, -15], [34, 24], [28, 26], [0, 30], [-14, 8], [-34, -12], [67, -15], [88, 0], [67, 2], [8, 40], [-22, 2], [-18, 28], [17, 15], [3, 26], [46, 8], [-21, 2], [44, 22], [-39, -22], [-58, -16], [-88, 6], [-26, -32], [-32, 2], [4, 16], [54, -2], [36, 14], [0, 34], [-23, -10], [36, -12], [-26, -10], [-3, 27], [69, -15], [33, 10], [8, 34], [-23, -8], [-74, 6], [-26, -32], [-26, -24], [5, 4], [5, -4], [2, -4], [-63, -2], [41, -1], [4, -24], [66, -12], [74, 12], [17, 18], [-48, -22], [-24, -10], [12, -8], [16, 18], [-66, 14], [-28, 8], [-36, -20], [72, -14], [78, -2]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_9072_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_9072_2_a_bk();".
// 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_9072_2_a_bk(:prec:=2)
    chi := MakeCharacter_9072_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(3457) - 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_9072_2_a_bk();".
// 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_9072_2_a_bk( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_9072_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<5,R![-5, -2, 1]>,<11,R![2, 1]>,<13,R![-24, 0, 1]>],Snew);
    return Vf;
end function;