
// Make newform 9200.2.a.ch in Magma, downloaded from the LMFDB on 22 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_ch();".
// 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_ch();".
// 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 := [1, -2, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [0, 1, 0], [-2, 0, 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_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], [1, -1, 0], [0, 0, 0], [2, -2, 0], [0, 2, 2], [-1, 2, -1], [-2, 2, 0], [-4, 4, -4], [-1, 0, 0], [-4, 3, -5], [-2, -3, 1], [6, -2, 6], [-1, -3, -2], [-10, 2, -4], [5, 2, 1], [-2, -4, 0], [7, -4, 6], [-6, 8, -6], [0, 8, -4], [-5, 2, -9], [4, -7, 9], [6, -6, 8], [-4, 8, 4], [-6, -4, -2], [-14, 2, -2], [11, -8, 8], [-6, 10, -2], [12, -2, 4], [-8, 0, -6], [-8, 0, -4], [2, 1, -3], [-1, 5, 8], [4, 2, -2], [13, 2, 1], [2, -2, 12], [7, -6, 7], [-6, 8, -2], [-6, 5, -7], [3, -4, -10], [-1, 0, 0], [-10, -1, -1], [-16, 2, -4], [-2, -12, 0], [-5, -3, 10], [-9, -7, -2], [4, -8, 8], [-21, 8, -6], [-5, -8, 2], [16, -4, -4], [0, -8, 14], [-1, -2, 7], [-13, 9, -16], [8, 2, 12], [0, -14, 4], [13, -9, 14], [4, -6, 4], [-13, 10, -9], [-1, 0, 2], [-9, 5, -6], [12, -6, -6], [14, -14, 12], [-18, 10, 4], [-8, 4, -4], [2, -15, -7], [-8, -4, -10], [-2, -8, -12], [-3, -1, 12], [14, -10, -10], [3, -12, -6], [-13, -2, 3], [-5, 5, -2], [0, 6, -4], [26, -10, 22], [6, 2, 14], [12, -12, 2], [-20, 18, -26], [-4, -4, -4], [4, -25, 11], [10, -4, 8], [-7, -5, -10], [10, -28, 12], [2, 10, 10], [-14, 14, -14], [-12, 14, 0], [-23, 11, -12], [21, -18, 17], [7, 12, 4], [-12, 12, -6], [-37, 2, -5], [-3, 12, -14], [14, -18, -12], [2, 0, 12], [-5, 10, 11], [17, 10, -7], [11, -11, 4], [2, 6, 2], [1, -13, -6], [-20, 16, -18], [0, -10, -2], [-11, -5, 2], [7, -14, -1], [18, 2, 16], [2, 2, -6], [0, -6, 14], [-8, 24, -16], [3, 17, -18], [17, -2, 1], [2, -8, 20], [-25, 12, 2], [4, -5, -9], [-4, -4, -16], [-2, 28, -18], [-16, 16, 0], [-30, 12, -22], [-8, 12, 14], [20, 2, 2], [-12, 20, 20], [6, -17, 3], [-8, 3, -13], [-28, 10, 6], [-2, -18, 18], [-7, 7, -26], [-12, 4, -18], [2, 1, -3], [9, -28, 18], [-6, 18, -8], [14, -30, 24], [-12, -4, 0], [-16, 2, 2], [-2, 2, -4], [10, -1, -1], [-8, -8, -6], [-32, 6, -4], [22, -12, 8], [24, -1, 23], [10, 10, 2], [12, -16, 22], [-8, -6, -2], [26, -12, -4], [25, 0, -8], [3, 26, -17], [-37, -8, 0], [9, -5, 20], [-26, 26, -18], [-31, 8, -16], [2, -30, 10], [26, -20, -8], [0, 11, -13], [6, 9, 17], [19, -27, 12], [-1, 4, -16], [18, -12, 18], [19, -8, 14], [-23, 15, 12], [16, -40, 26], [32, -20, 6], [-2, 8, 8], [4, 25, -15], [-2, 2, -8], [-14, -4, 0], [-10, 3, 7], [-16, -26, 10], [15, -22, 23], [-18, 18, -22], [-4, 14, -30], [22, -10, -2], [-11, -16, 18], [-9, -12, 8], [34, -18, 14], [-9, -2, 3], [6, -22, -2], [-29, -2, -13], [14, 4, 4], [0, 0, 4], [9, -9, 8], [14, 26, -6], [-22, 11, -13], [23, -19, 10], [16, 20, -10], [-4, -20, -2], [-25, 33, -28], [-42, 16, -24], [-5, 17, -2], [-13, 24, -4], [-42, 0, 2], [-10, -12, 14], [5, 4, -8], [-32, 20, -30], [-25, 34, -41], [12, 24, -12], [-40, 23, -33], [41, -24, 22], [24, -22, 10], [-13, 16, 28], [-26, -10, 12], [-2, 18, 12], [10, -12, -28], [10, -6, -10], [-38, 32, -44], [43, -15, 0], [-2, 14, 16], [-35, 4, -18], [31, -23, 2], [8, -6, -28], [-10, 18, -32], [24, 5, 25], [-44, 12, -14], [9, -2, 1], [-19, 6, -3], [6, -9, -25], [12, -1, -1], [-23, 2, 17], [20, 14, 18], [12, -12, 26], [21, -28, -10], [14, 18, -10], [1, -9, -16], [16, 19, -5], [-40, 20, -44], [7, -14, -37], [-12, 9, 25], [-8, 6, -14], [-9, -14, -1], [-20, -10, -2], [10, 23, -9], [-25, 17, -22], [-32, 14, -12], [37, -5, 12], [28, -38, 40], [23, 4, 30], [26, 12, 12], [-14, -6, 4], [20, -12, -14], [21, 0, 4], [38, -12, 18], [-48, 12, 10], [-8, 34, -6], [-4, 26, -4], [23, -23, 24], [41, -1, -4], [14, -2, -16], [-1, -7, 12], [-31, 26, -39], [-12, -11, 5], [-31, -8, 12], [-37, 26, -41], [9, -17, -24], [60, -28, 48], [0, 12, 0], [32, 4, -6], [-16, -2, -14], [16, 0, -12], [2, -6, 0], [-22, -12, -4], [9, -12, 4], [41, -14, 21], [4, -4, -12], [-2, 28, -18], [-24, 37, -7], [-59, 18, -35], [-20, -8, -8], [10, 32, -12], [-19, 12, -52], [-20, 50, -10], [-10, -12, -16], [-8, 12, -10], [0, 16, 32], [-10, 16, 16], [10, 2, -2], [-17, 33, 10], [-32, -21, 11], [-2, 20, -4], [-18, -2, -4], [22, 4, 12], [-31, 2, -31], [42, -25, 15], [7, 28, -22], [-9, -12, 32], [52, -16, -12], [-4, 32, -4], [6, 33, -11], [-12, 10, 24], [-44, -4, 4], [-42, 32, -46], [-61, -12, 6], [32, 24, 0], [10, 8, 48], [-8, -28, 18], [53, -16, -2], [-27, 44, -20], [48, 6, 18], [-24, 56, -42], [-13, -36, 0], [48, 0, 4], [40, 5, 9], [-10, 64, -14], [4, -14, 12], [-24, 7, 3], [22, 3, -5], [38, -31, 13], [4, -22, 36], [-54, 22, -2], [2, -34, 20], [15, -26, 15], [18, -64, 42], [-11, 11, 42], [32, 4, 32], [-24, 24, -22], [-30, 38, -32], [-10, 20, -12], [-11, 30, -39], [36, -32, 8], [0, 48, -38], [43, -30, 11], [-12, 48, -38], [-32, 6, 8], [-6, 11, 31], [-73, 26, -45], [-20, 54, -10], [51, -7, 10], [-14, -24, 4], [52, -18, 4], [15, -27, -14], [57, 0, -14], [-30, -18, 2], [-34, 16, 10], [10, -10, 48], [-6, 61, -23], [42, 12, 12], [-6, 12, 14], [27, -2, 51], [-33, -30, 23], [41, -2, 21], [6, 21, 21], [-16, -10, 6], [31, -66, 51], [-24, -18, -6], [46, -22, 36], [52, -15, 1], [32, -32, 18], [20, -5, -41], [-40, 18, 20], [46, -36, 12], [20, -22, 42], [-66, 44, -66], [-56, 44, -60], [37, -6, 37], [-35, 4, -22], [34, -8, -10], [-22, 10, -14], [3, -3, -12], [-7, -26, 5], [10, 8, 4], [32, -26, -4], [-16, 4, 28], [-10, -16, -40], [-46, 4, -26], [18, -24, 22], [-4, 45, -27], [-61, 32, -26], [-24, -38, 22], [3, 10, -9], [71, 1, 0], [28, 20, -14], [-13, 18, 19], [61, -30, 1], [-36, 43, -37], [34, -56, 38], [34, -2, 34], [-11, -1, -16], [1, 28, -22], [17, -45, 0], [-20, 18, -42], [-50, -16, 4], [20, -57, -1], [5, -6, -19], [6, -58, 34], [22, -24, -14], [-12, -4, -52], [20, -29, 19], [12, -64, 34], [-24, -4, 30], [-15, 56, -14], [-3, 3, -50], [-14, -20, 0], [38, -39, 17], [-46, -5, -13], [-13, 72, -32], [18, 40, -30], [64, -6, -12], [30, 22, -26], [-13, -48, 20], [-21, 38, -17], [72, 4, -4], [28, 28, -20], [60, 10, -6], [-58, 28, -34], [-8, 32, -16], [-46, 22, -38], [50, 24, -24], [23, 5, 18], [21, -2, 37], [-18, -2, 30], [38, -50, 10], [-39, -22, 9], [-26, 37, -63], [18, 2, -28], [-19, 67, -42], [-36, -14, 20], [-35, 20, 10], [-25, -14, -37], [-49, -14, -5], [-16, 44, -46], [-24, 56, -36], [16, -40, -36], [-36, 23, -13], [-48, 12, -52], [29, -36, 18], [12, -32, 28], [46, -10, -36], [-8, 48, -40], [24, -60, 26], [33, -40, -6], [1, -16, 38], [1, -18, -7], [83, -42, 63], [14, -40, 40], [27, 44, -4], [-49, 33, -4], [14, 1, 37]];
    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_ch();".
// 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_ch(:prec:=3)
    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_ch();".
// 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_ch( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_9200_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<3,R![1, -1, -2, 1]>,<7,R![8, -4, -4, 1]>,<11,R![-56, -28, 0, 1]>],Snew);
    return Vf;
end function;