
// Make newform 7350.2.a.dp in Magma, downloaded from the LMFDB on 19 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_7350_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_7350_2_a_dp();".
// 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_7350_2_a_dp();".
// 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 := [-20, -15, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [0, 1, 0], [-10, -2, 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_7350_a();"
function MakeCharacter_7350_a()
    N := 7350;
    order := 1;
    char_gens := [4901, 1177, 2551];
    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_7350_a_Hecke( : Kf := Kf)
    return MakeCharacter_7350_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 := [[1, 0, 0], [-1, 0, 0], [0, 0, 0], [0, 0, 0], [1, 1, 1], [-1, 0, -1], [-2, 2, 0], [-1, 0, -1], [3, 0, -1], [4, 1, 0], [0, 0, 1], [3, 0, -1], [3, -2, 1], [-2, 0, 0], [1, 0, 3], [-3, -2, 2], [4, 1, -2], [-2, -2, 2], [-2, -2, -2], [6, 0, 0], [-4, 0, 0], [8, 0, -1], [-4, -2, -1], [2, 2, 2], [8, -1, 2], [8, 0, 0], [8, -2, 0], [6, 2, 1], [6, -4, 0], [-2, 0, -2], [9, -3, -1], [3, 1, -1], [0, 4, 2], [-12, 0, -2], [14, 0, -2], [4, 0, -3], [-9, -2, 1], [8, -2, 2], [-5, 2, -1], [1, 2, 1], [7, 0, -3], [-2, 0, -6], [0, -4, 4], [-10, 1, 0], [5, 2, 1], [10, 0, -2], [-7, 0, -1], [4, 1, 4], [-12, 2, -1], [12, -4, 0], [-4, -2, 2], [8, 2, -2], [-3, 0, -2], [1, 5, 5], [-2, -4, -4], [-8, -2, -4], [10, -1, 2], [10, 4, 1], [-14, 4, 2], [7, 0, 1], [2, -4, -4], [-7, 2, 0], [10, 2, -4], [14, 0, 2], [18, 1, 0], [-8, 0, -3], [11, 2, 5], [2, -1, -4], [8, -4, 0], [-12, -4, 2], [0, -4, 0], [4, -2, 0], [13, -1, 3], [-2, 8, 2], [5, -6, 3], [9, -2, 1], [10, 4, -2], [18, -4, 2], [-1, 2, -7], [-4, 2, -1], [-9, 0, -7], [-4, 6, 4], [6, 4, -6], [12, 0, 4], [18, 0, -3], [-4, 6, -1], [7, -4, -1], [2, 1, 0], [4, 0, -8], [-3, -4, -5], [-10, -4, 6], [4, -8, 2], [-20, -3, 4], [8, -3, 2], [8, 0, 2], [-4, -2, -2], [-14, -5, 6], [9, 6, 1], [24, 2, 6], [12, -6, -4], [-2, 10, -4], [-5, -6, -2], [8, 6, 1], [-5, 4, 7], [0, 2, 0], [8, 7, 2], [-28, -2, 1], [-2, 2, -4], [4, -6, 4], [-16, 2, 5], [19, -7, 1], [-29, 0, 3], [-26, -2, 2], [11, 4, 9], [12, -4, -7], [1, 2, -3], [-6, -2, -10], [13, 0, -5], [-21, -6, -4], [20, -2, 0], [0, -2, -8], [-4, -7, 6], [-23, 2, 0], [-2, 6, 9], [4, 8, 0], [2, -1, -2], [4, -4, -10], [-18, 10, -2], [11, 5, 9], [5, 2, -7], [9, -6, 5], [-31, -2, 1], [-6, -8, 3], [-14, -4, 4], [-19, 0, 5], [-15, 4, 2], [-3, 6, -3], [22, -4, 0], [-12, -8, 9], [-11, -2, 3], [-5, -10, 3], [6, -1, 6], [-16, -2, -8], [0, -6, -1], [-2, -2, 0], [-10, 2, 4], [13, 4, -1], [-16, -6, 8], [-4, -6, 4], [-9, 2, -5], [-23, 2, 3], [25, 4, 3], [4, 8, -4], [16, 10, -6], [-12, 6, 6], [-6, 0, 0], [-24, -4, 4], [-15, 2, -11], [34, -3, 0], [-12, 1, -8], [12, 0, 12], [16, -2, -8], [4, -5, 4], [-21, -7, 7], [2, 6, 2], [3, -2, 1], [2, 0, 7], [-6, -10, -2], [-1, 0, 6], [27, 6, 6], [-8, 7, 6], [-14, -2, -6], [-6, 2, -4], [-8, -5, 10], [16, 4, -5], [18, -4, -2], [1, -8, 7], [-12, -5, -4], [-21, -4, 5], [0, -2, -8], [27, -5, 1], [-17, 9, -1], [-21, -4, 5], [-4, 12, 2], [15, 6, -5], [-38, -1, 2], [-27, -6, -7], [0, 6, 8], [-15, -4, 2], [-2, -2, -8], [-24, 3, 6], [-22, 6, 7], [11, 12, -5], [12, 8, 4], [16, 10, -3], [-14, -8, 0], [27, 2, -5], [10, -12, 4], [-2, 10, -6], [0, -14, 4], [-36, -5, 8], [50, 0, 2], [26, 2, 6], [5, -6, -3], [36, -10, 0], [-11, -2, 0], [30, 0, 6], [32, 6, 13], [15, -4, -9], [-3, 10, 9], [2, -8, -10], [-10, -1, -6], [24, -5, 0], [6, 2, 1], [0, 2, -10], [15, -6, 7], [9, -3, 7], [-7, -12, 9], [17, 6, -3], [-31, 6, 1], [-12, 8, 4], [4, -8, 4], [-11, -6, -11], [25, 3, -13], [-22, -2, -5], [-4, -12, -4], [14, 4, -4], [-26, -4, -2], [13, 5, -5], [-20, -10, 0], [-11, -6, -7], [-33, 2, -7], [-30, -8, 3], [-45, 4, 5], [-10, -6, 6], [-12, -6, -2], [-28, 6, -1], [-27, -10, 8], [-9, -12, 9], [-22, 6, 8], [34, -4, 2], [-11, -2, 11], [-12, -1, -4], [-32, 4, 2], [2, -10, -8], [-18, 12, -6], [23, -13, -3], [-33, 12, -3], [4, -4, -12], [35, -2, 9], [-2, -14, -6], [11, 14, -1], [43, 2, -9], [59, 2, -5], [0, 0, -7], [-61, 3, -1], [0, 6, -16], [8, -8, 0], [7, -14, 2], [-14, 3, 12], [-11, 0, -5], [18, -2, 13], [-22, -8, 8], [14, 0, -2], [-36, 6, 0], [5, -6, 1], [30, 1, 2], [15, -4, 15], [-6, 4, -2], [23, 6, 8], [8, -8, 0], [-8, 2, 12], [-24, 5, 6], [-26, 12, 3], [38, 7, -4], [1, 8, -5], [12, -10, -7], [-4, -2, 14], [-29, 2, 3], [-51, -4, -5], [39, -4, 1], [-2, -16, 3], [-47, 0, -3], [20, 0, 0], [24, 6, 8], [20, 6, -6], [12, -3, 6], [15, 14, 8], [14, 0, 7], [-9, 10, -11], [-30, 8, 2], [8, 2, 9], [8, 8, 12], [11, -8, -11], [-9, -8, -5], [-12, 3, 12], [32, -12, -4], [6, -8, -4], [-51, 0, -1], [2, 8, 12], [20, -16, -4], [-45, -2, -4], [-34, 16, 5], [16, -10, -7], [-20, -6, -16], [26, -4, -10], [22, 6, -1], [-10, 0, -8], [6, 2, -6], [-23, -8, -9], [1, 10, 9], [-36, -4, -8], [2, 6, -4], [40, 12, -8], [5, 8, -19], [-3, -2, -11], [3, 11, -1], [0, 18, 14], [12, -7, -10], [18, 12, -6], [-12, 0, -16], [-22, -12, 18], [24, -5, 8], [-1, 12, -11], [24, 4, 8], [-7, -8, 6], [25, 8, 11], [-16, 2, 0], [28, 0, 6], [36, -4, -9], [-2, -10, 10], [-40, 8, 5], [32, -8, 0], [-4, 0, 4], [-9, 6, -9], [12, 0, 0], [-28, -6, -2], [54, -2, 2], [3, -8, 12], [55, -5, 1], [6, 12, 0], [24, 10, 6], [26, 13, -6], [-10, 12, -3], [-28, -8, -9], [12, -5, 2], [-6, -4, 4], [2, 6, 6], [-50, -6, 2], [-23, 10, 6], [-35, -4, -11], [28, 1, 6], [38, 8, 6], [-3, 11, -5], [0, -6, -8], [38, -10, 6], [-4, -4, 6], [-4, -3, 2], [2, 4, 6], [-12, 0, -10], [-47, 6, 9], [30, -4, -14], [-24, 8, -2], [29, 4, -1], [44, -10, -6], [14, 7, 12], [13, -10, -7], [51, 0, 9], [-5, 0, -14], [17, -15, 1], [13, -18, 3], [20, 0, 10], [-20, -15, -8], [14, -12, 2], [-42, -2, -4], [-19, 0, -5], [22, -14, 8], [14, -3, -4], [14, -14, 10], [36, 12, -4], [-2, -4, -22], [24, -6, 16], [19, -8, 1], [-22, 2, -8], [-59, -4, -1], [-5, 4, -3], [8, -8, -8], [-7, -18, 7], [44, 6, 14], [-8, -10, -6], [24, 10, -15], [-6, 4, 8], [28, -1, -10], [-28, -8, -6], [-26, -6, -6], [20, 11, 2], [48, -4, -3], [-5, -20, -11], [41, 12, -15], [-4, 5, -12], [-14, 22, 4], [-16, 10, -6], [1, -4, -9], [-16, -16, 6], [16, 3, 4], [58, 12, -15], [15, -8, -7], [-14, 4, 0], [10, 8, 4], [-29, 9, 7], [-42, -5, 4], [-16, 12, 5], [56, 6, 11], [-25, 16, 9], [-28, 16, 0], [-46, -5, 6], [54, -8, 6], [15, -8, -7], [32, 10, -10], [-13, 12, 5], [2, 1, 10], [-45, -8, -11], [-24, -2, -8], [-28, -9, -10], [4, -12, 12], [51, 14, -17], [20, 6, -21], [-7, 8, -7], [-43, 2, -3], [14, -8, 6], [-42, 16, 4], [-37, -11, 3], [-21, -10, -7], [-57, 0, -3], [6, 14, -2], [-70, -6, 8], [-28, -14, 11], [-20, 6, -10], [-18, 10, -6], [12, -8, 13], [58, 2, 3], [35, 6, -1], [40, 4, 4], [-4, -4, 6], [1, 20, 8], [-46, -4, 8], [-34, 10, -4], [17, 8, 9], [19, -18, -1], [8, 20, -6], [-18, -8, -12], [-24, 2, -4], [-2, 18, 1], [-3, 10, -1], [22, 11, 16], [0, 7, 12], [54, -6, -8], [27, 5, 7], [-45, 6, 5], [-70, 2, 0], [-9, 12, 5], [18, 4, -2], [-4, 3, 18], [20, 10, -2], [-4, 8, -6], [42, -9, 0], [-12, -12, 4], [-8, -2, -15], [34, 12, 22], [-12, -2, 12], [15, -7, 1], [6, 8, 2], [-46, -4, 8], [-51, 12, 4]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_7350_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_7350_2_a_dp();".
// 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_7350_2_a_dp(:prec:=3)
    chi := MakeCharacter_7350_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(3361) - 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_7350_2_a_dp();".
// 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_7350_2_a_dp( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_7350_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<11,R![49, -27, -3, 1]>,<13,R![-24, -12, 3, 1]>,<17,R![-272, -48, 6, 1]>,<19,R![-24, -12, 3, 1]>,<23,R![8, 12, -9, 1]>,<31,R![10, -15, 0, 1]>],Snew);
    return Vf;
end function;