
// Make newform 4725.2.a.bk in Magma, downloaded from the LMFDB on 09 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_4725_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_4725_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_4725_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 := [3, -4, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [0, 1, 0], [-3, 0, 1]];
    Rf_basisdens := [1, 1, 1];
    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_4725_a();"
function MakeCharacter_4725_a()
    N := 4725;
    order := 1;
    char_gens := [4376, 1702, 2026];
    v := [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_4725_a_Hecke( : Kf := Kf)
    return MakeCharacter_4725_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, 1], [0, 0, 0], [0, 0, 0], [1, 0, 0], [0, 1, 0], [-1, -1, -1], [-3, 2, 1], [2, -3, -1], [0, -1, 1], [0, -1, 1], [-1, -1, -3], [2, -3, 1], [0, 5, -2], [-7, -1, 0], [-3, -1, -3], [-6, -1, 2], [0, -3, 4], [-4, 4, -1], [5, 0, 6], [-3, 5, 0], [-1, 4, -2], [-1, 4, -2], [-3, -1, -4], [0, -4, -2], [2, 4, 0], [0, -7, 1], [5, 2, -5], [-15, -2, 0], [-7, -2, 2], [-3, 4, 3], [-13, 1, 3], [-3, -4, 1], [-9, 4, -5], [-1, -4, 4], [3, 3, 1], [2, -3, 0], [-1, -2, 4], [11, -8, -6], [-9, 2, 1], [-9, 3, -2], [9, -2, -3], [-1, -2, 0], [3, 13, -4], [-10, 1, 2], [6, -2, 1], [-1, 3, 9], [-1, 1, -3], [2, 6, -8], [0, 2, -9], [5, 5, 2], [9, 8, -5], [18, 0, 5], [-4, 6, -5], [0, -5, -5], [-12, 5, -6], [0, -4, -10], [-12, 3, 7], [11, -4, 11], [8, 1, 10], [12, -7, 2], [-16, -1, 4], [0, 7, 6], [-13, 2, -6], [-15, -2, -3], [8, -9, 3], [-3, -4, -3], [-1, 1, 7], [8, -7, -9], [-6, 11, 10], [2, 11, 3], [-27, 4, -3], [-12, 7, 0], [-10, 5, -10], [-4, 5, -11], [8, -8, 7], [3, -4, 13], [-15, 4, 6], [-1, -4, 7], [0, 11, -8], [2, -1, 8], [3, -3, -1], [5, 1, 5], [21, -4, 12], [2, -4, 2], [-10, -7, 9], [-15, -1, -5], [9, -16, -8], [-16, -8, 4], [-6, 14, -7], [8, 8, -9], [-6, 3, 7], [27, -6, -7], [-7, 14, 5], [18, 2, 0], [-1, 1, -5], [-3, 1, 5], [-24, -9, 2], [0, 2, 9], [11, -1, 8], [14, -10, 15], [8, -10, 2], [12, -7, -1], [-18, -5, 3], [0, 4, 4], [-4, 12, 9], [-13, 8, -3], [-15, -2, -4], [-9, -12, -2], [-3, -2, 10], [-1, -16, 9], [14, 2, 13], [14, 0, 4], [24, -9, 7], [-1, -6, 12], [-1, 13, 5], [21, 10, -1], [-37, -1, 0], [-18, -1, 3], [0, -3, 0], [-3, -11, 15], [-13, 2, -3], [23, -7, -11], [0, 3, -14], [-12, 2, 12], [-7, -8, -2], [18, -2, -1], [-7, -21, 2], [-12, 7, -13], [-19, -7, -8], [-10, 8, 16], [20, 11, -9], [-12, 19, -1], [8, 5, 11], [-10, 15, -11], [27, 4, 10], [8, -17, 8], [3, -17, 3], [14, -20, -9], [15, -5, -6], [9, -15, -4], [8, -16, -5], [21, -19, -9], [-13, -22, 3], [15, -10, 24], [17, 0, -1], [-24, 8, 4], [2, 14, -12], [42, -1, -2], [11, 1, -6], [0, 5, 17], [20, 14, -11], [-15, 7, 19], [5, 4, 1], [-6, -8, -13], [26, -7, 20], [-18, 12, 6], [-16, 13, -8], [-27, 10, -6], [-13, 8, -9], [27, -6, 3], [-12, -3, -16], [-27, -4, -8], [11, 3, 4], [-27, 4, -23], [21, -8, 8], [-18, 8, 4], [-1, 18, 5], [-37, 12, 3], [17, -15, -7], [24, -17, -4], [9, -6, -3], [5, 25, -16], [-3, -16, -9], [20, 8, 9], [-1, 13, 10], [-33, 5, 4], [-22, 20, -5], [42, -3, 9], [-1, 5, -16], [-19, -3, 0], [-7, -5, -10], [-3, -13, -3], [-7, 0, -22], [12, -3, 27], [-3, 1, -13], [-6, -3, 14], [-1, -18, 8], [-4, 4, -15], [11, 16, -15], [6, -9, 20], [-19, -15, 1], [-24, 14, -6], [8, -15, -7], [27, 2, -1], [-27, -9, -11], [-15, 6, -15], [17, -8, -13], [17, -12, -6], [3, 0, -20], [0, 32, -3], [-18, 20, -14], [-40, 3, 5], [11, 9, 11], [23, 4, 9], [-39, 0, -16], [18, -6, 7], [-28, 0, 9], [-12, -7, -15], [12, 4, 18], [17, 13, -14], [5, 12, 17], [-12, 12, 23], [-4, -21, 5], [-39, 10, 7], [15, -17, -18], [-4, 11, -9], [-10, 9, -9], [-15, 25, -13], [-6, -8, -4], [-18, -4, 6], [-4, -18, -6], [26, -19, -4], [-18, -17, -6], [8, 10, -15], [-30, 8, 14], [-37, 11, -12], [24, -17, 9], [48, -13, 3], [-7, -2, 11], [-33, -5, 11], [-10, 17, 9], [-19, -3, -10], [5, -28, 5], [36, -1, -5], [41, 8, -7], [0, -23, -6], [17, -15, -17], [3, -26, 19], [18, -28, -1], [-27, 4, -18], [-21, -22, -1], [32, -9, -2], [-1, 5, 16], [-22, 10, -22], [-21, 0, -9], [-6, 8, 20], [5, -8, -16], [-12, 30, -1], [20, -21, 5], [-6, -27, -2], [14, 2, -4], [0, 10, -27], [-42, -6, 4], [5, 18, -19], [9, 20, -6], [3, -17, 7], [-43, 6, -3], [-25, -4, -17], [33, 2, 3], [41, -22, -9], [-7, -6, 12], [27, -2, -7], [32, -19, -11], [-4, 7, -19], [21, -22, 22], [2, 29, -5], [-15, -11, 12], [6, -11, -23], [-28, 20, 18], [-3, 24, -19], [-13, -24, 12], [-13, 24, 13], [-22, 15, 24], [5, 0, -18], [17, -3, -17], [17, 2, 24], [-51, 13, -8], [41, -6, -16], [-16, 19, 16], [-18, 9, -27], [-39, 9, -18], [44, 2, -8], [6, 18, -22], [38, 4, 11], [20, 1, -9], [-42, 5, 9], [2, 1, 3], [-9, -2, -25], [5, -16, 0], [9, 6, 2], [6, 4, 5], [18, 3, 13], [-21, -3, 23], [-30, -30, 5], [8, 5, 34], [0, -20, -6], [2, 4, -16], [-6, -9, 10], [3, 4, -1], [29, 22, -4], [41, 17, 2], [12, -11, -21], [32, -19, 8], [-39, -6, 6], [26, -7, 28], [-4, -9, 8], [-27, -9, -15], [-4, 13, -16], [27, -26, -11], [17, -10, -5], [33, 0, 1], [3, 9, 10], [21, -11, -5], [2, -21, 27], [-18, -32, 17], [-79, 7, 4], [15, 1, -28], [-30, 23, -11], [41, -4, 13], [-3, 9, -15], [-34, 10, -12], [-43, -2, -15], [-6, -3, -20], [-19, 1, -12], [18, -12, 10], [-22, 15, 2], [-4, -21, -8], [14, -29, 11], [-18, 2, 10], [-6, 23, -27], [-16, 11, 24], [-12, 11, 22], [-52, 5, -21], [-9, -9, -14], [-10, -11, -12], [-48, 23, 5], [-58, 3, -3], [63, 17, -3], [-31, 9, 24], [-22, -13, 6], [32, -34, -20], [18, 16, -15], [-12, 4, 26], [17, -15, 12], [27, 1, -22], [24, -1, -16], [14, 1, 4], [-19, 14, -17], [-69, 11, 0], [6, 2, 11], [14, 22, -11], [-10, 10, -39], [21, 12, 7], [5, -16, 26], [53, -18, 4], [-30, 11, 3], [39, -3, 6], [-9, -4, 7], [39, -8, -24], [-24, 3, 11], [32, 5, 2], [15, 4, 27], [-42, 11, 1], [-39, 29, 20], [29, -13, 32], [-7, 36, -20], [27, 5, -13], [-16, 28, 1], [-10, 41, 2], [57, -3, -17], [-22, 15, -20], [57, -15, -6], [54, -17, 6], [44, -29, -16], [86, -5, -1], [-3, 6, 24], [-87, 1, -2], [-10, -18, 9], [0, -7, -36], [-37, -6, -5], [-30, 1, 1], [3, -4, 3], [-40, 8, 0], [39, -12, -20], [44, 19, -16], [-33, 14, -5], [-22, -1, -3], [32, 25, -5], [35, -31, -14], [-3, 20, 1], [-40, -5, 0], [15, 9, -8], [12, 8, 0], [-22, 33, -24], [-51, 0, -2], [-40, 19, 6], [20, 19, -12], [0, 19, -17], [-1, -4, -5], [39, -1, -19], [44, -11, 35], [3, -9, 14], [26, -5, 5], [30, -2, -20], [48, -15, -1], [2, 26, -20], [2, -40, 1], [6, -20, 9], [8, 11, -3], [6, -16, -5], [62, -1, 11], [-18, 38, 1], [-3, 34, -1], [-19, -31, 11], [20, 12, 8], [-24, -8, -24], [18, -28, -2], [-37, 27, 5], [-15, -12, -1], [24, 11, 27], [9, -23, -32], [-37, 42, 17], [-24, -13, 16], [21, -9, 32], [-52, -1, -16], [30, 21, -1], [-24, -3, -7], [12, -12, 36], [32, -16, 13], [18, -7, 17]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_4725_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_4725_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_4725_2_a_bk(:prec:=3)
    chi := MakeCharacter_4725_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(2999) - 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_4725_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_4725_2_a_bk( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_4725_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![3, -5, 0, 1]>,<11,R![3, -4, -1, 1]>,<13,R![1, -5, 4, 1]>,<37,R![-61, -38, -3, 1]>],Snew);
    return Vf;
end function;