
// Make newform 644.2.i.a in Magma, downloaded from the LMFDB on 06 June 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_644_i();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_644_i_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_644_2_i_a();".
// 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_644_2_i_a();".
// 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, -9, 107, 156, 1023, -955, 1508, -519, 505, -78, 130, -8, 13, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-28361882211929, 449903114342, -5329712146891, 111337268611675, -49126918937467, 51140720517783, 6219088309906, 11119892384042, -1875183425783, -363574089701, -84266710931, -121386533509, -40431457751, -21989300411], [1576314697776, -18702175120928, 19512337635239, -175314977631235, 176276113287638, -201260970822477, 81012284338921, -63021243130768, 14593092820597, -15447115489546, 1474928998504, -1506262589884, 43872435659, -114811762871], [43016111908326, -11568967917148, 136740116895154, -1072232602013875, 1234385488721098, -1414082801336202, 588027236710711, -447480622388748, 104287867182602, -112833098868381, 10641200473514, -11065898536954, 291802197544, -855671348766], [19148230877122, 12702572601344, -150149142326812, 1290846700359600, -1356299977040644, 1549348333586556, -626589744936808, 485951805009944, -112640751572156, 119683162613743, -11401875041492, 11678064398612, -335748057007, 892221909748], [-35811814125328, 14393134925754, -170129237700682, 1408962988049045, -1536529705282024, 1756500751161606, -714218331914178, 552179887513384, -128171156281046, 136874292117323, -13000833409772, 13368725563572, -378098736962, 1024633915058], [-4515342840944, -149153335026793, -421220070484291, -1436293822537210, 1304119565553603, -2296070279907287, 755086085014976, -781445829556283, 107505430936982, -203445981712376, 11104254992324, -20448218635429, -114811762871, -1576314697776], [44969246674753, -22713929220534, 268464525933567, -2113850028773680, 2423144977750839, -2777660323328331, 1167948618031513, -880716271292754, 205501645389291, -223070495398938, 21005466121887, -21915521774727, 556956033702, -1698943231713], [-648064057627, 7731675566411, 53438239712412, 76367922409155, -62500992404491, 153506382789329, -44669457113177, 54567706417381, -5160830566989, 14590826231332, -545673690198, 1485408021048, 29037401042, 114993859747], [-6155746211264, -338091008787543, -574713003457851, -1952581960955930, 1632560116755873, -3079842469620447, 974893314168176, -1053243501855713, 132466709980982, -274518463252936, 13708674414599, -27654049937709, -258086197471, -2129756329766], [7216930687304, 251033445526938, 672733002784181, 2301665002350510, -2174545484161723, 3724855488603817, -1266393407711816, 1255269598931228, -187219619715362, 328270114792416, -19479048392084, 32926082107139, 72592960761, 2551800926191], [1775864671607, 78871975053337, 165805738803212, 563210751897291, -473830742486373, 887700195497401, -280380010265489, 304374782525451, -37991281933553, 79150449495027, -3917686570126, 7974346459040, 76068353439, 612962220086], [-38006779141524, 451764839873017, 382556302355349, 4310595899562905, -4053432510550597, 6153928931182398, -2154618168418244, 2056630280143337, -325338554060758, 527525589355739, -33227701466231, 52719392217111, -48950026801, 4049907538174]];
    Rf_basisdens := [1, 1, 17051458105375, 17051458105375, 17051458105375, 17051458105375, 17051458105375, 17051458105375, 17051458105375, 1003026947375, 17051458105375, 17051458105375, 3410291621075, 17051458105375];
    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_644_i();"
function MakeCharacter_644_i()
    N := 644;
    order := 3;
    char_gens := [323, 185, 281];
    v := [3, 1, 3];
    // 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_644_i_Hecke();"
