
// Make newform 1050.3.p.f in Magma, downloaded from the LMFDB on 23 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1050_p();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1050_p_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_1050_3_p_f();".
// 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_1050_3_p_f();".
// 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 := [6882692292, 379489320, -123648876, 51487320, 4799806, -250384, 209990, 12456, 1007, 300, 56, -4, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [153749869847424591394514000575649004, -53531706331889152181397061344020988, -4554845829787427161940232655265160, 240508681898520952709559210664608, -226048349092969743473019461171842, -15249047250122917892983496922486, -1687020719579756648102039790584, -429689890669635037055974600508, -77082624202448882766051479335, 4805966189351074809209907371, -1220656239404306431507712517, -7312640379351403241641847], [-128477218889527196728032, -17365236288539319211500, -1117799984051092801872, -1938952908037817336424, -46390039494241191392, -27413887679403990002, -2640903328657569756, -481962685768778140, -8793522094799700, -11848919253611537, 103711575797434, -97053122943645], [-24885514122548791790854235417378148, -9153428894317729744693308136177092, -1149213266765744428942761817781064, -79939059340227051179227009423872, -85643806223010921556267095241582, -1788113610270522000593658743826, -1172994040482233237509999469768, -49825312716093174099280139432, -20479146067519574219516427991, 765684251710026347286627107, -332561852884708150820621961, 24253856643754123762567993], [-44431041218766354370764, 21805736705260376845284, -6846417922576431521664, -759501373771218234876, -56620595952907578158, -31953918746048973414, -3545035653960153094, -396952612132669540, -78134392296611963, -12664102649046059, 327589951576233, -173144824834609], [667986781198753791884340, -91646595259766957356632, -29365745852810834804520, 3879205213947699279528, -1473116746214172403554, -70690588629362801072, -7033702392467976452, -1432009629271527636, -384230190964527625, 20322414788293800, -6413944368767417, -284500915977146], [10366063356778215971568283462387140, 5236039425407566775202010513181448, 1900123897935594945037662736250616, -39556052668414056501908170083000, 42713714980665430516120779185846, -1846424189350139900570864746088, 259656230706074538972447955724, -17418784382383788955162125908, 8876158293531845208918950563, -1629959434672883964324375844, 287816772078268966221697003, -34573176906724558286734222], [-469625976510425130363922875414538548, -36780136858940076239439085508863296, -6061645507425319509179808242246472, -2614398983403626664029427899582328, -207566169865897522064341653868262, -47301571440782087378988080407836, -7610024826275824060440331406428, -1008738152857369069410228828316, -11805504472107487633101184847, -18461112871177641380964158090, 200279396523248937328102845, -118280648117000274023242240], [-120517735292122705278580942095915468, 3643552619017580556027238840624044, 3073916311371731956513911247347960, -448902459171198711450459775037136, 48806887345368707515082309251358, 7781024118465489656540650313806, 1418017215246306671006804654168, 103191502886315420672398546528, 57958122242501808941937811735, -1010072270379346174421169157, 600474937779376077827963773, 55715980360172894158513661], [-100673414219259098703676674254331540, -4145573804800476991797114518713140, -2493146693631355276469124982405416, -101802639969531533005584256113024, -51611724369422563222299944756438, 9690719868259484963200543458182, -825688735233925518145935252032, 136695618168786957272320117088, 4817374183896997834172467121, 3573852232432001002361954107, 6309224490772026379987727, 57881838624391780455102001], [-5662177116998536717207338192948, -5817177268621517903504482276236, 2327863592501780603020854653016, 123047828192051148725379889098, -23448323671112683437457013994, 8457428145828394087111414285, 251145208401682267882836088, 3042646095547488681820701, 12629788878516408575666453, 1786245712233590004493224, -203699280429334160260229, 42339343767921687883000]];
    Rf_basisdens := [1, 1, 21960025555879820018281506717351672, 243945590348621381243184, 43920051111759640036563013434703344, 160637152555716800463108, 243945590348621381243184, 14640017037253213345521004478234448, 43920051111759640036563013434703344, 14640017037253213345521004478234448, 14640017037253213345521004478234448, 9195990601289706875327264119494];
    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_1050_p();"
