
// Make newform 2250.2.a.c in Magma, downloaded from the LMFDB on 20 June 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_2250_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_2250_2_a_c();".
// 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_2250_2_a_c();".
// 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, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rfbasis := [Kf.1^i : i in [0..Degree(Kf)-1]];
    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_2250_a();"
function MakeCharacter_2250_a()
    N := 2250;
    order := 1;
    char_gens := [1001, 127];
    v := [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_2250_a_Hecke( : Kf := Kf)
    return MakeCharacter_2250_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, 0], [0, 0], [0, -2], [-2, -1], [-1, 3], [-3, 3], [6, 0], [0, -5], [-5, 7], [4, 3], [-6, 3], [2, -2], [-2, -3], [-9, 3], [-2, 2], [-7, -1], [6, -12], [-3, -1], [4, -8], [-12, 0], [-3, -3], [2, -10], [8, -2], [-12, 10], [-2, -7], [4, 0], [-2, 10], [-6, 12], [8, -7], [6, -12], [-8, 16], [4, -1], [-20, 2], [18, -4], [-16, 3], [6, 9], [-11, 15], [-20, 5], [-8, 2], [0, 12], [0, -12], [-6, 0], [6, -18], [-4, -4], [-15, 1], [-4, -12], [18, -6], [-14, 4], [2, 6], [3, -7], [18, -14], [-3, -5], [-11, -5], [13, -17], [-3, 21], [-22, 1], [-3, 9], [-2, 20], [-20, 4], [18, -5], [-2, 22], [30, -5], [2, -4], [-26, 8], [6, -6], [-14, 12], [8, -8], [12, -20], [0, 0], [8, 11], [-14, 16], [-14, -6], [21, -19], [0, 2], [8, -16], [-9, 15], [-30, 4], [8, -4], [8, -9], [4, -8], [12, -4], [18, -6], [-6, -10], [24, -7], [24, -14], [2, 8], [18, -8], [3, -21], [6, 6], [6, 6], [2, 14], [4, -22], [-2, 1], [12, -2], [-8, 4], [2, 8], [2, -10], [-15, -5], [8, -6], [11, 9], [-2, -20], [-4, 14], [18, 8], [0, -20], [-14, -16], [10, -14], [28, -11], [22, -16], [24, -27], [40, -12], [-18, 32], [-14, 28], [-44, 6], [-7, 13], [22, -14], [26, -9], [12, -1], [0, 16], [-15, -21], [2, -6], [-30, 28], [30, -2], [12, 2], [28, 2], [2, 23], [-18, -18], [6, -2], [16, 14], [18, -27], [0, -14], [19, -1], [-36, 12], [-10, -24], [24, -14], [-5, 29], [4, -4], [-33, 9], [-32, 4], [32, 4], [-34, 0], [-22, 23], [4, -18], [-18, 0], [28, -10], [0, -18], [26, -5], [8, -7], [-12, 6], [-3, 9], [-6, 33], [10, 8], [-34, 21], [52, -4], [-25, -3], [-40, -4], [12, -16], [6, -30], [20, -12], [7, -25], [-38, 28], [-14, -20], [-18, 34], [-49, 5], [-24, 49], [-12, 21], [8, 27], [29, -15], [-3, 15], [24, -26], [-33, 25], [10, 8], [20, -8], [24, -18], [48, -24], [-36, 6], [-6, 18], [47, -13], [-6, -12], [0, 18], [-6, -4], [-18, -15], [33, -31], [-10, 32], [-27, -11], [-6, 9], [2, 12], [2, -5], [23, -39], [28, 2], [-28, 10], [-28, 20], [-38, 20], [-42, 9], [-46, 10], [-7, 11], [0, 25], [19, -1], [-27, 19], [0, -3], [50, -11], [5, 1], [34, 11], [15, -7], [-30, -5], [18, -36], [36, 8], [0, -44], [-16, 2], [-24, 12], [-6, -24], [-18, 12], [-22, -24], [22, -4], [8, -10], [36, -45], [8, 4], [-18, 38], [55, -17], [-58, 8], [24, -18], [-21, 27], [-14, -2], [0, -26], [-10, 4], [8, 18], [10, 32], [36, 8], [-10, 40], [-29, 37], [-5, -9], [-12, 34], [19, 15], [-32, -22], [39, -7], [0, 17], [-20, 15], [-58, 8], [-26, 31], [-64, 14], [20, 2], [40, -60], [-42, 18], [-8, 12], [-16, -1], [36, -56], [-30, -6], [31, -55], [6, 12], [-48, 3], [34, -39], [30, -12], [-29, -13], [1, 35], [-44, 20], [19, 13], [-20, 42], [-21, -7], [-50, 14], [-24, 4], [58, -6], [36, -36], [-56, 36], [10, 3], [43, -47], [-34, 36], [-6, -3], [-24, 24], [-10, -3], [-24, 16], [36, 0], [50, -35], [10, -18], [-16, -3], [-46, -20], [-10, 34], [34, -10], [34, -12], [-23, 27], [2, 31], [8, 23], [31, 3], [-1, 43], [12, 6], [12, 24], [0, -28], [-26, 44], [10, -16], [9, -7], [50, 8], [26, -47], [20, -10], [48, -33], [9, 7], [-62, 27], [-25, -1], [47, 3], [52, -20], [-58, 41], [42, 17], [20, 40], [48, 18], [24, 27], [-58, -10], [-12, -30], [48, -24], [26, -26], [28, -28], [-6, -4], [18, 1], [-8, -5], [2, 44], [2, 34], [-24, 24], [40, -19], [-16, 39], [-25, 29], [6, -10], [28, -6], [-44, 8], [16, -24], [-48, 22], [2, -1], [18, 32], [36, 1], [24, -39], [-74, 18], [-43, -17], [-31, 53], [10, 28], [26, 22], [30, -48], [15, -1], [-58, -14], [-50, 66], [44, 4], [66, -30], [48, 15], [-21, 25], [22, 6], [1, -15], [-38, -28], [-42, 5], [-39, 13], [24, 18], [-91, -1], [-40, 6], [18, -3], [-40, 34], [8, 8], [48, -36], [10, -40], [-45, -29], [-38, 2], [-54, 16], [52, 19], [70, -14], [17, -53], [-24, 51], [-28, 20], [-50, 20], [-78, 12], [-28, 1], [-18, 41], [22, 27], [-28, -30], [36, -32], [26, -18], [-45, 17], [-30, 73], [12, -6], [33, 33], [5, -19], [24, -43], [-27, -27], [-38, 13], [-32, 38], [-20, -18], [12, -38], [60, -12], [-37, 23], [-41, 29], [86, -26], [32, -53], [-38, 12], [-45, -1], [15, -9], [-83, 9], [-23, 27], [-32, 16], [-39, 7], [-6, -20], [-78, -3], [-18, 25], [50, 32], [16, 42], [-3, -15], [34, -62], [10, -10], [-39, 21], [-42, 42], [-84, 23], [62, -18], [-36, 75], [-2, -11], [24, -15], [42, -47], [-26, -26], [13, 27], [47, -43], [18, 30], [-28, -22], [-44, 38], [-54, -24], [-36, -22], [25, 37], [36, 40], [-54, 24], [63, 5], [-72, 21], [-5, 11], [61, 21], [-84, -3], [58, -77], [26, -66], [-30, -6], [-58, -22], [62, -62], [12, -24], [12, 54]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_2250_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_2250_2_a_c();".
// 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_2250_2_a_c(:prec:=2)
    chi := MakeCharacter_2250_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_2250_2_a_c();".
// 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_2250_2_a_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_2250_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<7,R![-4, 2, 1]>,<11,R![5, 5, 1]>,<17,R![-9, 3, 1]>],Snew);
    return Vf;
end function;