
// Make newform 9200.2.a.cp in Magma, downloaded from the LMFDB on 20 December 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_9200_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_9200_2_a_cp();".
// 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_9200_2_a_cp();".
// 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, -1, -6, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [0, 1, 0, 0], [-1, -5, -1, 1], [2, -4, -2, 1]];
    Rf_basisdens := [1, 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_9200_a();"
function MakeCharacter_9200_a()
    N := 9200;
    order := 1;
    char_gens := [1151, 6901, 2577, 1201];
    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_9200_a_Hecke( : Kf := Kf)
    return MakeCharacter_9200_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], [0, 0, 0, -1], [0, 0, 0, 0], [0, 1, -1, 0], [0, -1, -1, 0], [1, -1, 2, -1], [0, 2, 0, 0], [4, -1, -1, 0], [-1, 0, 0, 0], [1, -3, 2, 0], [3, 0, -1, 2], [4, 2, -2, 2], [-2, -1, 1, -1], [2, 1, 1, 2], [1, 0, 1, -1], [0, 0, 0, -4], [1, 1, 3, -4], [4, -2, -2, 2], [4, 0, 0, 2], [1, -2, -1, -1], [5, 1, 2, 0], [6, -3, -3, -2], [2, 1, -3, 4], [-4, 0, 2, -2], [10, 0, 2, 0], [1, -1, -1, -2], [0, -3, 1, 0], [0, 0, 0, 0], [0, 6, -2, 0], [0, -2, 0, -4], [-3, 0, 1, -2], [-8, 4, 0, 3], [4, 2, -2, 0], [11, 0, -1, 1], [4, -4, 6, -2], [1, -6, 3, -1], [0, 0, 4, -4], [-7, 2, -5, -2], [-1, 3, -3, 0], [-3, 12, -4, 0], [5, 6, -5, 2], [16, 0, 0, 2], [-8, -1, -7, -2], [-8, -6, 0, -5], [2, 1, 7, 1], [0, 7, -1, 2], [5, 9, -1, 8], [3, 1, -1, 4], [-2, 2, 2, 4], [8, -2, 2, -6], [5, -9, 6, -1], [0, 10, -2, -1], [6, 4, -2, -2], [0, -4, -4, 8], [8, -2, 8, -7], [-10, 8, -2, -2], [7, -7, -2, -3], [5, 3, 5, -4], [2, 5, 3, -3], [-6, -4, 2, -4], [-2, 0, -2, -8], [12, -2, -4, 4], [0, 0, 0, 0], [7, 8, -5, 6], [-12, 4, 6, 0], [8, -1, -5, 10], [-4, -8, 4, 5], [14, 2, -2, 6], [-9, 1, 7, -4], [15, 1, -6, 5], [14, 1, -5, 5], [4, -1, -9, 4], [12, -1, 7, -10], [-12, 2, 4, -8], [16, -4, 4, -4], [0, -3, 7, -2], [-6, 4, 2, -6], [5, -10, -3, 6], [2, -8, -4, 2], [2, -7, 7, -11], [0, -3, 1, -8], [10, 0, 8, -6], [-2, 2, 2, -2], [2, -4, 8, 0], [4, -2, -2, 5], [-3, -14, 7, 3], [17, -1, 3, 2], [2, 0, -2, -8], [11, -7, -2, -3], [-7, 7, 9, 0], [-4, 3, -7, 4], [0, -15, 5, -2], [-1, -4, 3, 5], [7, -6, -3, 5], [-8, 14, -6, -1], [-18, -9, 3, 8], [4, 10, -8, 11], [-14, -2, -8, 4], [-4, 1, -3, 6], [14, -11, 11, -7], [23, -4, -1, -3], [20, 0, 10, 0], [6, 5, -11, 18], [4, 10, -4, -4], [12, 2, -8, 10], [-14, 5, 3, 5], [-15, 10, 7, -1], [-8, 1, -7, 6], [-19, -3, 3, 0], [15, -2, -5, 2], [4, 4, -8, 12], [-4, -2, -2, 8], [8, 12, -4, 14], [8, -10, 8, -2], [26, -15, -1, 4], [-4, -2, 4, -10], [-4, 9, -5, 10], [7, 2, -11, 6], [11, -5, 6, 4], [-10, 5, -5, 0], [18, 4, -2, 2], [6, -1, 5, -1], [-2, 10, 0, -8], [-11, 0, -3, -2], [7, -7, 7, 0], [-2, 22, -10, 0], [-8, 8, -10, 6], [-16, 2, 6, -4], [-6, 22, -6, -4], [0, 2, -14, 0], [5, 0, 5, 2], [-2, 11, -15, 10], [22, 7, -5, -4], [-8, 0, -10, 8], [-11, 1, 2, 16], [-14, 6, 8, -12], [18, -2, 8, -2], [-8, 19, 1, 4], [-16, -4, 6, 16], [-15, 0, -8, 12], [-23, 12, -15, 3], [-1, 16, 0, -4], [8, -2, 2, -5], [18, 1, -1, -10], [5, 12, -8, 4], [14, -9, -1, 0], [4, -7, -3, -6], [-3, -18, -3, -10], [-25, -4, -1, -6], [-28, 14, -2, 1], [-21, 13, -11, 6], [-32, -4, 2, 6], [-5, 13, 3, 0], [20, -18, 10, -5], [-6, 13, -9, 10], [26, 5, -7, 2], [16, -6, -4, 0], [11, 7, 2, 8], [8, 4, -4, 14], [-20, -6, -4, -4], [3, 4, 11, 6], [-20, 10, 2, 0], [-17, 4, 11, -15], [-6, -1, 7, -8], [6, -4, 18, -16], [8, -1, 9, 6], [19, 1, -1, -8], [-11, 0, -4, 16], [-6, 2, 2, -2], [11, 2, 9, -15], [-28, 3, -3, 4], [-5, -15, 6, -15], [4, -3, 9, 4], [-20, -6, -2, 6], [4, 14, -10, 9], [-4, -16, 4, -16], [-19, 4, 1, 14], [-38, -1, 5, 3], [20, -5, 7, 6], [-4, 0, 12, -8], [4, -4, -16, 13], [14, 11, -1, 4], [-2, 5, -5, -7], [-7, -8, 8, 8], [-10, -1, 7, -2], [10, -2, 8, 8], [-35, -5, 3, 14], [22, -9, 3, -4], [11, 1, 10, -11], [-8, 6, -14, 8], [-1, -5, -2, -16], [-3, 5, -5, -8], [4, 3, 1, 2], [17, 3, -13, 14], [2, -21, 5, 4], [18, 2, 12, 4], [-16, 8, 6, 12], [6, 12, 4, 6], [0, -6, 2, 10], [4, 6, 6, -19], [10, 2, -14, -2], [-17, -5, 1, 12], [-30, 5, 3, -7], [-34, 12, -4, 2], [-8, -25, 11, -14], [-15, 5, 2, 8], [-10, 0, 10, -10], [-11, -18, 3, -13], [9, -1, -2, 3], [-19, -10, 7, -2], [-9, -9, 2, -12], [13, 3, -10, 19], [34, -13, 7, 2], [-24, 13, 7, 4], [-25, -7, -5, 8], [-8, -10, -2, 2], [-8, 0, 16, 3], [-45, 2, -9, -2], [0, -5, 7, 8], [27, -6, -3, 1], [15, 19, -6, 8], [-14, 3, -5, 16], [-3, -6, -13, -5], [2, -1, 3, 4], [15, 4, -1, 6], [-10, -17, 17, -13], [22, 12, -12, 16], [-36, 14, -10, 5], [-28, -2, 8, 0], [25, 15, 5, 12], [-2, -20, 8, 0], [0, 10, 8, -24], [-6, -19, 5, -2], [-3, -24, 16, 0], [2, 6, -6, -10], [-14, 19, -17, 0], [28, -14, 2, 0], [0, -2, 10, -4], [-28, -2, -2, 19], [-8, -12, -4, 17], [6, 15, 1, 0], [20, 8, 4, -9], [21, -6, -1, -9], [21, 2, -3, 10], [1, -25, 3, -2], [-11, -14, 7, -1], [-20, -2, 2, 11], [22, -4, 18, 4], [16, -13, -7, 8], [14, -5, -1, -4], [46, -12, -4, 8], [-40, 4, 6, 8], [-16, 23, 3, 8], [-10, -16, 6, -16], [15, 0, -4, -4], [7, 8, 3, -15], [2, -22, -4, -6], [-32, 19, -19, 6], [21, -11, -2, 8], [-7, 2, -1, -5], [10, 0, 14, -24], [-20, -21, -1, -8], [27, -11, 29, -6], [-22, 0, -8, 12], [30, -12, 8, -12], [20, -31, 5, -4], [-18, 12, 10, 10], [-6, 0, 2, -2], [30, -11, 25, -12], [14, 9, -5, -11], [37, 21, -10, 4], [20, 12, -4, -14], [4, -12, 16, -10], [18, 9, 9, -20], [-17, 17, 14, 5], [7, 10, -15, -6], [-9, -13, 13, 4], [-17, -12, -4, -16], [10, -16, -10, 0], [-12, -6, -4, 0], [-19, -12, -3, 6], [-6, 36, -14, 6], [-18, -5, -1, 6], [-2, -4, 8, 14], [-29, 1, -9, 8], [-24, 22, -6, -4], [-26, 14, 16, -6], [16, 6, -12, -8], [-9, -15, 7, 0], [-31, 4, 4, 8], [-22, 18, 6, 10], [-6, -9, 11, 6], [-11, 20, 0, 8], [-10, 4, -2, 12], [-13, 38, -21, 2], [14, 14, -6, 16], [2, 11, 5, 12], [-9, -21, 18, -16], [-35, 30, -1, -2], [-39, -6, -1, 14], [-22, -6, -8, 16], [-22, -14, 10, -12], [32, -5, 3, 10], [-33, 10, 9, -7], [38, 6, 2, -12], [-10, 3, -19, -1], [4, 16, 12, 8], [2, 8, -6, 26], [32, -18, 16, -6], [32, -7, 9, -10], [-63, 0, 1, -1], [26, -14, 4, 6], [-38, 8, 4, 2], [11, -8, 11, -23], [-26, 0, -2, 2], [-24, 0, 6, 8], [-11, -18, 15, -18], [41, -10, -13, -5], [46, 2, 0, -10], [8, -10, -16, 9], [24, -12, -16, -6], [-32, -10, 12, 20], [14, -17, 1, 3], [-27, -7, -5, -16], [-18, 2, -24, 4], [20, -24, 12, -4], [30, 12, -14, -10], [-15, 4, 1, 6], [-2, -1, -23, -4], [44, 10, 4, -12], [-15, -2, -13, 3], [17, 7, 6, 15], [23, 6, 17, 5], [-3, 4, -19, -2], [-36, -8, -8, -8], [-21, 16, -17, -7], [-6, -12, 8, -4], [38, 12, 6, -6], [-9, -1, -14, 16], [-24, -28, 8, 2], [29, -6, 13, -6], [8, 6, -4, -14], [4, -3, -19, -2], [26, 2, 6, -14], [14, 6, -14, 24], [8, -18, 6, 8], [43, 6, -7, -23], [-15, 3, 1, 8], [22, -13, 23, -10], [46, -2, 6, -10], [28, 16, -8, -17], [5, -26, 3, -1], [4, -21, -13, 2], [6, -4, 22, 10], [-14, -20, -2, 6], [16, 7, 3, -2], [-20, -7, -5, 8], [-52, -5, 7, -14], [-31, -7, 14, 0], [-29, 27, -11, 8], [34, -20, -2, 6], [-9, -3, -6, 9], [-20, 12, 4, 13], [-18, 31, -9, -4], [7, 12, -1, -3], [-3, -22, -5, 15], [-51, 10, -11, 10], [2, -14, 14, -14], [8, -36, 20, 0], [24, -6, 6, 1], [3, -15, 7, -12], [4, -32, 16, -17], [-8, -20, 10, 2], [2, 19, -15, 16], [7, 31, -6, 16], [23, 34, -7, 21], [16, 13, 11, -14], [10, -22, 0, -10], [-10, -30, 14, -22], [-9, 15, -14, 0], [34, 12, -4, 2], [-16, -12, -6, 2], [-19, -11, 3, 20], [48, -6, -4, -3], [16, -9, 9, 10], [-3, 32, -11, 18], [-7, -18, 15, -10], [7, -15, 17, -2], [62, 0, -6, -6], [-8, 18, -20, 24], [-36, -6, -4, 20], [1, 20, -8, 12], [-63, 6, -1, 3], [-12, -12, 12, -8], [-20, 10, 24, -24], [0, 24, 0, 14], [-2, -23, -13, -16], [-2, 22, -10, 2], [-32, 7, 15, -10], [-34, -8, 4, -8], [26, 7, 5, -17], [-39, 30, 7, -9], [14, 17, 5, 16], [-4, -32, 14, 10], [-37, 22, -7, 5], [-5, -4, 7, -10], [40, -2, 4, -14], [-4, -6, -8, 23], [-14, -5, 3, 0], [-21, 1, -9, 20], [23, -18, 9, -3], [-3, -21, 26, -13], [-14, -21, 1, 8], [-20, -17, 3, -10], [18, 0, -6, -22], [-55, 9, 14, -16], [8, 14, 18, 12], [-11, -27, 11, -4], [12, 16, -24, 18], [-4, -7, 21, 4], [2, -12, 14, 16], [-4, -10, 10, -8], [65, -15, 7, 0], [-5, -13, -23, 4], [-29, 1, 2, 13], [25, 3, -22, 11], [4, -11, -11, -4], [19, -4, -12, -16], [40, 18, -10, -25], [3, 18, 1, 10]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_9200_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_9200_2_a_cp();".
// 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_9200_2_a_cp(:prec:=4)
    chi := MakeCharacter_9200_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_9200_2_a_cp();".
// 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_9200_2_a_cp( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_9200_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<3,R![-2, 9, -9, 0, 1]>,<7,R![8, -4, -12, -1, 1]>,<11,R![40, 16, -22, 1, 1]>],Snew);
    return Vf;
end function;