function MakeCharacter_1050_p()
    N := 1050;
    order := 6;
    char_gens := [701, 127, 451];
    v := [6, 6, 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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1050_p_Hecke();"
function MakeCharacter_1050_p_Hecke(Kf)
    N := 1050;
    order := 6;
    char_gens := [701, 127, 451];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, -1, 0, 0, 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 := 3;
    raw_aps := [[0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0], [2, 0, 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, 1, -1, 1, 0, 1, 0, 0, 0, -1], [0, 0, 0, -1, -1, -1, 1, 0, 0, -1, 1, 0], [2, 0, 1, -4, 1, 0, 0, -1, 1, 1, 0, 0], [-2, -1, 1, 1, 1, -1, 0, 0, -1, 1, 1, 2], [0, 0, -1, 0, 1, 1, 1, 0, -1, 0, 1, 0], [-11, 2, 0, 11, -2, 2, 0, 2, 1, 1, 0, 0], [-1, -1, 1, 0, 1, -1, 1, 1, 0, 0, -1, 0], [-22, -3, -2, 11, 0, -5, 2, 0, 2, 1, 1, 1], [13, 1, -1, -13, 8, -8, 3, 1, -2, -3, -1, 2], [-4, 1, 4, 8, 4, 0, -6, 2, 4, 4, 0, -5], [-9, 2, -1, 0, -1, 16, 2, 1, 1, -1, 0, -4], [-5, 0, -1, -5, 4, 4, 4, 0, -1, 0, 1, -3], [0, 4, -2, 6, 14, -4, 1, -1, -2, -4, 4, 6], [-4, -5, -1, 2, -10, 16, 0, -3, 1, 2, 2, 4], [11, 0, -2, 11, 14, 14, 2, 0, 4, -6, 2, 0], [0, 1, 0, 21, -7, 2, 5, -8, 0, 2, -2, 1], [-10, -8, -6, 0, -6, -16, 4, 2, 2, -2, 4, 4], [2, 0, 0, -1, 12, -24, 2, 2, 0, 0, 0, 0], [-14, 4, 5, 14, -8, 8, -4, 4, -1, 4, 5, 1], [10, 5, 6, -20, -8, 6, -6, 1, 5, 5, 1, -1], [13, -5, 0, 13, 2, 2, -1, 5, 5, -5, 0, 1], [27, -10, -4, -54, -42, 24, 6, -7, 1, 1, -5, -4], [-74, -3, 3, 37, 7, -7, 8, 4, -3, -1, -1, 6], [3, -3, -2, 3, 2, 2, -3, 3, -6, 4, 2, 5], [77, -6, 1, -77, -18, 18, 6, -6, -3, -2, 1, 7], [0, 0, -1, -68, 62, 3, -7, 4, -1, 3, -3, 1], [-35, -5, -3, 0, -3, 71, 5, 1, 4, -4, -1, 0], [53, 9, 12, 0, 12, 24, -6, 0, -6, 6, -6, -3], [42, -6, 2, 42, 0, 0, 10, 6, 4, -2, -2, -12], [0, -13, -5, 53, -23, 1, 3, 9, -5, 1, -1, -8], [6, -2, 1, -12, -101, 47, 1, 2, -3, -3, 4, -1], [-70, -7, 2, 70, 40, -40, -3, -7, -2, 0, 2, -1], [0, 4, 12, -46, -1, 3, -1, -6, 12, 3, -3, -8], [38, 5, 5, -19, 58, -102, 3, 4, -5, -4, -4, 0], [-52, -2, -1, 52, 50, -50, 0, -2, -9, -10, -1, -1], [-29, 0, 1, 58, -33, 13, 17, -14, -3, -3, 4, 17], [61, -4, 6, 61, -12, -12, -2, 4, 9, -3, -6, -4], [0, -1, -9, -7, 35, -7, -9, 17, -9, -7, 7, 8], [13, 10, 9, -26, 11, -8, 14, -16, 2, 2, 7, 24], [-22, -12, 7, 22, -20, 20, -2, -12, -6, 1, 7, 5], [0, -22, -7, -99, -78, -1, 21, 2, -7, -1, 1, -15], [-56, -16, -4, 0, -4, 32, 22, 16, 6, -6, -2, -6], [44, 20, 10, -22, -5, 35, -17, -2, -10, -5, -5, -10], [-71, -17, 0, 0, 0, -18, 16, 16, 0, 0, 0, 1], [72, -12, -15, -144, 23, -21, 21, -4, -17, -17, 2, 9], [90, -7, -9, -45, 45, -115, 5, 5, 9, 7, 7, -2], [-14, 2, -2, -14, 5, 5, 7, -2, -9, 7, 2, -5], [-150, 1, 2, 150, 36, -36, -11, 1, 14, 16, 2, -9], [-133, 11, 3, 0, 3, -103, -13, -21, 8, -8, -11, 2], [-10, 15, -15, 5, 30, -84, -1, 8, 15, -6, -6, -30], [-36, -21, -18, 72, -52, 28, 2, 5, -7, -7, -11, -19], [14, 1, 12, 14, 88, 88, 1, -1, 14, -2, -12, -13], [0, 9, 7, -117, -61, -1, 3, -11, 7, -1, 1, 2], [122, -13, -7, -61, -95, 171, 4, -4, 7, 5, 5, 6], [133, -9, -7, 133, 50, 50, 11, 9, -7, 0, 7, -4], [0, -14, -3, 12, -118, -13, 23, 4, -3, -13, 13, -11], [-94, 29, 28, 0, 28, 56, -14, -8, -6, 6, -22, -15], [54, 29, 22, -27, 71, -104, -23, 12, -22, 6, 6, -7], [118, -16, -10, -236, -38, 22, 8, -6, -2, -2, -8, -8], [-113, 20, -7, 226, -159, 76, -16, 23, -7, -7, 0, 4], [20, -14, 16, -10, 80, -132, -14, -24, -16, 4, 4, 30], [-43, 2, -8, -43, 37, 37, 27, -2, -21, 13, 8, -19], [109, 4, 6, -109, -60, 60, 10, 4, 7, 13, 6, 16], [-41, -19, -4, 41, -154, 154, 19, -19, -8, -12, -4, 15], [-37, -12, -11, 0, -11, 106, 8, 12, -4, 4, 15, 4], [0, 25, 19, 40, -218, 6, -4, -27, 19, 6, -6, 6], [-44, -6, -20, 88, -18, -12, 30, 1, -31, -31, 11, 24], [178, 19, 1, -89, 85, -137, 8, -4, -1, -31, -31, -18], [-43, 36, -7, 43, -4, 4, -34, 36, 13, 6, -7, -41], [152, -7, -6, -76, 109, -230, 6, -1, 6, 0, 0, 1], [-154, -6, -14, 154, -77, 77, 31, -6, -19, -33, -14, 17], [-155, 8, -8, 0, -8, -207, 25, 27, -2, 2, 10, -33], [105, 14, 4, 105, -18, -18, -16, -14, 3, 1, -4, 12], [0, 4, 16, 46, 118, 6, 23, -33, 16, 6, -6, -12], [-55, 6, 4, -55, -49, -49, 1, -6, 11, -7, -4, -5], [-155, 9, -22, 155, -16, 16, -7, 9, -3, -25, -22, -29], [76, -15, 20, -38, 16, -11, -10, -6, -20, 19, 19, 35], [71, 30, -17, -142, 141, -75, -3, 16, -13, -13, -4, 27], [-267, 24, 0, 0, 0, 178, -42, -31, -11, 11, 11, 18], [0, -25, -11, -245, -271, -3, 17, 11, -11, -3, 3, -14], [59, -20, -11, -118, 179, -96, 18, -6, -12, -12, 1, -2], [-49, -7, 12, -49, -10, -10, -23, 7, -16, 28, -12, 11], [-258, -18, 12, 258, -146, 146, -2, -18, -12, 0, 12, 10], [-349, -28, -9, 0, -9, -185, 19, 23, -4, 4, 13, 9], [101, -41, 5, -101, -96, 96, 25, -41, -10, -5, 5, 30], [-39, 1, 3, 78, -177, 55, 11, 21, -32, -32, 35, 12], [164, 48, -7, 0, -7, 77, -21, -20, -1, 1, 8, -27], [-57, 10, -6, -57, 80, 80, -14, -10, -15, 9, 6, 20], [104, 27, 9, -52, -178, 382, -8, 11, -9, -8, -8, -18], [0, 17, 8, -61, -222, 7, -36, 12, 8, 7, -7, 9], [174, 2, -20, 0, -20, 176, -30, -40, 10, -10, 10, 28], [202, -18, 15, -202, 9, -9, 3, -18, -13, 2, 15, 18], [170, 26, 10, -340, -58, 36, -54, 42, 12, 12, -2, -28], [26, -22, -16, 26, -86, -86, 32, 22, -10, -6, 16, -16], [-32, 48, -16, 16, 30, -94, -60, -10, 16, 2, 2, -64], [-59, 31, 17, -59, 63, 63, -12, -31, 31, -14, -17, -5], [-32, 1, 1, 32, -337, 337, -12, 1, 31, 32, 1, -11], [71, -27, 11, 0, 11, 271, -49, -24, -25, 25, 14, 76], [0, 5, -23, -145, -345, -23, 25, -7, -23, -23, 23, 28], [110, -18, 0, -55, -13, 7, -35, -34, 0, 19, 19, 18], [59, -53, -20, -59, 184, -184, 65, -53, 15, -5, -20, 45], [0, 11, -4, -97, -69, -46, 33, 2, -4, -46, 46, 15], [-170, 7, -2, 85, 160, -323, -48, -42, 2, -1, -1, -9], [-28, 38, 22, 56, -38, -8, -58, 74, -16, -16, 38, -20], [187, -38, -30, 187, -78, -78, -14, 38, -17, -13, 30, 44], [0, 13, -19, -106, 16, -12, -62, 61, -19, -12, 12, 32], [12, 66, 29, -24, -71, 30, -54, 45, 9, 9, 20, 12], [-92, 44, 9, -92, -128, -128, -20, -44, 19, -10, -9, 11], [0, -35, 3, 302, -156, -38, 49, 24, 3, -38, 38, -38], [-128, 0, 24, 0, 24, 210, 2, -26, 28, -28, -52, -2], [2, 13, -48, -1, -14, -33, 46, 24, 48, -35, -35, -61], [-146, -36, -5, 0, -5, 271, 85, 64, 21, -21, -16, -49], [0, 28, 38, -34, -234, 18, -94, 48, 38, 18, -18, -10], [-44, 50, 1, 88, 167, -69, -39, 24, 15, 15, -14, 11], [224, 39, 45, -112, 240, -408, -32, 25, -45, 18, 18, 6], [-217, -29, -22, 217, -24, 24, -5, -29, -5, -27, -22, -27], [-503, 58, -3, 0, -3, 161, -49, -50, 1, -1, 2, -9], [-82, 13, 3, 41, 300, -602, 7, 28, -3, 8, 8, -10], [343, -56, -6, 0, -6, -134, 26, 2, 24, -24, -18, 30], [-6, -16, -12, -6, 88, 88, 38, 16, -24, 12, 12, -26], [0, -15, -27, -12, -186, -60, -6, 81, -27, -60, 60, 12], [21, 3, -4, 21, 104, 104, -39, -3, 16, -20, 4, 43], [-104, -39, -18, 0, -18, 398, -8, -12, 4, -4, 14, 47], [-45, 31, 7, 45, -106, 106, -33, 31, 26, 33, 7, -26], [51, 38, -1, 51, -186, -186, 10, -38, 29, -30, 1, -9], [-188, -7, -29, 376, -45, -18, 90, -35, -55, -55, 26, 83], [-175, -80, 4, -175, 218, 218, 30, 80, 20, -16, -4, -34], [0, 64, 22, -73, 472, 0, 5, -69, 22, 0, 0, 42], [112, 52, 46, 0, 46, 52, -48, -62, 14, -14, -60, -4], [401, -1, 16, -401, -332, 332, -9, -1, 4, 20, 16, 7], [-333, 58, 28, 0, 28, 542, -30, -33, 3, -3, -31, -28], [-204, 11, -22, -204, -102, -102, -17, -11, 26, -48, 22, 39], [-461, -6, 13, 922, 203, -64, -50, 6, 44, 44, -31, -56], [338, -59, -1, -169, -51, 39, -45, -43, 1, 61, 61, 58], [-442, 32, -34, 221, 168, -398, -23, 3, 34, -6, -6, -66], [98, -44, -36, -196, 184, -62, 62, -74, 12, 12, -48, 18], [0, -56, -2, -70, 208, 16, 14, 26, -2, 16, -16, -54], [49, -79, -42, -98, 314, -188, 92, -40, -52, -52, 10, 13], [-2, 41, 14, 2, 144, -144, -79, 41, 6, 20, 14, -65], [0, 96, 74, 151, 28, 52, -75, -73, 74, 52, -52, 22], [-420, 16, 40, 0, 40, 200, -34, -2, -32, 32, -8, 18], [90, -35, 17, -45, -14, 38, 79, 68, -17, 24, 24, 52], [9, 23, -15, -18, 33, 11, -65, 45, 20, 20, -35, -42], [-81, 8, 55, 162, 19, 54, -66, -25, 91, 91, -36, -58], [438, 33, -3, -219, 355, -685, -3, -1, 3, -31, -31, -36], [-146, 44, -30, -146, -6, -6, 30, -44, 40, -70, 30, 0], [18, 86, -23, -18, 282, -282, -4, 86, 4, -19, -23, -27], [357, 58, -24, -357, 224, -224, -30, 58, -28, -52, -24, -54], [-313, -29, -9, 626, 55, -11, 17, -29, 12, 12, -21, -12], [320, -19, -71, 0, -71, -82, 110, 39, 71, -71, 0, -91], [70, 44, 18, 70, 172, 172, -72, -44, 8, 10, -18, 54], [0, -32, 4, 209, -436, 2, 49, -19, 4, 2, -2, -36], [514, -28, -44, 0, -44, 150, 18, 22, -4, 4, 48, 10], [323, 5, -9, -323, 1, -1, 78, 5, -15, -24, -9, 69], [192, -91, -22, 192, -118, -118, 17, 91, -60, 38, 22, 5], [125, 86, 21, -250, -281, 96, -54, 88, -34, -34, 55, 32], [594, -51, -1, -297, -5, 49, 13, -79, 1, -41, -41, 50], [-391, 24, 48, 391, -60, 60, -24, 24, -79, -31, 48, 24], [-501, 106, 37, 0, 37, 131, 23, 13, 10, -10, -47, -129], [-274, -24, -11, 0, -11, 415, 21, -10, 31, -31, -20, 3], [-397, 8, 69, -397, -214, -214, -96, -8, 33, 36, -69, 27], [0, 2, 48, -120, -336, 48, -31, -19, 48, 48, -48, -46], [128, 141, 1, -64, 146, -274, -18, 107, -1, -16, -16, -140], [0, -65, 24, -68, -95, 26, 96, -57, 24, 26, -26, -89], [-142, -83, 49, 71, -24, 80, 27, 10, -49, 66, 66, 132], [-233, 34, -21, 0, -21, 232, -30, -56, 26, -26, -5, -4], [223, 14, 52, 223, -88, -88, -14, -14, -3, 55, -52, -38], [0, 71, 61, 335, -167, 19, 33, -123, 61, 19, -19, 10], [101, 10, -42, -202, 148, -78, -60, 85, -25, -25, -17, -50], [739, -108, -19, -739, -28, 28, 92, -108, 27, 8, -19, 73], [0, 16, -13, 488, 210, -73, 53, 4, -13, -73, 73, 29], [720, -31, -38, -360, -130, 169, -31, -47, 38, 15, 15, -7], [-158, -72, -10, 316, 82, -88, 40, 12, -52, -52, 42, -32], [389, 68, -9, 0, -9, -308, -78, -45, -33, 33, 42, 10], [0, -4, 38, 72, -282, -20, 117, -93, 38, -20, 20, -42], [47, 39, 56, -94, -160, 32, 4, 16, -20, -20, 76, 43], [-355, 30, 46, -355, 225, 225, 59, -30, 71, -25, -46, -105], [-411, 33, 57, 411, 593, -593, 62, 33, 5, 62, 57, 119], [-383, -53, -27, 766, -59, -7, 1, 49, -50, -50, 23, -52], [843, -12, -47, 0, -47, 76, 2, -24, 26, -26, 21, 10], [433, -69, -48, 433, -46, -46, 155, 69, 33, -81, 48, -107], [0, 19, -73, -170, -34, -40, 60, -39, -73, -40, 40, 92], [332, -32, -10, -166, 116, -164, 81, -39, 10, -88, -88, 22], [0, 99, 91, -91, -78, 50, -37, -112, 91, 50, -50, 8], [-824, 3, -54, 412, 219, -486, -10, -67, 54, -60, -60, -57], [223, -66, 8, -223, -291, 291, -51, -66, 89, 97, 8, -43], [-36, 39, 35, 18, 68, -6, 94, 73, -35, -60, -60, -4], [-16, -98, 48, -16, 251, 251, -19, 98, 23, 25, -48, -29], [68, -51, -28, 0, -28, 282, -28, 79, -107, 107, 135, 79], [681, -23, 16, -681, -628, 628, 57, -23, -64, -48, 16, 73], [-297, -92, -56, -297, -254, -254, 94, 92, -57, 1, 56, -38], [0, -20, -28, -604, 406, -72, -44, 136, -28, -72, 72, 8], [674, -9, -23, -337, -35, 99, 3, -81, 23, -75, -75, -14], [0, -107, -45, 441, -102, 28, 25, 54, -45, 28, -28, -62], [-470, 43, -31, 470, -228, 228, -59, 43, 44, 13, -31, -90], [-120, -89, 10, 240, 206, -188, 140, -60, -80, -80, 90, 51], [49, 68, 86, 49, -136, -136, 24, -68, 47, 39, -86, -110], [0, -145, -25, 407, 273, 15, 96, 34, -25, 15, -15, -120], [181, -3, 0, -362, 408, -226, 94, -72, -22, -22, 22, 91], [252, -69, -109, 252, -76, -76, 57, 69, -50, -59, 109, 52], [12, -47, 67, -6, 134, -144, -101, -138, -67, 10, 10, 114], [78, 47, -18, -156, -976, 456, -48, 89, -41, -41, 23, -1], [676, -96, 6, -338, 72, -234, 23, 29, -6, 102, 102, 102], [57, -29, 12, 57, 162, 162, 63, 29, 32, -20, -12, -75], [469, -66, 41, -469, 426, -426, 6, -66, -3, 38, 41, 47], [-462, -92, -18, 0, -18, -156, 10, 4, 6, -6, 12, 82], [56, -44, 32, -28, 403, -703, 13, -70, -32, -39, -39, 76], [-436, 61, -9, 436, 621, -621, -50, 61, 61, 52, -9, -59], [-239, -68, -33, 478, -37, 121, 41, -127, 86, 86, -119, -27], [1055, 13, 48, 0, 48, 244, -98, -78, -20, 20, -28, 85], [59, -62, -29, 59, -64, -64, -16, 62, -27, -2, 29, 45], [-78, 120, 104, 39, 121, -59, -143, 2, -104, 25, 25, -16], [-387, 70, 4, -387, 374, 374, -108, -70, -34, 38, -4, 104], [0, 38, 2, 64, 97, -15, 29, -52, 2, -15, 15, 36], [1400, -12, 70, -700, -192, 454, 60, 118, -70, 70, 70, 82], [-255, 36, -78, 255, -258, 258, 42, 36, 27, -51, -78, -36], [142, 28, 24, 0, 24, 274, -14, -78, 64, -64, -88, -14], [939, -18, -2, -939, -713, 713, 31, -18, 5, 3, -2, 29], [-421, -92, -26, 842, -280, 137, -77, 93, -16, -16, -10, -169], [732, 26, 74, -732, 30, -30, -64, 26, -34, 40, 74, 10], [646, -54, -66, -646, -370, 370, 92, -54, -22, -88, -66, 26], [-786, -1, -38, 1572, -172, 134, 10, -39, 29, 29, -67, 9], [-219, 108, -96, 0, -96, -252, -44, -64, 20, -20, 76, -64], [194, -74, -156, 194, -206, -206, 70, 74, -88, -68, 156, 86], [0, 80, -50, -91, 465, 7, -125, 38, -50, 7, -7, 130], [-235, -41, 81, -235, -49, -49, 144, 41, 67, 14, -81, -225], [670, 8, -8, -670, 866, -866, -44, 8, 8, 0, -8, -52], [0, -11, 68, 176, 230, 19, 54, -62, 68, 19, -19, -79], [-560, 90, -106, 280, 20, -192, 54, 84, 106, -60, -60, -196], [-15, -18, 37, 0, 37, -594, 84, 45, 39, -39, -76, -66], [0, 79, 45, 47, 229, 5, 153, -237, 45, 5, -5, 34], [-51, 27, 58, 102, 2, -12, -120, 102, 18, 18, 40, -93], [276, 229, 99, -138, 170, -208, -140, 155, -99, 66, 66, -130], [-389, 21, -63, -389, 232, 232, -61, -21, -58, -5, 63, 124], [-401, 69, -66, 401, 274, -274, -53, 69, 1, -65, -66, -119], [-1125, 63, -43, 0, -43, 101, -57, 1, -58, 58, 101, -6], [-283, 51, 107, 566, -445, 237, -57, -11, 68, 68, 39, -6], [0, -63, 19, 774, 234, 56, 134, -127, 19, 56, -56, -82], [87, -109, 59, 87, 433, 433, 30, 109, 37, 22, -59, -89], [-676, 51, -92, 338, 176, -493, 47, 55, 92, -43, -43, -143], [827, 34, -16, -827, -298, 298, 24, 34, -58, -74, -16, 8], [-245, 95, 15, 490, 11, 47, -53, -7, 60, 60, -45, 42], [116, 128, 61, 116, 46, 46, -258, -128, 12, 49, -61, 197], [-201, 34, -85, 402, -421, 182, 166, -95, -71, -71, -14, 200], [-356, -49, -107, 178, -532, 952, 54, -97, 107, -102, -102, -58], [0, -62, 28, -662, -199, -37, 127, -28, 28, -37, 37, -90], [361, -104, 25, 0, 25, 123, 83, 132, -49, 49, 24, 21], [-265, -88, 38, 0, 38, -610, 46, 91, -45, 45, 7, 42], [-242, -34, -50, -242, -116, -116, 122, 34, -38, -12, 50, -72], [0, 169, 109, -259, 521, 181, -173, -177, 109, 181, -181, 60], [-744, 116, -31, 1488, -55, 30, -78, 91, -13, -13, -18, 38], [-210, 59, -1, 105, -169, 275, 78, 198, 1, 61, 61, -60], [410, 46, -12, -410, -200, 200, 38, 46, 56, 44, -12, 26], [0, 71, 78, 831, 690, -1, -70, 0, 78, -1, 1, -7], [170, -76, -12, -85, -624, 1220, 31, -41, 12, 4, 4, 64], [-72, 61, -8, 144, -456, 96, 12, 124, -136, -136, 128, 73], [306, 159, 97, 306, -102, -102, -157, -159, -34, 131, -97, 60], [0, -17, -92, -613, 439, -54, -19, 90, -92, -54, 54, 75], [-515, 1, 97, 0, 97, -783, -103, -63, -40, 40, -57, 102], [462, 69, -59, -231, 14, -178, -121, -20, 59, 32, 32, -128], [645, -14, -61, -1290, 977, -466, 76, -68, -8, -8, -53, 62], [14, -83, -133, -7, -607, 1033, 153, -15, 133, -85, -85, -50], [644, -86, -1, 644, 526, 526, -44, 86, -95, 94, 1, 45], [-221, 106, -55, 0, -55, 651, 43, -11, 54, -54, 1, -149], [-196, 101, 30, 392, -578, 236, -2, 40, -38, -38, 68, 99], [422, 120, 38, 0, 38, -328, -60, -62, 2, -2, -40, -60], [0, 21, 45, -107, 477, -35, -3, 17, 45, -35, 35, -24], [186, 19, -55, 186, 291, 291, 20, -19, 107, -162, 55, 35], [0, -70, -74, 516, -98, -54, -36, 160, -74, -54, 54, 4], [574, 239, -3, -287, -78, 104, -147, 138, 3, 46, 46, -242], [-12, -58, -21, 12, -463, 463, -29, -58, 25, 4, -21, -50], [179, -50, -16, -358, 26, 26, -32, 1, 31, 31, -47, -82], [4, -142, -85, 4, 26, 26, 132, 142, -103, 18, 85, -47], [-265, -52, -6, 265, -544, 544, -164, -52, 95, 89, -6, -170], [0, 134, 93, 1, -762, 71, -181, -24, 93, 71, -71, 41], [-1096, -69, 65, 1096, -473, 473, -38, -69, 71, 136, 65, 27], [-36, -14, -68, -36, 4, 4, 22, 14, -54, -14, 68, 46], [674, -152, -106, -337, -237, 369, 243, -16, 106, -107, -107, 46], [0, 120, 54, 73, 1154, -42, -23, -55, 54, -42, 42, 66], [-411, 168, 67, 822, 837, -439, -65, 52, 13, 13, 54, 103], [290, 72, -9, -580, 673, -356, -34, 58, -24, -24, 15, 38], [31, -59, 4, 31, -730, -730, -15, 59, -64, 68, -4, 11], [85, 118, 87, -85, 808, -808, -28, 118, -5, 82, 87, 59], [0, -33, -64, 1372, 370, -15, 60, -12, -64, -15, 15, 31], [220, 69, 34, 0, 34, -624, 22, -82, 104, -104, -138, -91], [-422, -200, 82, 211, 312, -478, 113, -69, -82, 18, 18, 282], [-101, 131, -77, 202, -369, 195, -45, 73, -28, -28, -49, 86], [0, -84, 90, 272, 626, -4, -11, 99, 90, -4, 4, -174], [928, 6, 38, -464, -282, 686, -144, -184, -38, -46, -46, 32], [-180, 184, 68, 180, 206, -206, -12, 184, 14, 82, 68, 56], [-494, 83, -70, 988, -336, 122, 58, 23, -81, -81, 11, 141], [-1464, 38, -51, 0, -51, -866, 104, 136, -32, 32, 83, -142], [0, -42, -12, 0, 16, -262, -36, 128, 12, 206, 206, 30], [-591, -85, 5, -591, 567, 567, 32, 85, 67, -62, -5, -37], [58, 86, 40, -116, -688, 394, -124, 54, 70, 70, -30, -38], [14, 140, -13, 14, -72, -72, 48, -140, 48, -61, 13, -35], [360, -106, -55, -720, 331, -265, 37, 90, -127, -127, 72, -69], [276, 1, -19, 276, 288, 288, 3, -1, -110, 91, 19, 16], [557, 80, -16, -557, 226, -226, 48, 80, -59, -75, -16, 32], [0, -148, 40, -639, -938, 160, 81, -93, 40, 160, -160, -188]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1050_p_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1050_3_p_f();".
// 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_1050_3_p_f(:prec:=12)
    chi := MakeCharacter_1050_p();
    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_1050_3_p_f();".
// 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_1050_3_p_f( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1050_p();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<11,R![463630257216, -286780423104, 129337827696, -29825887728, 5383907860, -451837256, 41583508, -1027232, 227242, -2336, 562, 4, 1]>,<17,R![4222235916864, 985765370688, -213772663728, -67820278320, 19870112596, -1160246328, -69719924, 6657168, 311466, -17328, -530, 24, 1]>],Snew);
    return Vf;
end function;