
// Make newform 2925.2.a.t in Magma, downloaded from the LMFDB on 25 December 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_2925_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_2925_2_a_t();".
// 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_2925_2_a_t();".
// 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
        Kf := Rationals();
    end if;
    return [Kf!elt[1] : elt in input];
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_2925_a();"
function MakeCharacter_2925_a()
    N := 2925;
    order := 1;
    char_gens := [326, 352, 2251];
    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_2925_a_Hecke( : Kf := Kf)
    return MakeCharacter_2925_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 := [[2], [0], [0], [3], [5], [-1], [5], [2], [-1], [-10], [-2], [3], [9], [4], [10], [9], [0], [-11], [4], [-15], [-6], [-11], [8], [11], [9], [12], [-4], [3], [16], [2], [-14], [-6], [6], [-17], [7], [-12], [-22], [11], [-8], [-2], [6], [-23], [20], [-13], [-12], [4], [-4], [0], [-18], [-14], [-25], [-15], [-14], [-20], [18], [0], [-32], [-2], [-26], [10], [8], [24], [19], [-24], [10], [12], [32], [-4], [-1], [20], [-14], [-16], [-8], [-16], [6], [-18], [24], [19], [18], [-26], [-26], [32], [16], [-24], [-33], [35], [-15], [13], [-3], [-5], [-29], [-5], [-7], [-16], [34], [12], [-21], [22], [20], [38], [0], [-30], [-41], [-16], [17], [21], [42], [-36], [-4], [-5], [40], [-3], [22], [-2], [0], [36], [-1], [21], [-30], [-12], [-16], [-22], [-7], [4], [6], [4], [20], [-12], [-6], [15], [38], [6], [-45], [-36], [14], [-12], [24], [-44], [-5], [6], [-4], [41], [48], [-42], [14], [-7], [-51], [-17], [35], [-22], [-22], [14], [-12], [-15], [-2], [-8], [29], [-21], [-2], [23], [36], [-11], [40], [0], [12], [36], [39], [16], [-22], [45], [4], [26], [24], [53], [-5], [-24], [-58], [-17], [-28], [-2], [-49], [36], [38], [42], [54], [-8], [24], [41], [-4], [31], [-20], [38], [21], [33], [-36], [1], [18], [10], [-24], [31], [-50], [-15], [9], [21], [19], [15], [-34], [-52], [-21], [11], [-28], [18], [28], [-6], [60], [-4], [36], [-18], [6], [42], [-61], [34], [46], [36], [47], [29], [15], [30], [58], [41], [8], [-25], [20], [-12], [14], [-26], [-32], [-6], [46], [-44], [24], [-17], [24], [-16], [-44], [0], [56], [-15], [32], [-16], [-10], [-50], [26], [-79], [-49], [-29], [-42], [7], [-66], [25], [38], [57], [-48], [16], [-14], [1], [-33], [11], [29], [58], [6], [-67], [-11], [32], [-26], [21], [72], [60], [20], [-22], [7], [-64], [24], [42], [64], [8], [-28], [16], [10], [-16], [-36], [12], [-16], [12], [62], [54], [-64], [-69], [56], [-1], [-18], [-28], [-11], [73], [-32], [-5], [-7], [-57], [24], [32], [39], [-10], [-46], [-60], [-12], [-27], [-21], [5], [-74], [-84], [52], [74], [30], [-1], [-14], [-1], [-78], [-29], [27], [78], [-2], [7], [40], [24], [24], [-90], [70], [-92], [-38], [26], [-43], [15], [71], [20], [-54], [0], [-15], [-77], [-48], [75], [-62], [-61], [41], [-58], [-37], [-26], [65], [28], [2], [-54], [62], [-72], [-28], [-60], [14], [24], [8], [-17], [-11], [-66], [-4], [-16], [-6], [47], [-68], [-9], [38], [61], [-56], [2], [42], [-62], [-88], [86], [-12], [88], [94], [80], [-72], [-57], [-24], [-30], [25], [8], [49], [34], [-14], [70], [-37], [-14], [70], [95], [-71], [4], [-67], [-89], [58], [62], [-95], [-57], [74], [-81], [51], [-77], [-74], [26], [51], [-34], [72], [93], [38], [47], [52], [108], [-38], [-36], [55], [29], [-14], [-10]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_2925_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_2925_2_a_t();".
// 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_2925_2_a_t(:prec:=1)
    chi := MakeCharacter_2925_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_2925_2_a_t();".
// 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_2925_2_a_t( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_2925_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![-2, 1]>,<7,R![-3, 1]>,<11,R![-5, 1]>],Snew);
    return Vf;
end function;