
// Make newform 6080.2.a.be in Magma, downloaded from the LMFDB on 10 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_6080_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_6080_2_a_be();".
// 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_6080_2_a_be();".
// 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 := [-2, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [0, 2]];
    Rf_basisdens := [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_6080_a();"
function MakeCharacter_6080_a()
    N := 6080;
    order := 1;
    char_gens := [191, 5701, 1217, 1921];
    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_6080_a_Hecke( : Kf := Kf)
    return MakeCharacter_6080_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, 0], [0, 1], [4, 0], [-2, 1], [2, -2], [-1, 0], [0, 1], [-2, -2], [0, -2], [-2, -3], [2, 2], [0, -3], [8, 1], [-10, -1], [-4, 2], [-6, 0], [0, 4], [0, -2], [10, -2], [0, 2], [-8, -1], [-6, 2], [10, 1], [-14, 0], [-12, 2], [-8, 2], [6, 4], [2, -3], [-4, -6], [-4, 2], [10, -2], [4, 6], [-6, 0], [-8, -4], [10, -2], [-16, 1], [-12, 4], [-2, -5], [-4, -6], [-2, 4], [4, 6], [-6, 1], [10, 4], [-4, -4], [-20, 0], [-12, 2], [0, -2], [-14, -4], [10, 4], [-12, 0], [10, 6], [-4, 6], [-14, -1], [0, -3], [-10, 0], [-4, 0], [2, -6], [10, -2], [16, 3], [-2, 3], [0, -2], [20, 0], [-6, -8], [-10, 1], [-20, -4], [-14, 1], [32, 1], [2, -12], [-14, 2], [-20, 2], [-8, 9], [-2, -5], [-4, 0], [-4, 0], [10, 8], [10, -6], [26, 0], [2, -4], [-12, -4], [6, -6], [-24, 4], [-6, 1], [8, -6], [8, 3], [-22, 4], [-22, 0], [2, 0], [8, 5], [0, 5], [4, -6], [4, 8], [-12, 6], [-12, 10], [8, -3], [6, 6], [18, 4], [-24, 6], [2, 0], [8, -10], [-6, -6], [-16, 2], [2, 12], [-12, 0], [-14, -8], [8, 5], [-14, 8], [0, 2], [-22, -6], [36, 0], [18, 6], [-6, -14], [-4, -14], [4, 8], [26, -2], [-16, 11], [8, -5], [-6, -2], [-4, -2], [-18, 2], [-6, 11], [-2, 15], [16, -10], [-28, -4], [-30, 4], [10, 12], [12, -10], [-24, -3], [18, 4], [-20, -4], [28, 8], [0, -8], [10, 4], [2, -8], [-6, 16], [-34, -3], [-16, 10], [14, -1], [26, -8], [28, 2], [2, 4], [-16, 7], [16, 0], [6, -16], [-32, 2], [-22, 8], [2, 7], [-12, 4], [52, 0], [-10, 7], [18, 4], [8, 1], [20, 2], [-16, 10], [0, -16], [-36, 8], [-38, 0], [-38, -2], [-18, 0], [40, 1], [18, 7], [-8, 11], [-12, 6], [26, 7], [4, -4], [-8, 0], [18, 2], [-6, -2], [18, -10], [-4, 8], [-2, -16], [20, -8], [10, 4], [-8, -8], [18, 8], [28, -6], [2, 0], [-36, 0], [42, 0], [24, 7], [-28, -2], [14, -7], [10, 7], [40, -3], [-22, 4], [38, -5], [0, -6], [2, -16], [36, 10], [18, 7], [-8, -1], [-4, 6], [-10, 6], [32, 11], [10, -15], [-22, -4], [-14, 0], [18, -8], [-56, -1], [38, -6], [40, 4], [-10, 13], [34, -6], [44, -6], [26, -6], [-52, 2], [40, 0], [-38, -4], [36, 2], [34, 4], [-46, 0], [0, 1], [24, 0], [-24, -12], [-14, 6], [-16, 5], [10, 20], [4, -10], [-14, 4], [-34, 2], [0, -12], [26, -2], [48, -3], [-40, -2], [-6, -16], [10, -1], [0, 12], [-36, -10], [12, 6], [34, -4], [-36, -12], [-8, -8], [-54, 6], [-24, -5], [-16, 13], [-30, 16], [26, 16], [4, 10], [8, 12], [32, 2], [36, -2], [-48, -1], [-18, 6], [34, -15], [20, 12], [0, -15], [52, 0], [-36, 4], [16, -1], [18, 12], [18, -16], [64, -1], [26, 4], [-46, -8], [-20, 16], [42, -8], [8, 0], [-26, 7], [26, -6], [-12, -6], [-16, 4], [-22, -8], [30, 3], [-30, -4], [44, 6], [-58, 6], [2, -8], [0, 20], [10, -4], [-18, 16], [-24, 0], [-6, 10], [-20, -10], [2, -7], [-24, 7], [-8, 7], [-18, 10], [-6, -6], [4, 16], [4, 0], [52, 4], [32, -5], [-26, 4], [64, 1], [-44, 8], [34, 8], [-42, -15], [4, -4], [18, 0], [42, 12], [-8, -21], [42, 9], [4, -24], [46, -5], [10, 8], [-32, 2], [10, -8], [12, -4], [8, -13], [-6, 26], [-26, 3], [36, 6], [40, 12], [-4, -14], [-6, 1], [24, -4], [22, 14], [-60, -4], [42, -8], [48, 3], [26, 8], [-22, 4], [8, 10], [-8, -17], [-6, -18], [-28, -14], [-16, -24], [2, -4], [26, 16], [-36, -10], [74, 6], [46, 2], [12, -8], [10, -6], [-70, 6], [28, -10], [-16, -6], [-44, 2], [18, -14], [-6, 16], [-10, 3], [-52, 10], [24, 17], [12, 12], [-24, 3], [38, -12], [18, 3], [18, -16], [-8, 11], [14, 19], [10, -18], [38, -12], [32, -6], [-2, 3], [-44, 10], [58, 8], [-8, -4], [-16, -18], [-14, 18], [-28, -18], [-46, -9], [26, -16], [20, 8], [30, 6], [-54, 11], [20, 16], [-28, -2], [18, -2], [-28, 8], [18, -2], [2, 8], [-52, -12], [36, 20], [8, 29], [10, -27], [42, -2], [20, -12], [-30, -2], [4, -16], [-84, -2], [-16, 15], [6, 4], [-20, -26], [42, -10], [-68, 0], [4, -10], [34, -16], [-22, 0], [-46, 9], [-10, 8], [-54, 0], [-32, -23], [-62, 4], [4, 18], [-68, -2], [12, 0], [2, -6], [-40, 1], [-60, 8], [18, 0], [46, 11], [-100, 0], [24, 5], [0, -12], [-46, 7], [0, 22], [-62, 6], [-4, -18], [58, -8], [-34, 0], [2, -16], [-52, -16], [18, 7], [-50, 16], [-28, 10], [-22, -10], [-6, -16], [24, -10], [28, 20], [18, 27], [-70, 0], [-8, -12], [-68, 4], [-6, -14], [34, -8], [0, -30], [-44, 2], [18, -10], [-12, 24], [38, -8], [-66, 3], [-16, 5], [-60, 8], [-30, -19], [-74, 3], [16, -18], [-6, -16], [-44, 2], [28, -10]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_6080_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


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