
// Make newform 819.2.n.e in Magma, downloaded from the LMFDB on 23 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_819_n();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_819_n_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_819_2_n_e();".
// 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_819_2_n_e();".
// 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, 13, 195, -312, 811, -544, 1005, -481, 895, -205, 326, -35, 87, -4, 11, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-13972229088464, -208029345221468, -108368220879957, -577279503454940, -26247556294384, -589939014330730, -98337615982400, -637132974569996, -11860911508749, -251702286046476, -21460338818148, -70844833728257, -3074932976676, -9256957678228, -602738721141, -850102445244], [-611267573740024, 30629905626407, 455677150451133, -1373541222944320, 1195526676592186, 187320602242210, 2746301731062440, 384615393503879, 1187742608006541, 338939264634954, 389923212586737, 88760072093213, 52870958416314, 13517776750957, 5453415441339, 945658852056], [-10161380439778, 33550802926699, 497936518850021, -999941039148235, 1083373096954242, 676023888749330, 2481887787922950, 891852285648643, 1064033894083157, 525071177418723, 364492101483669, 139973996494901, 49756879408343, 19993119508609, 5359246221883, 1548397573197], [-8612982866581, -136810746763792, 766323242696737, -1980977600835720, 3339064567965244, -1249677488024080, 3362003460236605, -2334814734982064, 1557997436445829, -856384219169819, 344198532927168, -278712020050663, 44493471781581, -35957350192522, 2398500018441, -3810848648686], [-2454346762052891, -10163858567310982, 6039092233128032, -15416083486559320, 399705759957354, -11233975942651870, 11075617584988655, 5141508670414336, 3400337677941704, 3895919201439001, 1718479268465178, 1505862005807122, 229934387339641, 219131096234958, 33095488971866, 22240023182504], [-1527844957759087, -18100020514647914, 39140928712744339, -56537190221514755, 58806711807132708, -51995180624536250, 68922263214064465, -34791569261503438, 27440315802224893, -9561210057401608, 7369609606825686, -2278547346806461, 945357317741162, -248272416035934, 80722315132867, -23960698558757], [13468531477239, -2398400014950427, 2544041682468796, -5401830167261236, 2782805001313508, -5797955983317930, 3159979917916907, -3294396074768529, 1154069266885630, -984482545211503, 300268949144295, -206484663504642, 36844479871649, -23056845757699, 3078673249492, -1778153235146], [174261731510394, 2616216451370523, -4936614979055708, 11305230234449920, -8190831638455146, 13943752617923920, -7357775166121180, 12493284122666531, -3116009249181596, 4533486344021116, -559872851824497, 1212508997719692, -65145874032084, 153091781251963, -850102445244, 13972229088464], [-1561887871205524, -2452125901935503, 32439278838552808, -46941064229416025, 68348199564129876, -51818201522647850, 67366680956630260, -60056970145125211, 29202146424854866, -21667564253989861, 6369277178514687, -6287052669219262, 800506448243009, -796493782907553, 42305988951004, -78334216662179], [541126055004554, 432729870487758, 6376257529840357, 13462802422151435, 5262660243488864, 26853299881601610, 13380711590415220, 29626192865873556, 4596778428280669, 12469185555804981, 2289567725966748, 3451826421856817, 320116699841551, 457612339093228, 45466225490261, 40582993882149], [-273843217222007, -6383574622903984, 13749352221620660, -25099987842740767, 22807330510966992, -27864296349778072, 22912974402719057, -23566610847554492, 9430098598560608, -8069708080242212, 2112117989573874, -2133804675429128, 261485413803346, -263471571349674, 15238766802188, -24469220650027], [20950999529842, -20971641574908571, 65375118976888151, -107879081650263685, 117538497500186772, -120446275827543100, 112908211013582750, -114175121032835207, 47455714076985947, -40207214376187487, 10269404382982179, -11058467161934039, 1273004752646143, -1384852130591721, 66691456016783, -131547920533543], [-79869396342261, 8016090006501768, -14919838930830898, 34523127081241160, -26716032806738496, 43268255944038050, -22689027227537705, 40199282496485536, -9718282575984076, 14795782515868121, -1633893875813922, 4004999085302952, -187060135461519, 508750470699368, 504608087166, 46673194766134], [431512462062377, -19457791048108706, 19109720516331511, -88243990870548815, 37652742907899012, -126589546885231730, 16417888475821585, -118092162473133742, 8153767607643457, -45544873806547732, -1099348556784906, -12231961189578409, -227311479417322, -1577680530611646, -74541657903737, -140712016641263]];
    Rf_basisdens := [1, 1, 200652098581830, 200652098581830, 200652098581830, 200652098581830, 601956295745490, 601956295745490, 40130419716366, 200652098581830, 601956295745490, 200652098581830, 120391259149098, 601956295745490, 200652098581830, 601956295745490];
    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_819_n();"
