
// Make newform 1452.3.e.i in Magma, downloaded from the LMFDB on 08 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_1452_e();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1452_e_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_1452_3_e_i();".
// 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_1452_3_e_i();".
// 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 := [486, 174, 62, 2, 6, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [243, -246, 157, -91, 20, -2], [162, 69, 7, 5, -1, 1], [0, -492, 179, -20, 13, -4], [-486, -6, -64, -20, 13, -4]];
    Rf_basisdens := [1, 1, 243, 81, 243, 243];
    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_1452_e();"
function MakeCharacter_1452_e()
    N := 1452;
    order := 2;
    char_gens := [727, 485, 1333];
    v := [2, 1, 2];
    // 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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1452_e_Hecke();"
function MakeCharacter_1452_e_Hecke( : Kf := false)
    N := 1452;
    order := 2;
    char_gens := [727, 485, 1333];
    char_values := [[1, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := ISA(Type(Kf), Fld), Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
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 := 3;
    raw_aps := [[0, 0, 0, 0, 0, 0], [1, -1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [-2, -1, 0, 1, 0, 2], [0, 0, 0, 0, 0, 0], [3, -3, 0, 3, 0, -1], [0, 1, 1, 1, 2, 1], [-4, 3, 0, -3, 0, -8], [0, -1, 0, -1, 4, 2], [0, -4, -5, -4, -2, -1], [6, 3, 0, -3, 0, 1], [15, 3, 0, -3, 0, -5], [0, -5, 5, -5, -4, -2], [14, -8, 0, 8, 0, 11], [0, -11, -4, -11, 2, 1], [0, -4, 5, -4, 4, 2], [0, 6, -12, 6, 6, 3], [-16, -14, 0, 14, 0, 26], [-14, 15, 0, -15, 0, 5], [0, -10, -14, -10, -2, -1], [-60, 20, 0, -20, 0, -5], [58, -19, 0, 19, 0, 11], [0, 15, -2, 15, 0, 0], [0, -21, -7, -21, -6, -3], [37, 8, 0, -8, 0, 1], [0, 30, -4, 30, 0, 0], [60, -24, 0, 24, 0, 13], [0, -29, -6, -29, 2, 1], [45, 25, 0, -25, 0, -18], [0, -35, 3, -35, -4, -2], [-30, -26, 0, 26, 0, -36], [0, 10, 6, 10, -22, -11], [0, -10, 8, -10, -2, -1], [-74, 31, 0, -31, 0, 1], [0, 6, -1, 6, -12, -6], [-58, 38, 0, -38, 0, -6], [-16, 50, 0, -50, 0, -49], [148, -13, 0, 13, 0, -11], [0, 18, -12, 18, 18, 9], [0, -4, 12, -4, 28, 14], [0, -26, -6, -26, -4, -2], [91, 43, 0, -43, 0, -84], [0, 22, 14, 22, 8, 4], [-139, 44, 0, -44, 0, -63], [0, -20, -27, -20, 2, 1], [14, -12, 0, 12, 0, -45], [136, 40, 0, -40, 0, -5], [174, 26, 0, -26, 0, 6], [0, -12, 18, -12, -6, -3], [125, 55, 0, -55, 0, 10], [0, 19, 39, 19, -16, -8], [0, -29, -2, -29, -22, -11], [200, -12, 0, 12, 0, 49], [0, 17, -16, 17, 10, 5], [0, -29, 27, -29, 2, 1], [0, 31, -16, 31, 14, 7], [0, 20, 29, 20, -14, -7], [4, 2, 0, -2, 0, -37], [175, -57, 0, 57, 0, 42], [0, -38, 22, -38, 26, 13], [-76, 34, 0, -34, 0, 11], [0, 38, 59, 38, 16, 8], [284, 35, 0, -35, 0, -69], [0, 58, 76, 58, 8, 4], [-1, -52, 0, 52, 0, 95], [0, -14, -22, -14, -4, -2], [140, -96, 0, 96, 0, 54], [-147, -20, 0, 20, 0, -21], [0, 2, -90, 2, 28, 14], [69, -123, 0, 123, 0, -10], [0, -33, -15, -33, 36, 18], [0, 53, 22, 53, 28, 14], [-16, 63, 0, -63, 0, -48], [2, 40, 0, -40, 0, 98], [98, 64, 0, -64, 0, 43], [0, 58, -6, 58, 14, 7], [0, -38, 5, -38, 14, 7], [-83, 75, 0, -75, 0, -76], [0, 35, 39, 35, -20, -10], [167, 98, 0, -98, 0, 60], [0, 117, 12, 117, 6, 3], [131, -67, 0, 67, 0, -67], [0, -92, 38, -92, 26, 13], [101, 134, 0, -134, 0, -85], [284, -53, 0, 53, 0, 107], [0, 122, -12, 122, 22, 11], [0, -17, -15, -17, -22, -11], [-313, 100, 0, -100, 0, -109], [0, -88, -21, -88, -50, -25], [156, -84, 0, 84, 0, -53], [0, 28, -16, 28, 62, 31], [0, 32, 40, 32, -50, -25], [434, -209, 0, 209, 0, 106], [0, 35, 18, 35, -92, -46], [272, -20, 0, 20, 0, -149], [0, 1, -8, 1, 56, 28], [0, 68, 98, 68, -8, -4], [0, -102, -6, -102, 30, 15], [-416, 36, 0, -36, 0, 24], [596, -18, 0, 18, 0, 103], [304, -10, 0, 10, 0, 164], [0, 82, -94, 82, 32, 16], [0, -71, -96, -71, -58, -29], [0, 122, 20, 122, -2, -1], [110, -133, 0, 133, 0, 75], [197, 10, 0, -10, 0, -89], [0, 35, -14, 35, -32, -16], [0, 13, 53, 13, -82, -41], [0, -21, 18, -21, -78, -39], [-601, -54, 0, 54, 0, 82], [44, -37, 0, 37, 0, 69], [-159, -23, 0, 23, 0, 96], [0, -87, 25, -87, -54, -27], [290, 103, 0, -103, 0, -215], [-56, -27, 0, 27, 0, -22], [0, -33, -75, -33, -48, -24], [326, 15, 0, -15, 0, 138], [0, 30, -80, 30, -48, -24], [0, 60, -78, 60, 6, 3], [0, 17, 70, 17, -20, -10], [-219, 31, 0, -31, 0, -103], [124, 102, 0, -102, 0, -297], [0, -64, -85, -64, -2, -1], [0, 29, -110, 29, 34, 17], [414, -156, 0, 156, 0, 217], [0, -12, -93, -12, -66, -33], [-432, 6, 0, -6, 0, 28], [0, 37, -22, 37, -16, -8], [-180, -129, 0, 129, 0, 280], [211, 71, 0, -71, 0, -115], [-338, 69, 0, -69, 0, -66], [0, 29, -22, 29, -32, -16], [494, 88, 0, -88, 0, -245], [-133, 77, 0, -77, 0, -1], [0, 77, -53, 77, 76, 38], [-307, 124, 0, -124, 0, -73], [0, -14, 20, -14, 164, 82], [428, -82, 0, 82, 0, 102], [0, 40, 20, 40, -4, -2], [0, 102, -8, 102, 6, 3], [-368, 142, 0, -142, 0, -14], [0, -18, 70, -18, -36, -18], [-88, -250, 0, 250, 0, 131], [0, 71, 174, 71, -14, -7], [397, -189, 0, 189, 0, 107], [0, -177, -108, -177, -6, -3], [219, 101, 0, -101, 0, -38], [0, 108, -64, 108, 60, 30], [544, 2, 0, -2, 0, 157], [0, -41, 42, -41, -52, -26], [-795, 183, 0, -183, 0, -178], [0, -147, -43, -147, 18, 9], [148, 58, 0, -58, 0, 336], [0, -111, 144, -111, -36, -18], [-290, 72, 0, -72, 0, -169], [0, 20, -92, 20, -14, -7], [244, -228, 0, 228, 0, -75], [0, -111, 81, -111, 78, 39], [461, 64, 0, -64, 0, -13], [0, 24, -123, 24, 72, 36], [0, -47, 92, -47, 74, 37], [0, -303, -27, -303, -18, -9], [-922, -103, 0, 103, 0, 186], [0, -109, -20, -109, -122, -61], [0, 21, 43, 21, -48, -24], [0, 68, 106, 68, -44, -22], [-100, 316, 0, -316, 0, -272], [-835, 143, 0, -143, 0, -123], [-127, 26, 0, -26, 0, -90], [0, -40, 86, -40, 76, 38], [0, -37, -126, -37, -2, -1], [-856, 52, 0, -52, 0, -260], [0, -63, 228, -63, -90, -45], [1069, -386, 0, 386, 0, 148], [-222, 335, 0, -335, 0, -183], [0, -103, 45, -103, 10, 5], [292, 8, 0, -8, 0, 290], [0, 24, -3, 24, -114, -57], [828, 130, 0, -130, 0, 177], [-377, -197, 0, 197, 0, 19], [-164, 41, 0, -41, 0, -275], [0, 183, 108, 183, 156, 78], [774, 4, 0, -4, 0, -256], [0, -37, -119, -37, 154, 77], [0, -52, 22, -52, 148, 74], [0, -224, -90, -224, 2, 1], [925, -67, 0, 67, 0, -70], [342, 158, 0, -158, 0, -210], [597, 130, 0, -130, 0, -318], [0, -47, 66, -47, 86, 43], [-538, -314, 0, 314, 0, 268], [0, -5, -100, -5, 164, 82], [150, -288, 0, 288, 0, 190], [0, 306, -33, 306, -60, -30], [0, 1, 82, 1, -22, -11], [0, -121, -31, -121, 4, 2], [465, -36, 0, 36, 0, 32], [-1000, -270, 0, 270, 0, 288], [0, -93, 201, -93, -36, -18], [0, 206, 52, 206, 16, 8], [0, -160, -142, -160, -32, -16], [-64, 216, 0, -216, 0, -419], [391, -141, 0, 141, 0, 287], [1323, -378, 0, 378, 0, 173], [0, -34, -8, -34, 112, 56], [0, 150, -44, 150, -132, -66], [344, 90, 0, -90, 0, -360], [0, -45, 4, -45, 210, 105], [0, -459, 39, -459, -12, -6], [206, -75, 0, 75, 0, 456], [-717, -218, 0, 218, 0, 96], [0, 186, -69, 186, -180, -90], [-182, -164, 0, 164, 0, 354], [0, -31, 256, -31, -2, -1], [0, -201, -48, -201, -66, -33], [-403, 288, 0, -288, 0, -552], [1280, 89, 0, -89, 0, 93], [0, 118, 282, 118, -22, -11], [0, 97, -122, 97, 56, 28], [0, 200, -141, 200, -38, -19], [671, 149, 0, -149, 0, -285], [-220, 381, 0, -381, 0, -272], [0, 277, 145, 277, 80, 40], [-194, -45, 0, 45, 0, 26], [0, 180, 62, 180, -120, -60], [681, 273, 0, -273, 0, 86], [0, 283, 25, 283, 134, 67], [0, -291, 30, -291, -66, -33], [578, 243, 0, -243, 0, 331], [0, -69, 78, -69, 36, 18], [185, -177, 0, 177, 0, 594], [1928, 52, 0, -52, 0, 32], [880, -454, 0, 454, 0, 104], [0, -131, -153, -131, -64, -32], [566, -144, 0, 144, 0, -159], [0, -125, -244, -125, -64, -32], [554, 300, 0, -300, 0, 171], [0, -134, 203, -134, -46, -23], [0, -48, -210, -48, -18, -9], [0, 8, -240, 8, 136, 68], [0, 213, 54, 213, -78, -39], [-542, 6, 0, -6, 0, -246], [1576, -170, 0, 170, 0, -138], [-1543, 253, 0, -253, 0, -317], [0, -234, -160, -234, -252, -126], [0, 339, 164, 339, 144, 72], [552, 57, 0, -57, 0, 211], [0, 242, 312, 242, 64, 32], [628, -129, 0, 129, 0, -348], [0, 224, -24, 224, 22, 11], [224, 392, 0, -392, 0, -225], [0, -35, -43, -35, 308, 154], [0, -114, -322, -114, 42, 21], [-1131, -196, 0, 196, 0, 318], [0, 140, -189, 140, 142, 71], [0, -288, -198, -288, 6, 3], [713, -161, 0, 161, 0, 424], [1448, 74, 0, -74, 0, 222], [0, 96, -39, 96, 168, 84], [-480, -318, 0, 318, 0, -193], [-1438, -113, 0, 113, 0, -331], [0, -161, 140, -161, 182, 91], [-1473, 155, 0, -155, 0, -440], [-1428, -92, 0, 92, 0, 87], [0, 201, 141, 201, 36, 18], [-514, -361, 0, 361, 0, 143], [0, 2, 48, 2, 76, 38], [0, -54, 174, -54, -18, -9], [1314, -39, 0, 39, 0, 374], [0, -198, 170, -198, -96, -48], [203, -421, 0, 421, 0, -55], [438, 116, 0, -116, 0, -486], [-2279, 72, 0, -72, 0, 44], [-2080, 449, 0, -449, 0, -255], [674, 282, 0, -282, 0, 85], [-376, -454, 0, 454, 0, 737], [0, 68, -60, 68, -344, -172], [367, -735, 0, 735, 0, 348], [-934, -76, 0, 76, 0, -330], [0, 135, 188, 135, -114, -57], [0, 214, -64, 214, 50, 25], [1672, -756, 0, 756, 0, 401], [0, -243, -66, -243, -30, -15], [43, -129, 0, 129, 0, -333], [48, 167, 0, -167, 0, -59], [0, -93, 138, -93, -66, -33], [430, 48, 0, -48, 0, -433], [0, 74, -146, 74, -182, -91], [-228, 145, 0, -145, 0, 302], [0, 31, 111, 31, -22, -11], [0, 142, -63, 142, -310, -155], [0, -229, -176, -229, -116, -58], [0, 521, -53, 521, 130, 65], [0, -410, -166, -410, -172, -86], [380, -102, 0, 102, 0, 400], [0, -292, 384, -292, -20, -10], [-2276, -163, 0, 163, 0, 10], [0, 658, -123, 658, 44, 22], [0, -524, -94, -524, -196, -98], [-1736, 345, 0, -345, 0, -546], [1270, 88, 0, -88, 0, 628], [0, -44, 57, -44, -232, -116], [272, -81, 0, 81, 0, 592]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1452_e_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1452_3_e_i();".
// 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_1452_3_e_i(:prec:=6)
    chi := MakeCharacter_1452_e();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 3));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(1999) - 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_1452_3_e_i();".
// 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_1452_3_e_i( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1452_e();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![10791, 0, 2035, 0, 97, 0, 1]>,<7,R![-242, -28, 8, 1]>],Snew);
    return Vf;
end function;