function MakeCharacter_644_i_Hecke(Kf)
    N := 644;
    order := 3;
    char_gens := [323, 185, 281];
    char_values := [[1, 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], [1, 0, 0, 0, 0, 0, 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]];
    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, 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, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0], [0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, -1, 0, 1, 0, -1, -1, 1, -1, 0], [1, 0, 1, 0, 1, 0, 1, 0, -1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -1, 0, 1, 1, -1, 0, 0, -1, 1], [-2, 0, 0, 1, 1, 0, 0, -2, 0, 1, 0, 0, -1, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [-1, -1, 0, -1, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 1, 0, 3, -1, 1, 1, 0, 0, -1], [-2, 0, 0, -1, 1, 0, 1, -2, 0, 1, -1, 0, -1, 2], [0, -1, 0, -1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [-1, 3, 0, 3, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0], [-4, 0, 1, -1, 0, 0, -2, -4, 0, 1, 2, 1, 0, 3], [0, 0, 0, 0, 0, 1, 0, -3, 0, 1, 1, -1, -1, 0], [0, -3, 0, 0, 0, 2, 0, 2, -2, 2, 1, -2, 0, -2], [1, 0, 2, -1, 4, 0, 1, 1, 0, 1, -1, 2, -4, 1], [0, 2, 0, 0, 0, 1, 0, 0, -1, 1, 0, 1, -2, -1], [0, -1, 2, -1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0], [0, -2, 0, 0, 0, -1, 0, 3, -1, -1, 0, -2, 0, -1], [-3, 0, -2, 3, -2, 0, 1, -3, 0, 0, -1, -2, 2, -2], [1, -2, 1, -2, 2, -2, 0, 0, -4, 0, 0, 0, 0, 0], [2, 0, -1, -2, 3, 0, 0, 2, 0, 2, 0, -1, -3, 0], [2, 2, -2, 2, -2, -1, 1, 0, 5, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, -1, 0, 2, -1, -1, -1, -3, -2, -1], [-3, 0, 2, -1, 5, 0, -1, -3, 0, -1, 1, 2, -5, 1], [-2, 0, 1, 1, 4, 0, 1, -2, 0, 4, -1, 1, -4, 0], [0, 2, 0, 0, 0, -1, 0, 4, -2, -1, -1, -4, -2, -2], [-5, 1, 0, 1, 3, -1, -1, 0, 0, 0, 0, 0, 0, 0], [3, 0, 1, 0, -3, 4, 1, 0, 2, 0, 0, 0, 0, 0], [5, 0, 0, -1, -2, 0, 0, 5, 0, -4, 0, 0, 2, -3], [0, -1, 0, 0, 0, 1, 0, -1, 2, 1, 0, 0, 0, 2], [7, 3, -1, 3, -2, 2, 1, 0, 1, 0, 0, 0, 0, 0], [-5, 0, 2, 0, -1, 0, -1, -5, 0, 2, 1, 2, 1, -1], [0, 2, 0, 0, 0, -5, 0, 3, -2, -5, -3, 1, 1, -2], [0, 1, 0, 0, 0, 0, 0, 8, 2, 0, -2, 2, -3, 2], [0, 0, 0, 4, -6, 0, -6, 0, 0, -2, 6, 0, 6, -8], [-1, -4, 1, -4, 3, 1, -2, 0, -2, 0, 0, 0, 0, 0], [-1, 0, -5, -2, -3, 0, 0, -1, 0, 3, 0, -5, 3, 0], [0, 5, 0, 0, 0, 2, 0, -12, 5, 2, 0, 3, -4, 5], [6, -1, 4, -1, 1, -3, -1, 0, -2, 0, 0, 0, 0, 0], [-4, 0, 0, 2, -5, 0, 0, -4, 0, -2, 0, 0, 5, -4], [0, 0, 0, 0, 0, 2, 0, 2, -5, 2, 0, 1, -3, -5], [-5, 7, -3, 7, -8, -1, 1, 0, 4, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -1, 0, 9, -2, -1, -4, 1, -6, -2], [-6, 0, -3, 0, 2, -2, 2, 0, 2, 0, 0, 0, 0, 0], [3, 0, -3, 0, -1, 4, -1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, -1, 0, 12, -2, -1, -1, 1, -4, -2], [-2, 0, 7, -4, 2, 0, 3, -2, 0, -4, -3, 7, -2, 5], [-2, 0, 6, -4, 2, 0, -2, -2, 0, -5, 2, 6, -2, 5], [3, -2, 6, -2, 1, -3, 0, 0, -4, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 4, 0, -2, -2, 4, 1, -3, 7, -2], [2, 4, -6, 4, -5, -1, -1, 0, 6, 0, 0, 0, 0, 0], [0, 0, -5, -5, -1, 0, 2, 0, 0, 0, -2, -5, 1, 4], [0, -6, 0, 0, 0, 1, 0, -5, -5, 1, -1, -1, 6, -5], [0, -6, 0, 0, 0, 2, 0, -1, -2, 2, -2, -5, 6, -2], [-2, 0, -4, 2, -8, 0, -2, -2, 0, -1, 2, -4, 8, -6], [0, 0, 0, 0, 0, -2, 0, 6, 0, -2, 2, -7, 3, 0], [1, -9, 4, -9, 3, 2, 4, 0, -3, 0, 0, 0, 0, 0], [0, 4, 0, 0, 0, 1, 0, 9, -4, 1, 1, 6, -1, -4], [10, 2, 4, 2, 4, -2, 8, 0, -5, 0, 0, 0, 0, 0], [13, 8, 0, 8, 0, 1, 1, 0, 3, 0, 0, 0, 0, 0], [0, -4, 0, 0, 0, -2, 0, -3, 8, -2, -2, -1, 1, 8], [6, 0, 0, 6, -1, 0, 6, 6, 0, -3, -6, 0, 1, 3], [-7, 0, -2, 5, 1, 0, 0, -7, 0, -1, 0, -2, -1, 0], [3, 0, 4, -1, 8, 0, -4, 3, 0, 1, 4, 4, -8, -2], [1, 2, -2, 2, -1, -1, 2, 0, 0, 0, 0, 0, 0, 0], [0, 4, 0, 0, 0, 2, 0, -6, 3, 2, -6, 5, -2, 3], [5, -5, 2, -5, 6, -2, 7, 0, -7, 0, 0, 0, 0, 0], [0, 8, 0, 0, 0, -5, 0, 4, -3, -5, 1, 0, -3, -3], [-1, 0, -5, -8, 0, 0, 3, -1, 0, 1, -3, -5, 0, 6], [0, 4, 0, 0, 0, 1, 0, 5, 8, 1, 2, 2, -1, 8], [-9, 0, -4, 2, 0, 0, -5, -9, 0, 2, 5, -4, 0, 4], [-2, 3, -6, 3, -3, -4, -1, 0, 2, 0, 0, 0, 0, 0], [-2, 0, 4, 2, -1, 0, -2, -2, 0, 0, 2, 4, 1, 3], [0, -11, 0, 0, 0, 1, 0, 3, -7, 1, 5, -3, 8, -7], [-2, 0, 1, 6, 1, 0, 2, -2, 0, 3, -2, 1, -1, -4], [-2, 0, -1, 1, -5, 0, -5, -2, 0, -3, 5, -1, 5, -3], [0, -2, 0, 0, 0, -4, 0, -5, 1, -4, -4, 0, -3, 1], [-11, -11, 3, -11, -1, -1, 3, 0, -2, 0, 0, 0, 0, 0], [-3, 2, 0, 2, 4, 5, 5, 0, -5, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 5, 0, 5, 11, 5, -3, 1, 0, 11], [11, -3, -1, -3, 0, 4, 0, 0, -3, 0, 0, 0, 0, 0], [-12, 0, -2, 0, -4, 0, 0, -12, 0, 5, 0, -2, 4, -2], [-4, 0, 1, 8, -5, 0, -9, -4, 0, 4, 9, 1, 5, -1], [6, -1, 3, -1, 1, 0, -2, 0, 8, 0, 0, 0, 0, 0], [10, 0, -1, 6, -4, 0, 4, 10, 0, -1, -4, -1, 4, 0], [-1, 2, 2, 2, 8, -1, -4, 0, 4, 0, 0, 0, 0, 0], [-3, 1, -2, 1, -7, 2, -3, 0, 0, 0, 0, 0, 0, 0], [-4, 0, 6, 0, 3, 0, -4, -4, 0, -1, 4, 6, -3, -4], [0, -1, 0, 0, 0, -1, 0, 0, 8, -1, -3, -2, -1, 8], [0, 5, 0, 0, 0, -2, 0, 3, 5, -2, -5, 1, 6, 5], [1, 1, 1, 1, -7, 7, 0, 0, 8, 0, 0, 0, 0, 0], [4, 0, -4, -8, -1, 0, -7, 4, 0, 0, 7, -4, 1, -7], [-2, 1, 2, 1, -4, 2, -6, 0, 4, 0, 0, 0, 0, 0], [2, 0, 2, 1, -3, 0, 0, 2, 0, 0, 0, 2, 3, -8], [0, -2, 0, 0, 0, 5, 0, -10, 1, 5, -4, -1, 6, 1], [-19, 0, 4, -2, -1, 0, 0, -19, 0, 3, 0, 4, 1, 1], [5, 0, 9, -14, 13, 0, 1, 5, 0, -3, -1, 9, -13, 10], [7, 7, 2, 7, 1, -1, 2, 0, 4, 0, 0, 0, 0, 0], [0, 7, 0, 0, 0, -5, 0, -7, 6, -5, -7, 2, 0, 6], [0, -1, 0, 0, 0, -3, 0, -5, -8, -3, 6, -11, 4, -8], [5, 0, 1, -3, 4, 0, -8, 5, 0, -1, 8, 1, -4, -4], [0, 8, 0, 0, 0, 4, 0, 6, 8, 4, 1, 6, -3, 8], [0, -3, 0, 0, 0, -1, 0, -11, -7, -1, 3, -5, -2, -7], [-22, -8, 4, -8, -3, 4, -3, 0, -1, 0, 0, 0, 0, 0], [14, 0, -7, -1, 6, 0, 1, 14, 0, 4, -1, -7, -6, -3], [0, -5, 0, 0, 0, -3, 0, 1, 0, -3, 7, -8, 5, 0], [9, 7, 2, 7, -1, -3, 3, 0, 0, 0, 0, 0, 0, 0], [-11, 0, -5, -5, 0, 0, -11, -11, 0, -1, 11, -5, 0, -9], [0, -2, 0, 0, 0, 6, 0, 7, -5, 6, 6, -8, -1, -5], [-8, -5, 8, -5, 6, -8, -1, 0, -6, 0, 0, 0, 0, 0], [0, 3, 0, 0, 0, -1, 0, -2, -5, -1, 5, -5, 8, -5], [2, 7, -6, 7, 4, -5, -3, 0, 9, 0, 0, 0, 0, 0], [0, -4, 0, 0, 0, -1, 0, -6, -3, -1, -1, 1, -3, -3], [22, -4, 7, -4, 13, 2, 12, 0, -2, 0, 0, 0, 0, 0], [0, 11, 0, 0, 0, -1, 0, 4, 5, -1, 3, 4, -5, 5], [9, 0, -1, 6, -8, 0, -7, 9, 0, -1, 7, -1, 8, -15], [17, 5, -3, 5, 1, 1, -6, 0, -2, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, -2, 0, -9, 2, -2, 7, 4, -6, 2], [6, 8, -1, 8, -6, 2, -3, 0, 1, 0, 0, 0, 0, 0], [-10, 0, 0, 7, 4, 0, -4, -10, 0, 4, 4, 0, -4, 4], [0, 0, 0, 0, 0, -7, 0, -5, -4, -7, 0, 2, 2, -4], [-11, 0, 5, -8, 1, 0, -6, -11, 0, 0, 6, 5, -1, 5], [-12, -2, 0, -2, -9, -3, -8, 0, 0, 0, 0, 0, 0, 0], [14, 0, 0, 7, -4, 0, 9, 14, 0, -3, -9, 0, 4, 6], [12, 0, 3, 2, 7, 0, 10, 12, 0, -5, -10, 3, -7, -1], [10, -5, -2, -5, 4, -5, -7, 0, 0, 0, 0, 0, 0, 0], [-8, 0, -8, 15, -12, 0, 3, -8, 0, 1, -3, -8, 12, -3], [0, 6, 0, 0, 0, -4, 0, 18, 1, -4, 1, -6, -2, 1], [10, 2, -8, 2, -4, -3, -11, 0, 4, 0, 0, 0, 0, 0], [-3, 0, 11, -9, -5, 0, 4, -3, 0, -1, -4, 11, 5, 4], [-4, -10, 1, -10, 3, 6, -4, 0, -3, 0, 0, 0, 0, 0], [19, 0, 1, 3, 8, 0, 8, 19, 0, 4, -8, 1, -8, 5], [0, -6, 6, -6, 0, 3, 4, 0, -8, 0, 0, 0, 0, 0], [0, -8, 0, 0, 0, 4, 0, -5, 2, 4, 0, 6, 6, 2], [0, 0, 0, 0, 0, -3, 0, 8, 6, -3, 6, -1, 3, 6], [-14, 5, 1, 5, -3, 2, -6, 0, 1, 0, 0, 0, 0, 0], [0, -2, 0, 0, 0, -4, 0, -3, 2, -4, -1, -4, 14, 2], [-8, -5, -2, -5, -4, -4, 4, 0, -2, 0, 0, 0, 0, 0], [3, 0, 6, 11, 0, 0, 8, 3, 0, 2, -8, 6, 0, 7], [0, -8, 0, 0, 0, -1, 0, -7, -14, -1, 12, -8, 16, -14], [18, -4, -7, -4, 3, -3, 2, 0, 0, 0, 0, 0, 0, 0], [0, -3, 0, 0, 0, -4, 0, -8, 5, -4, -9, 5, -5, 5], [-10, -4, 5, -4, 11, -6, 5, 0, -15, 0, 0, 0, 0, 0], [0, -8, -3, -8, -12, -7, -1, 0, -4, 0, 0, 0, 0, 0], [0, -10, 0, 0, 0, -1, 0, -8, -14, -1, 8, -5, 2, -14], [-13, 0, -6, 1, -1, 0, 6, -13, 0, 1, -6, -6, 1, 5], [5, 0, -1, 0, -9, 0, 5, 5, 0, 6, -5, -1, 9, 1], [14, 0, -10, 3, 1, 0, -3, 14, 0, 9, 3, -10, -1, -4], [-26, 0, 3, 0, 0, 0, -8, 0, 0, 0, 0, 0, 0, 0], [-4, 2, -10, 2, 3, 5, -1, 0, -1, 0, 0, 0, 0, 0], [3, 0, -6, 6, -5, 0, 2, 3, 0, -7, -2, -6, 5, -2], [0, 8, 0, 0, 0, -3, 0, 18, -2, -3, -9, -7, -2, -2], [-2, -2, -3, -2, -5, 2, -5, 0, -6, 0, 0, 0, 0, 0], [26, 0, -1, -2, 9, 0, 8, 26, 0, 0, -8, -1, -9, 6], [10, 0, -1, 9, -4, 0, 5, 10, 0, -10, -5, -1, 4, -10], [20, -10, 2, -10, -2, 9, 10, 0, 4, 0, 0, 0, 0, 0], [0, 18, 0, 0, 0, -4, 0, -14, 12, -4, -10, 7, -9, 12], [7, 0, -8, 10, 0, 0, -7, 7, 0, -4, 7, -8, 0, 0], [-1, 1, 3, 1, 3, -6, 6, 0, -8, 0, 0, 0, 0, 0], [5, -1, -3, -1, -6, -7, -1, 0, 0, 0, 0, 0, 0, 0], [26, 0, 0, -1, -11, 0, 0, 26, 0, -5, 0, 0, 11, -3], [0, -8, 0, 0, 0, 5, 0, -3, -2, 5, -9, -3, 4, -2], [0, -13, 0, 0, 0, 0, 0, -12, -5, 0, 2, -6, 18, -5], [0, -3, 0, 0, 0, -5, 0, 28, -3, -5, -11, 1, -12, -3], [0, -8, 0, 0, 0, 6, 0, -8, 0, 6, 6, -6, 11, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_644_i_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_644_2_i_a();".
// 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_644_2_i_a(:prec:=14)
    chi := MakeCharacter_644_i();
    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_644_2_i_a();".
// 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_644_2_i_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_644_i();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<3,R![4225, 4160, 10141, 288, 9706, 1276, 4029, 487, 1130, 177, 189, 26, 21, 3, 1]>],Snew);
    return Vf;
end function;