
// Make newform 7056.2.a.o in Magma, downloaded from the LMFDB on 05 March 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_7056_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_7056_2_a_o();".
// 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_7056_2_a_o();".
// 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_7056_a();"
function MakeCharacter_7056_a()
    N := 7056;
    order := 1;
    char_gens := [6175, 1765, 785, 4609];
    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_7056_a_Hecke( : Kf := Kf)
    return MakeCharacter_7056_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], [-2], [0], [2], [3], [8], [-1], [8], [-4], [3], [-1], [6], [-11], [-6], [12], [-4], [6], [-13], [-10], [11], [3], [-2], [0], [-10], [10], [11], [0], [-11], [14], [-3], [2], [-4], [-5], [12], [8], [-2], [4], [2], [16], [6], [15], [6], [11], [-8], [8], [4], [8], [18], [-1], [-14], [18], [-14], [0], [18], [12], [-2], [-24], [17], [-20], [19], [-24], [-23], [2], [17], [24], [-17], [21], [24], [14], [-6], [-20], [5], [-5], [-13], [28], [-10], [-3], [12], [19], [-18], [-27], [-30], [25], [24], [-4], [-22], [13], [4], [11], [-34], [28], [19], [-36], [29], [30], [18], [-36], [-31], [-15], [12], [-22], [46], [-6], [21], [41], [-32], [-6], [-12], [1], [-3], [-30], [-26], [-11], [16], [40], [35], [-6], [6], [-28], [29], [-1], [12], [36], [-43], [8], [14], [6], [-23], [-45], [9], [-18], [-15], [42], [8], [-31], [22], [24], [-48], [-22], [-32], [-2], [-40], [54], [11], [4], [-23], [0], [8], [46], [-38], [48], [-29], [6], [-21], [48], [11], [6], [49], [52], [10], [28], [31], [-36], [18], [12], [-11], [1], [5], [-48], [16], [50], [-12], [-27], [63], [16], [3], [22], [-16], [13], [33], [-32], [13], [-20], [-2], [-36], [-18], [-55], [-39], [-30], [-49], [30], [8], [-28], [36], [-40], [11], [-2], [-30], [36], [-6], [45], [-38], [30], [54], [18], [-16], [-6], [36], [-4], [23], [40], [12], [-52], [-12], [-47], [-64], [-4], [-52], [46], [49], [55], [6], [-40], [-30], [26], [-40], [-74], [-27], [30], [9], [-20], [11], [18], [-49], [18], [59], [66], [60], [26], [26], [-1], [-1], [-18], [-40], [-60], [33], [10], [40], [24], [-23], [0], [-66], [11], [-16], [8], [53], [33], [-14], [-14], [-25], [40], [-25], [-31], [30], [-17], [-18], [-62], [-76], [-78], [-39], [76], [-69], [-77], [38], [36], [-82], [27], [-29], [-48], [-72], [75], [-6], [-35], [-84], [50], [9], [10], [23], [-6], [12], [-36], [18], [-4], [-25], [-42], [-37], [-36], [54], [-15], [2], [-66], [20], [-60], [-35], [-43], [-2], [-5], [-16], [-25], [60], [-10], [-10], [16], [-8], [55], [18], [-8], [31], [54], [-37], [-89], [30], [83], [-22], [-41], [7], [-53], [-28], [34], [53], [34], [-45], [34], [-61], [-94], [42], [28], [-5], [-17], [-37], [0], [72], [33], [-78], [-6], [-53], [4], [-42], [18], [20], [26], [-42], [-24], [-5], [-70], [62], [-36], [-8], [-94], [-86], [62], [58], [62], [-65], [-10], [72], [21], [-50], [68], [91], [54], [2], [-35], [-83], [-48], [80], [-46], [-28], [-89], [72], [-76], [-16], [12], [-92], [68], [-5], [50], [-13], [-26], [-55], [-18], [-52], [-55], [46], [-54], [4], [98], [-33], [-86], [82], [-36], [-40], [-38], [-6], [-85], [-2], [60], [59], [76], [14], [4], [-16], [-12], [-7], [50], [-10], [91], [12], [-40], [64], [-59], [8], [42], [-38], [82], [94], [-72], [60], [-8]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_7056_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


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