function MakeCharacter_819_n()
    N := 819;
    order := 3;
    char_gens := [92, 703, 379];
    v := [3, 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_819_n_Hecke();"
function MakeCharacter_819_n_Hecke(Kf)
    N := 819;
    order := 3;
    char_gens := [92, 703, 379];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, 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+1)]];
    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, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0], [0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 1, -1, 0, 0], [0, -2, -1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [2, 3, 1, 1, -1, 0, -2, 0, 0, 0, -1, 1, 2, -1, 0, -1], [-1, -1, 0, 0, 1, -1, 0, 1, 0, 1, 0, 0, -1, 0, -2, 0], [0, 0, 2, 0, 0, 0, 0, 2, 1, -2, 1, -1, -1, 0, 0, 1], [1, -1, 0, 0, -1, 1, 0, 0, 1, -1, 1, 0, -1, 2, 1, 2], [0, -2, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, -2, 0], [0, 1, 1, 0, 0, -1, -1, 2, 2, -2, 0, -2, -2, 0, 0, -1], [1, -2, 0, 0, 0, 0, 0, 2, 1, -1, 1, 0, -3, 0, 0, 0], [0, -3, -3, -3, 0, 3, 3, -1, 1, -2, 0, -1, -1, 2, 3, 1], [-5, 1, 0, 0, 1, -1, 0, 1, 0, 5, 1, 0, -2, 1, 0, 1], [0, 1, 0, 0, 0, -2, -1, 1, 1, 3, -1, -1, -1, -1, 0, -1], [3, -4, -3, 0, -1, 0, 1, -1, 0, 0, 0, 0, -1, 1, 0, 1], [-4, 0, 0, -1, 2, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, -1], [0, 2, 0, 0, -2, 2, 0, -1, 1, 0, 0, 0, 1, 1, 2, 1], [0, 2, 0, 0, -2, 2, 0, -2, -2, 0, -3, 0, 5, -1, -1, -1], [0, 2, -1, -1, 0, 1, -2, 1, 1, 2, 0, -1, -1, 0, 1, -2], [-2, 4, 1, 1, -1, 0, -3, 2, 0, 0, -2, -1, 3, -1, 0, -4], [-2, -1, 0, 0, -3, 3, 0, 0, -1, 2, -1, 0, 1, -1, 0, -1], [2, 2, 0, 0, -2, 2, 0, -2, 0, -2, -2, 0, 4, -1, 5, -1], [2, 9, 5, 2, -3, 0, -4, 1, 0, 0, -1, 1, 4, -3, 0, -2], [0, 0, -1, 0, 0, -1, 0, 1, 2, -2, 1, -2, -2, 2, 0, -1], [0, 1, 0, 0, 1, -1, 0, 0, -3, 0, -2, 0, 2, -1, 0, -1], [-1, -2, 0, 0, 4, -4, 0, -3, 1, 1, 2, 0, 1, 3, 1, 3], [-2, -2, 0, 0, -2, 2, 0, 0, 1, 2, -2, 0, 2, 0, 1, 0], [0, -1, 4, 3, 0, 0, 1, 1, 2, 3, 0, -2, -2, 1, -3, 0], [0, -4, -3, -1, 0, 1, 4, 2, 3, -1, 0, -3, -3, 1, 1, 3], [0, -1, -1, -7, 0, 5, 1, 0, 0, -3, -2, 0, 0, -2, 7, 1], [-2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 1, 0, -3, 0, -3, 0], [1, 2, -1, 1, 3, 0, -3, -2, 0, 0, -1, 1, 3, -2, 0, 1], [-2, 2, 0, 0, 2, -2, 0, -1, -3, 2, -4, 0, 5, -2, 2, -2], [-4, -2, 0, 0, 0, 0, 0, 5, 0, 4, -1, 0, -4, -2, -2, -2], [6, 7, 7, -1, 1, 0, 0, 2, 0, 0, 1, -1, 0, -1, 0, -1], [0, 2, -3, -2, 0, 1, -2, -3, -2, -2, -1, 2, 2, 0, 2, -3], [1, 3, 4, 1, -4, 0, 1, 3, 0, 0, 2, 0, -1, -1, 0, -1], [0, -2, -2, -1, 0, 0, 0, 1, 0, 0, 1, -3, 0, -1, 0, 0], [6, 1, 1, 1, -5, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 1], [2, -3, -2, 0, 2, 0, 1, -3, 0, 0, -1, 1, -1, 2, 0, 2], [5, 8, 2, -1, -2, 0, -6, 1, 0, 0, -1, 2, 6, -5, 0, -2], [0, -4, -4, 2, 0, 0, 4, -4, -1, 5, -4, 1, 1, -1, -2, 1], [0, 1, 0, -3, 0, 0, -1, 2, 2, -5, -1, -2, -2, -1, 3, -1], [0, 1, 4, -5, 0, 2, -1, 2, 0, 0, 4, 0, 0, 2, 5, 1], [0, 3, 2, 0, 0, 2, -3, 3, 2, 8, 0, -2, -2, -1, 0, -2], [0, -4, -1, -1, 0, 1, 4, -2, -1, -4, -3, 1, 1, -2, 1, 3], [0, -1, 3, 6, 0, 3, 1, 0, -1, -5, -1, 1, 1, -2, -6, 2], [0, -1, -4, -5, 0, 4, 1, -1, 1, -8, 5, -1, -1, 7, 5, -1], [-3, 1, 4, -6, 6, 0, 3, 1, 0, 0, 3, 0, -3, 0, 0, 2], [0, -1, -10, -3, 0, 0, 1, -1, 1, -5, 0, -1, -1, 2, 3, -1], [-3, 1, 0, 0, 5, -5, 0, 0, -2, 3, 2, 0, -2, -1, 1, -1], [-4, 5, 0, 0, 5, -5, 0, -3, -1, 4, -1, 0, 4, 0, -3, 0], [3, 4, 3, 0, 1, 0, -1, 0, 0, 0, -2, -1, 1, 1, 0, -2], [0, -2, -4, -7, 0, 0, 2, 1, 1, 6, -1, -1, -1, -1, 7, 2], [-1, 9, 0, 0, 1, -1, 0, -2, -3, 1, -2, 0, 4, -2, -1, -2], [0, 3, 2, 2, 0, -4, -3, 3, 0, 12, 0, 0, 0, -3, -2, 0], [10, 3, 2, 4, -6, 0, -1, 1, 0, 0, 1, -1, 1, -2, 0, 0], [2, -3, -5, 3, -3, 0, -2, 1, 0, 0, -3, 2, 2, 1, 0, -4], [15, -4, 0, 0, 0, 0, 0, 4, 1, -15, -1, 0, -3, 0, -4, 0], [-4, 7, 4, 5, -6, 0, -3, -4, 0, 0, -3, 5, 3, 0, 0, 1], [2, -1, 0, 0, -5, 5, 0, -2, 0, -2, 0, 0, 2, 0, -2, 0], [0, -9, -5, -5, 0, 1, 9, -2, 6, -3, 0, -6, -6, 8, 5, 1], [0, -3, -10, -3, 0, 6, 3, -4, -1, 4, -2, 1, 1, 1, 3, 0], [-9, 0, -1, -3, 3, 0, -1, -2, 0, 0, -2, -2, 1, 1, 0, 0], [-4, -11, -7, 0, 1, 0, 4, 0, 0, 0, 1, -4, -4, 3, 0, 1], [0, -1, 1, 4, 0, -3, 1, -1, 1, -6, -1, -1, -1, 1, -4, -1], [0, -4, 3, 4, 0, -1, 4, -1, 1, -5, 0, -1, -1, 2, -4, 2], [-7, -3, -5, 6, -3, 0, -2, -2, 0, 0, 0, 6, 2, -2, 0, 2], [0, 5, 2, 6, 0, -4, -5, 6, 0, -15, 2, 0, 0, -4, -6, 1], [11, 12, 7, 4, -3, 0, -5, -4, 0, 0, -2, -1, 5, -3, 0, 2], [-8, 3, -1, 1, -3, 0, -4, -3, 0, 0, -5, 4, 4, 1, 0, -2], [0, 0, 4, -2, 0, -4, 0, 0, 3, -4, 1, -3, -3, 4, 2, -3], [1, 3, 2, 0, 0, 0, -1, -4, 0, 0, -3, 3, 1, 2, 0, 1], [-10, -9, 0, 0, 7, -7, 0, -3, -1, 10, 10, 0, -7, 4, -7, 4], [2, -4, -1, -4, 3, 0, 3, 2, 0, 0, 5, 3, -3, -2, 0, 3], [1, 3, 0, 0, 7, -7, 0, 3, 0, -1, 2, 0, -5, -3, -6, -3], [0, -2, -2, -1, 0, 4, 2, -3, 0, -1, 0, 0, 0, 3, 1, -1], [0, 1, -1, 1, 0, -5, -1, -1, 3, -3, -1, -3, -3, 3, -1, -5], [1, -3, -4, 0, -2, 0, -1, 2, 0, 0, -1, -1, 1, 0, 0, -3], [8, -2, -1, 1, 1, 0, 1, 2, 0, 0, 2, 7, -1, -1, 0, 0], [6, 6, 0, 0, 2, -2, 0, -2, 1, -6, -1, 0, 3, 1, 5, 1], [-12, -6, 0, 0, 2, -2, 0, -1, 1, 12, 4, 0, -3, -1, 0, -1], [0, 7, 10, 4, 0, 2, -7, 1, -3, -2, -2, 3, 3, -6, -4, -3], [6, 11, 0, 0, -3, 3, 0, -2, -2, -6, -2, 0, 4, 2, 2, 2], [7, 0, 0, 0, 2, -2, 0, 3, -1, -7, -2, 0, -1, -1, -3, -1], [-4, 0, 0, 0, -4, 4, 0, -6, 0, 4, 3, 0, 3, 4, 7, 4], [-2, 10, 4, 2, -4, 0, -6, -1, 0, 0, -5, 2, 6, -1, 0, -4], [0, 4, 2, -5, 0, 2, -4, 5, -1, -1, 4, 1, 1, -2, 5, 2], [6, -4, -5, -3, 1, 0, -1, 3, 0, 0, 1, 1, 1, -2, 0, -2], [0, 7, -1, -1, 0, -3, -7, 2, -1, -8, -1, 1, 1, -4, 1, -4], [0, 1, -9, 0, 0, 7, -1, -1, -5, -4, -1, 5, 5, -5, 0, 3], [0, -1, 3, 0, 0, -1, 1, -1, 1, -22, -1, -1, -1, 1, 0, -1], [-7, -8, 0, 0, 0, 0, 0, 5, 6, 7, 4, 0, -9, 1, -1, 1], [12, 0, 0, 0, -2, 2, 0, 5, -1, -12, -4, 0, -1, -4, 2, -4], [13, 10, 0, 0, -4, 4, 0, 1, -3, -13, -7, 0, 6, -3, 1, -3], [-9, -8, 0, 0, 4, -4, 0, -1, 3, 9, 8, 0, -7, 8, -3, 8], [0, -9, -12, -7, 0, 8, 9, -6, -1, 4, -4, 1, 1, 1, 7, 4], [1, 12, 8, 0, -2, 0, -4, -5, 0, 0, 0, 0, 4, -4, 0, 5], [4, 0, -3, 0, -3, 0, -3, 2, 0, 0, 0, 0, 3, -3, 0, -2], [0, 3, 5, 2, 0, 5, -3, 4, 1, -6, -2, -1, -1, -5, -2, 0], [5, -2, 0, 0, -2, 2, 0, -6, -4, -5, -2, 0, 8, 0, 6, 0], [9, -3, 0, 0, -1, 1, 0, -1, 2, -9, 4, 0, -3, 0, -6, 0], [8, -2, 0, 0, -6, 6, 0, -2, 1, -8, 1, 0, 1, 1, 7, 1], [0, 3, -3, 2, 0, -3, -3, -2, 1, 2, 0, -1, -1, 3, -2, -6], [0, 0, -2, -8, 0, 10, 0, 2, -1, 5, -2, 1, 1, -5, 8, 3], [-4, 10, 0, 0, -4, 4, 0, 4, 5, 4, -3, 0, -1, -4, 7, -4], [0, -2, -7, -9, 0, 1, 2, 4, 6, -4, 1, -6, -6, 3, 9, 0], [16, 1, 1, 2, 1, 0, 0, -1, 0, 0, 5, 1, 0, -5, 0, 6], [-3, -1, -4, 7, -8, 0, -3, 0, 0, 0, -2, 1, 3, -1, 0, -2], [-6, -2, 0, 0, 6, -6, 0, -4, -4, 6, -4, 0, 8, 5, -3, 5], [3, -15, 0, 0, 3, -3, 0, 7, 4, -3, -4, 0, -3, 0, -8, 0], [-5, -6, 0, 0, -2, 2, 0, -1, 0, 5, -4, 0, 5, 0, 3, 0], [0, 3, -14, 4, 0, -4, -3, -5, -2, 10, -6, 2, 2, -3, -4, -6], [-1, -13, 0, 0, -1, 1, 0, 0, -1, 1, 8, 0, -8, 4, -1, 4], [8, -4, 0, 3, 2, 0, 4, 1, 0, 0, 3, -3, -4, 1, 0, 2], [-3, -9, 0, 0, 1, -1, 0, -2, 0, 3, 8, 0, -6, 0, -3, 0], [-5, 10, 0, 0, -4, 4, 0, -4, -2, 5, -4, 0, 8, -5, 6, -5], [6, 16, 7, 6, -1, 0, -9, -1, 0, 0, 2, 5, 9, -11, 0, 3], [0, 5, -1, 5, 0, 1, -5, -2, -5, 5, -2, 5, 5, -5, -5, -2], [0, 0, -4, 3, 0, -8, 0, -8, -2, 4, -6, 2, 2, 0, -3, -6], [0, 7, 13, 9, 0, -1, -7, 4, -1, 10, 1, 1, 1, -4, -9, -2], [2, 1, 0, 0, -1, 1, 0, 3, 4, -2, -1, 0, -2, 3, 7, 3], [-1, 15, 6, 1, -6, 0, -9, 5, 0, 0, -3, -1, 9, -6, 0, -8], [5, 12, 13, -6, 7, 0, 1, 2, 0, 0, 2, -1, -1, -1, 0, 0], [-5, 0, 4, 13, -4, 0, 4, -2, 0, 0, 6, 2, -4, -2, 0, 8], [-1, 2, 6, -8, 0, 0, 4, 6, 0, 0, 1, -6, -4, 3, 0, -5], [0, 3, -1, 2, 0, -3, -3, 1, 1, 16, -1, -1, -1, -1, -2, -3], [10, -10, -10, 0, 2, 0, 0, -4, 0, 0, 2, 6, 0, -2, 0, 6], [0, 9, 12, 8, 0, -8, -9, 11, 4, -2, 10, -4, -4, 3, -8, -2], [-5, 8, 0, 0, -2, 2, 0, 0, -9, 5, -2, 0, 2, -1, 2, -1], [0, -5, 2, 0, 0, 0, 5, -4, -1, 8, -5, 1, 1, -2, 0, 2], [-10, -20, -9, -6, 7, 0, 11, -5, 0, 0, 8, -1, -11, 3, 0, 13], [0, -2, -4, 2, 0, 4, 2, -2, 3, 23, -2, -3, -3, 3, -2, -3], [0, -1, 2, -4, 0, 2, 1, 0, -2, -7, 0, 2, 2, -2, 4, 3], [0, -9, -15, -2, 0, -5, 9, -10, 1, 1, -1, -1, -1, 10, 2, -2], [-3, 2, 0, 0, 0, 0, 0, -3, 0, 3, 5, 0, -2, -1, 1, -1], [24, -3, -3, 0, 5, 0, 0, -1, 0, 0, 1, 5, 0, -1, 0, 2], [11, 12, 11, 2, -3, 0, -1, 0, 0, 0, -1, -2, 1, 0, 0, -1], [-4, -6, 0, 0, -6, 6, 0, 2, -3, 4, 4, 0, -6, 1, 5, 1], [0, -11, -7, -7, 0, 7, 11, -8, 2, 10, -1, -2, -2, 9, 7, 1], [21, 0, -1, -3, -9, 0, -1, -1, 0, 0, -2, -1, 1, 1, 0, -1], [-7, -23, -12, 0, -2, 0, 11, -1, 0, 0, 4, -5, -11, 7, 0, 5], [0, -9, 0, 0, 11, -11, 0, 2, -2, 0, -1, 0, -1, -1, -4, -1], [-9, 16, 12, 11, -4, 0, -4, 4, 0, 0, -1, -3, 4, -3, 0, -5], [-14, -8, 0, 0, 8, -8, 0, -2, -4, 14, 5, 0, -3, -1, -7, -1], [0, 12, 4, 10, 0, -6, -12, 7, -5, -15, 3, 5, 5, -9, -10, 0], [0, -2, 6, -2, 0, 2, 2, 9, 1, 4, 6, -1, -1, -2, 2, 10], [2, 16, 7, -4, -5, 0, -9, 3, 0, 0, -5, -4, 9, -4, 0, -8], [0, 0, -10, -9, 0, 6, 0, -1, -5, 8, -1, 5, 5, -5, 9, 4], [0, -13, -15, 0, -3, 0, -2, 4, 0, 0, -2, 1, 2, 0, 0, -6], [-9, -9, 0, 0, 1, -1, 0, 9, -1, 9, 1, 0, -10, -2, -2, -2], [1, 3, 5, -11, 5, 0, 2, 6, 0, 0, 2, -1, -2, 0, 0, -4], [1, -4, -10, 5, -6, 0, -6, -6, 0, 0, -9, 5, 6, 3, 0, -3], [-22, -28, -12, -6, 4, 0, 16, 0, 0, 0, 9, -3, -16, 7, 0, 9], [19, -7, -2, 3, -2, 0, 5, 2, 0, 0, 7, -8, -5, -2, 0, 5], [-5, 22, 8, -1, -8, 0, -14, 5, 0, 0, -6, 1, 14, -8, 0, -11], [14, 5, 0, 0, -13, 13, 0, -4, -5, -14, -3, 0, 7, 0, 6, 0], [5, 14, 0, 0, -2, 2, 0, -3, -1, -5, -7, 0, 10, -1, -3, -1], [8, -10, 0, 0, -2, 2, 0, 0, 7, -8, -2, 0, 2, 2, 3, 2], [2, -11, -13, -6, 7, 0, -2, -3, 0, 0, -4, 4, 2, 2, 0, -1], [3, -21, -13, -3, -1, 0, 8, 1, 0, 0, 6, -2, -8, 2, 0, 5], [9, 7, 3, -7, -1, 0, -4, 0, 0, 0, -5, -8, 4, 1, 0, -5], [0, -8, 0, 0, 14, -14, 0, 8, 7, 0, 7, 0, -15, 5, -7, 5], [-4, -21, -13, 1, 13, 0, 8, 6, 0, 0, 8, -2, -8, 0, 0, 2], [0, 5, 1, 7, 0, -1, -5, -2, 2, 7, -4, -2, -2, 0, -7, -9]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_819_n_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_819_2_n_e();".
// 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_819_2_n_e(:prec:=16)
    chi := MakeCharacter_819_n();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 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_819_2_n_e();".
// 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_819_2_n_e( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_819_n();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![1, -13, 195, 312, 811, 544, 1005, 481, 895, 205, 326, 35, 87, 4, 11, 0, 1]>,<11,R![-1136, 3264, -2513, -79, 554, -43, -41, 2, 1]>],Snew);
    return Vf;
end function;