
// Make newform 2175.2.a.z in Magma, downloaded from the LMFDB on 27 December 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_2175_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_2175_2_a_z();".
// 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_2175_2_a_z();".
// 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, 7, 6, -5, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [-2, -1, 1, 0, 0], [3, -3, -2, 1, 0], [1, 7, -2, -3, 1]];
    Rf_basisdens := [1, 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_2175_a();"
function MakeCharacter_2175_a()
    N := 2175;
    order := 1;
    char_gens := [1451, 2002, 901];
    v := [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_2175_a_Hecke(Kf)
    return MakeCharacter_2175_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, -1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [2, 0, -1, 0, 0], [3, -1, 0, -1, 0], [0, 0, 1, 0, 0], [1, 0, -2, 0, -1], [1, 1, -3, -1, -2], [0, 1, 2, 1, 1], [1, 0, 0, 0, 0], [-2, 1, 2, 3, 3], [2, 1, 2, 1, -1], [-2, 0, -2, 2, -2], [3, -4, -1, -4, -1], [-1, 4, 0, 0, -1], [5, 1, -1, -1, 2], [-1, 0, 1, 2, 5], [-1, -3, 1, -1, -2], [2, 0, 1, -2, 2], [5, 3, -1, 3, -2], [-4, 1, 0, 5, 1], [-1, -3, -1, -5, 0], [-1, 4, -1, 2, -1], [-5, 3, 0, 1, -4], [3, 1, 1, 1, 0], [1, 1, 0, -1, 4], [-4, 4, 0, 6, 4], [6, 1, -2, -3, -1], [-2, 1, 3, -1, 1], [3, 0, 0, -4, 1], [2, -2, -4, -6, -4], [11, -3, 2, -3, -2], [4, 4, 0, 4, 2], [-6, -1, 3, 3, 3], [-3, 2, 5, 0, -1], [-6, 6, -4, 4, 2], [-5, 2, 5, 2, 7], [9, 0, -9, 0, -3], [-2, -2, 10, 2, 2], [-2, -4, 2, -4, 2], [5, -1, -1, -5, 2], [-10, 7, 3, 3, 1], [-4, 8, -4, 4, 0], [2, 8, 0, 0, -8], [8, -3, -4, 5, -1], [0, 11, -3, 5, -1], [-4, 2, 6, -2, -2], [6, -10, 1, 2, 2], [7, -6, -1, -8, 1], [-12, 1, 6, 3, -1], [10, 0, 4, 0, -2], [-10, 7, 6, -3, 1], [-22, 1, 5, 1, 3], [-1, 3, -6, -7, -2], [3, -6, 1, 0, -1], [-4, 4, 2, -4, 0], [-11, 5, 8, 1, 2], [6, -4, 0, -4, -2], [0, 0, 5, -2, -6], [-9, 8, 1, 10, 7], [10, -2, 0, -4, -4], [11, 2, -12, -6, -13], [2, 3, -10, -1, -1], [-1, -5, 12, 5, 2], [2, 4, 5, 0, 2], [1, 0, 0, 6, -3], [-8, 1, -6, -1, -3], [4, -1, -2, -9, 3], [-4, -7, 2, -3, -7], [2, -2, -4, -6, -6], [0, -3, -4, 1, -1], [16, -10, -10, -8, -8], [-10, 0, 14, 4, 10], [-2, -8, 8, -6, 4], [-12, -9, 2, 1, -5], [-5, -7, 1, 7, 10], [-1, 9, 4, 5, 8], [0, -10, 6, -8, 0], [5, -1, 1, -5, 0], [7, -4, 3, 12, 1], [18, -3, 2, 3, 3], [1, -4, 5, 8, -1], [20, -10, -4, -10, -2], [5, -3, -1, -3, -10], [-8, 7, 5, -3, -1], [5, -2, 8, 10, 7], [3, 11, -4, 3, -6], [14, -4, 1, 2, 4], [-10, 2, 4, 0, 8], [-12, 12, 3, 6, 4], [4, -4, 2, -2, 10], [8, -2, -6, 0, -4], [-16, 0, -6, 6, 0], [12, -8, 0, 0, -4], [-8, -3, -5, -3, 7], [-11, -8, -4, -4, -7], [1, -16, 3, -2, 5], [13, -10, -7, -8, -1], [6, 0, -3, 6, -2], [-14, 1, -4, 3, -7], [-2, 4, 11, 8, -8], [27, -2, -1, 0, 3], [11, 0, -2, -6, -3], [1, -7, -10, 3, -4], [10, -10, -2, -4, -10], [6, -12, 2, 8, 4], [-31, 2, -7, -4, -1], [5, 9, -5, 3, -2], [3, -1, 4, 3, 8], [-4, -7, -2, -1, 7], [-5, 4, -7, -8, -1], [4, 18, -9, 4, 0], [14, -16, 8, -8, -8], [-10, 15, 4, -3, 1], [-8, -1, -3, -9, 1], [-13, -9, -2, -11, 0], [-4, -2, 7, -2, 12], [1, -13, -3, 5, -2], [-1, -10, 6, 8, 1], [11, -17, 2, -1, -4], [14, -3, -11, -11, -9], [16, 4, 7, 2, 2], [5, -8, 12, -4, -5], [10, -6, -10, -2, -10], [-8, -17, 11, 3, 9], [-7, 13, 7, 1, -6], [2, -4, -4, 0, 0], [11, -8, -9, 6, 1], [-24, 17, 0, 17, 11], [-3, -6, 9, 6, 5], [-9, 9, 9, -5, 0], [-7, 0, 0, 14, 7], [-16, -2, -4, -10, -6], [12, -8, -12, -8, -2], [-3, -1, -11, -5, -16], [9, -13, -9, 5, -2], [-2, -20, 0, -4, -4], [-10, 18, -2, 8, 4], [8, 2, 0, 2, 16], [1, 11, 2, 7, -8], [-6, 1, 7, 5, 1], [12, -8, -6, 4, -6], [25, 14, -7, 2, -1], [-6, -4, 10, -2, 0], [4, -8, -12, -12, 10], [9, 5, 6, 7, 6], [-29, 2, 3, 6, 3], [16, 1, 12, 1, -5], [3, -4, -1, -16, 3], [7, 3, -9, -7, -12], [0, 12, 8, -10, 6], [-5, -5, 4, 7, 10], [18, 6, -10, 8, -4], [-27, 2, 2, 0, -7], [19, -8, -3, 0, -5], [-3, -1, -6, 1, 4], [4, -11, -5, 15, 1], [8, 2, 10, -2, 12], [28, -12, -1, -6, 2], [7, -10, -1, 8, -3], [-5, -18, 8, 4, 15], [-3, 4, 11, 10, 11], [9, 13, -13, -7, -12], [-12, 12, 14, 4, 0], [10, 13, 4, 13, 1], [2, 0, -2, 6, -12], [-20, 15, 1, 5, -5], [-10, 14, 10, 10, 6], [-10, 1, -3, 13, -9], [-5, -4, -14, 4, 9], [-2, -7, 4, -5, -1], [18, 3, 7, -11, 3], [-14, -9, 12, 1, -7], [16, -10, 4, -2, 12], [-4, 6, 8, -6, -6], [-27, 7, 3, 11, 0], [-22, 11, 13, 7, 7], [7, 5, 0, 1, 12], [0, -11, -2, -15, -5], [4, -7, -9, -19, -7], [3, -12, -9, -12, -5], [27, -7, -6, -11, -10], [-14, -6, 15, 8, -2], [14, 7, -12, -1, -5], [33, 5, -7, -1, -8], [17, 5, 15, -11, 14], [13, 7, -19, 11, -8], [4, -15, -6, -15, -1], [9, -4, -9, 0, 7], [-1, -12, 1, -10, 5], [30, -4, 1, -12, 2], [-13, 20, 0, 16, 15], [12, -3, -12, -5, -11], [1, 3, 4, 7, -12], [-25, -12, 14, 4, 19], [41, -1, -3, -3, 4], [8, 16, 4, -4, -10], [4, -2, -11, 6, -2], [-13, 6, -1, 12, 11], [-24, 17, -8, 9, 9], [8, 14, -8, 14, -12], [-12, 11, -5, -1, -3], [-10, 15, 0, -5, -11], [17, 1, -3, 7, 4], [-13, -21, 4, -5, -8], [1, 10, 17, 12, 17], [-6, -20, 12, -4, -2], [23, 3, -15, -15, -24], [13, 19, -9, -5, 0], [-22, 3, -10, 9, 17], [17, -14, -9, 6, -3], [18, -7, 20, 7, -3], [-16, -8, 16, 0, 0], [-19, 0, -6, -8, 5], [-1, 9, 12, 1, -2], [4, -23, 1, -3, 5], [-6, -2, -7, -2, -10], [15, -11, -14, 1, 0], [36, -3, -12, -7, -7], [-31, 2, 26, -2, 9], [37, -8, -17, -8, -13], [10, 9, -11, -13, -13], [-23, -7, 8, 5, 2], [-9, 1, -5, -3, -18], [6, -2, -16, 2, -6], [-16, -3, 2, -5, -1], [-4, -14, 0, 4, -2], [-12, -8, -14, -20, -16], [-12, 2, 8, 6, 10], [2, 5, -12, -13, -13], [-1, 20, -1, 8, -15], [6, -2, -12, 4, -14], [-1, 3, 5, 17, 2], [12, -4, -26, -18, -8], [-14, 8, 5, 16, 20], [-17, 10, -12, 2, -7], [27, 3, -15, -11, -4], [-24, -2, 2, -4, -10], [10, -25, 4, -11, 1], [-27, 13, -10, 21, 4], [-9, 4, 12, -14, -3], [26, -6, 4, -2, 16], [-12, 10, 1, 0, -2], [4, -8, 0, 8, 10], [1, 1, -17, -1, -2], [-8, 13, -10, 3, 5], [6, 2, 6, 14, 10], [0, -1, -8, 1, 11], [-18, -7, 5, 11, 19], [-29, -6, 8, 6, 17], [-13, 11, 21, -1, -2], [-14, -1, 24, 5, 15], [27, -2, -6, -8, -5], [7, 2, 7, -10, -9], [8, -10, 10, -14, -4], [-1, 6, -9, 24, -1], [-3, 6, 9, 14, 1], [-8, -6, 2, 14, 6], [-38, 20, 8, 8, -10], [22, 18, -3, 4, -10], [-6, 1, 2, 13, 9], [-11, 2, 18, 12, -3], [14, -15, -17, -13, -19], [5, 4, 5, 8, -9], [-4, -2, 10, -4, -2], [-45, 12, 17, 8, -5], [9, -5, -8, -13, 8], [22, -8, -10, -6, 2], [-30, -12, 2, 0, 2], [-15, 26, -3, 16, 1], [-2, -1, -5, 17, -1], [12, -18, -7, -2, 12], [4, -12, -4, 2, -14], [-10, 15, 20, 9, 9], [1, -27, -1, -3, -10], [-14, -2, -12, -6, -8], [-36, 4, 2, -4, 4], [-8, -1, 17, 21, 25], [15, -4, 3, -4, -3], [14, 6, -14, -6, -24], [-27, 7, -9, -15, -10], [-14, 5, 25, 13, 21], [-48, 6, 2, -6, 4], [2, 15, 13, 25, 15], [-26, 13, -8, -15, 1], [-7, -11, 16, 7, 2], [32, -11, -4, 5, 9], [-3, 6, -2, -10, -7], [12, -7, -27, -9, -7], [0, 8, 4, 16, 14], [-1, -21, 17, -1, -6], [-20, -5, 24, 7, 23], [-10, 12, 22, 12, 2], [4, -4, -4, -14, -14], [-29, -3, -17, -3, 0], [8, 3, 14, -15, -7], [-41, 28, 1, 4, 3], [-26, 18, -2, 2, 8], [13, 21, -9, -3, 0], [-11, -19, 3, 9, -8], [22, 2, -30, -14, -10], [-11, 13, -7, -5, -2], [-3, 0, -1, 20, 9], [-14, -18, 0, -14, -8], [0, 22, -4, 14, -2], [-4, 20, -2, -4, 12], [5, -10, 0, -26, 3], [-22, 8, -8, 4, -8], [-33, 11, 15, 19, -8], [-12, 16, 1, 10, 14], [39, 3, -15, -7, 0], [-11, 3, 26, 7, 8], [6, 3, 22, -7, 7], [2, 0, 1, -16, -8], [-61, 10, 5, 12, 5], [-2, 15, -11, -15, -9], [50, -6, -20, -8, -14], [-2, 19, -8, 9, -3], [2, -6, 13, 2, -8], [-1, -17, -8, -29, -2], [-7, 0, -15, -4, 13], [-16, 2, -13, -6, 6], [11, -19, -7, -19, 12], [-9, 1, 23, 21, 6], [-19, 18, 7, 20, 1], [-9, 6, -29, -10, -5], [18, 2, -12, -2, 8], [-28, 0, 20, 2, 12], [-19, 22, 10, 14, -25], [-4, -1, -4, 15, 13], [-2, -10, 22, -2, -10], [19, 3, 7, -23, -6], [-60, 8, 24, 8, 12], [-45, 2, 0, 16, 3], [-15, 18, -3, 18, 11], [12, -2, -18, -18, -20], [-20, 3, -5, 7, 15], [-23, 28, 2, 18, -3], [28, -18, 14, 2, 4], [-36, -16, -1, -22, 4], [21, -7, -11, -15, 22], [20, 0, 0, 24, 4], [-19, 9, -4, 17, 10], [4, 23, -3, -3, -21], [-4, -12, 4, 8, 28], [-18, -6, 20, -12, 18], [-11, 10, -17, -2, -3], [-51, 9, -1, 5, -4], [39, 3, -2, -9, 16], [-15, 28, -4, 0, -5], [-12, -6, -16, 6, -6], [6, 2, -5, 22, 4], [-28, -4, -16, -12, 2], [-34, 6, 12, 2, -6], [-6, -8, 24, 12, 20], [-24, -2, 16, -6, 4], [-11, 1, 28, 7, 22], [12, 20, -8, 12, -20], [-5, -12, -10, -8, 5], [-25, -30, 19, -4, 17], [28, -22, -19, -18, -18], [-10, 11, 8, -3, -17], [1, 22, -12, 20, -11], [16, 8, -22, 0, 4], [3, -11, -25, -31, -22], [55, -23, -15, -7, 4], [-1, 14, 4, 2, 3], [-4, 2, 1, 6, -16], [23, 1, 15, -5, -18], [-32, 8, 12, 18, 26], [-42, -17, 27, -1, 19], [-7, -13, -3, -11, 18], [25, -1, -14, -5, -12], [-4, -27, 5, -37, 13], [6, 6, 20, -4, 6], [37, -5, -24, -13, -22], [-13, -9, -2, 21, -14], [-5, 2, 9, 30, 3], [11, 11, 5, -1, -10], [-8, 0, -2, 18, -10], [-14, -4, 22, 18, 10], [26, -17, 0, -9, -1], [-30, -5, -16, 7, 15], [19, 2, 12, 12, 13], [30, -18, -22, -10, -4], [7, 18, -9, 4, -3], [-14, -17, -6, 1, -11], [-44, 24, 17, 2, 6], [-12, 6, 22, 26, 14], [5, -4, 12, -10, -21], [1, -13, -17, -3, -14], [-15, -14, -5, 12, -11], [9, -9, -4, -13, 6], [12, 3, -20, -9, -11], [-35, -25, 22, -3, 20], [14, 2, 19, 2, 12], [4, 8, -22, -12, 0], [-10, 8, 8, 16, -4], [0, -7, -15, 11, -19], [-1, 17, 20, -5, 10], [-28, -6, 30, 6, 12], [-4, -30, 14, 8, 10], [27, -5, 25, 3, -4], [-24, 20, -20, -8, 8], [9, -20, -7, -30, 5], [-46, 0, 6, 4, 6], [54, -24, -29, -12, -18], [-25, 29, 8, 37, 12], [-38, -3, 14, -7, 13], [-18, 7, 10, 1, 1], [-14, 6, -3, 4, -6], [53, -14, 9, 8, 5], [25, 17, -3, 11, 4], [-28, 6, -16, 2, -2], [50, -7, 8, 9, 11], [19, -15, -18, -15, -8], [17, -15, 8, -7, 0], [-2, 28, -1, -14, -6], [39, 4, -30, -16, -27], [54, 0, -8, -8, -6], [3, -33, 9, -25, -2], [-9, 10, 9, -2, -5], [16, 12, 2, -4, -16], [-24, -6, 18, 6, 30], [38, -24, 1, -30, -12], [19, -20, 9, -26, -11], [10, -26, 0, -6, 2], [-25, -11, 42, 5, 4], [0, 1, 3, -27, -9], [-16, 8, -12, -6, -34]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_2175_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_2175_2_a_z();".
// 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_2175_2_a_z(:prec:=5)
    chi := MakeCharacter_2175_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_2175_2_a_z();".
// 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_2175_2_a_z( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_2175_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![-5, 1, 11, -3, -3, 1]>,<7,R![2, -11, -6, 18, -8, 1]>],Snew);
    return Vf;
end function;