
// Make newform 961.2.g.m in Magma, downloaded from the LMFDB on 04 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_961_g();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_961_g_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_961_2_g_m();".
// 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_961_2_g_m();".
// 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, 0, 44, 0, 410, 0, 956, 0, 979, 0, 511, 0, 140, 0, 19, 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], [255, -360, 2839, 2409, 3382, 6431, 691, 5467, -641, 2196, -358, 458, -65, 48, -4, 2], [-255, -360, -2839, 2409, -3382, 6431, -691, 5467, 641, 2196, 358, 458, 65, 48, 4, 2], [-463, 439, -7953, 10699, -17926, 21308, -16144, 16835, -7260, 6619, -1732, 1374, -209, 144, -10, 6], [93, 1125, 0, 7255, 0, 14844, 0, 14865, 0, 7940, 0, 2250, 0, 315, 0, 17], [463, 439, 7953, 10699, 17926, 21308, 16144, 16835, 7260, 6619, 1732, 1374, 209, 144, 10, 6], [354, -532, 6074, -10699, 18145, -21308, 21730, -16835, 12516, -6619, 3653, -1374, 517, -144, 28, -6], [-143, -1347, -412, -6329, 6617, -6857, 14550, -1382, 10969, 1282, 3713, 716, 575, 130, 33, 8], [354, 532, 6074, 10699, 18145, 21308, 21730, 16835, 12516, 6619, 3653, 1374, 517, 144, 28, 6], [538, -2510, 5719, -22747, 19734, -47899, 26249, -44466, 16025, -21362, 4827, -5485, 695, -709, 38, -36], [61, -225, 303, -7000, 1337, -26132, 2430, -35213, 1770, -21738, 587, -6619, 89, -962, 5, -53], [36, 1788, -926, 27117, -7987, 62350, -13483, 59919, -9222, 29263, -2966, 7575, -445, 983, -25, 50], [126, 1489, 3765, 15383, 11369, 41009, 14174, 46581, 8581, 26161, 2608, 7535, 380, 1058, 21, 57], [597, 658, 7093, 14464, 26132, 32677, 35213, 31009, 21738, 15200, 6619, 3982, 962, 524, 53, 27], [470, 2510, 8467, 22747, 32530, 47899, 44177, 44466, 27451, 21362, 8411, 5485, 1229, 709, 68, 36], [359, 3724, 2730, 48574, 11336, 121504, 17671, 128230, 12098, 67940, 3942, 18763, 599, 2558, 34, 135]];
    Rf_basisdens := [1, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186];
    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_961_g();"
function MakeCharacter_961_g()
    N := 961;
    order := 15;
    char_gens := [3];
    v := [13];
    // 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_961_g_Hecke();"
function MakeCharacter_961_g_Hecke( : Kf := false)
    N := 961;
    order := 15;
    char_gens := [3];
    char_values := [[0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 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 := 2;
    raw_aps := [[0, 0, 1, -1, 0, 0, 0, 0, 0, -1, -1, 0, 1, 1, -1, 0], [-1, 1, 0, 1, 1, 0, 2, 0, -1, 0, 1, 0, -2, 0, 0, 0], [1, 0, 0, -1, 1, 0, -1, 1, 1, 1, 0, -1, 0, -2, 1, 0], [0, 0, -2, 0, 0, 1, 0, 0, 1, 0, 1, -2, 0, 0, 0, 0], [2, -2, 0, -1, -2, 0, 0, 0, 3, -1, 0, 0, 3, 1, -1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 1, -1, -1, -2, 0, 1, -2, 1], [-2, -1, 2, 1, 0, -2, 0, -1, 0, 0, -1, 0, 0, 2, 1, 0], [-1, 2, 2, 0, 2, 0, 2, -1, -1, 1, 0, 2, 0, 0, 1, 0], [0, -1, -1, 1, -1, 1, 1, 0, 0, 0, 0, 2, -1, 0, -1, 0], [-2, -1, 1, 1, -2, -2, 0, 0, 1, -1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, -6, 6, -1, -1, 5, 2, -4, 1, -1, -1, 2, -5, 1], [0, 2, -1, -1, 1, 0, -1, 2, 0, -1, 1, -1, 1, 0, 1, -1], [0, -4, 0, 0, -5, -2, -6, -2, -1, 4, -3, 0, 4, 1, 3, -2], [-2, 4, 1, 1, 1, -1, 2, -2, -2, 0, 0, 3, 1, 1, 3, -4], [-1, -1, 5, -1, -3, 2, 1, -1, -1, 0, -1, 0, 4, 1, -2, 1], [-4, -2, 1, 0, -2, -1, -2, -4, 1, 2, -4, 4, 4, 1, 1, -1], [6, -1, 0, -3, 1, 2, 1, 3, 5, -5, 2, -4, -1, 0, -4, 2], [1, -1, 2, 1, 1, 3, 3, 2, -2, -1, 0, -2, -1, 4, -6, 3], [-2, 1, 2, -1, 3, 3, 4, 0, -3, -1, 0, 0, -2, 1, -2, 2], [3, -3, -1, -5, -6, -2, -10, 0, 6, 2, -5, 0, 8, 0, 2, -5], [1, 2, 0, 2, 7, 4, 3, 4, -1, 2, 4, -4, -5, -4, -2, 4], [-4, 10, 1, -2, 3, 0, 4, 2, -9, -3, 1, 3, -11, 1, 2, -1], [-3, 0, 3, -3, 5, 4, 6, 1, -4, -5, -3, 0, 0, 3, -9, 5], [0, 5, -1, -2, 6, -2, 2, 1, -2, 3, 3, 3, 0, -3, -1, -3], [-4, 3, -7, -1, 1, -5, -5, -2, 2, 5, 1, 4, -2, -6, 9, -6], [1, 1, 0, 1, -6, 0, -1, -6, -2, 1, -3, 1, -3, 0, 1, -1], [-1, 3, -1, 1, -7, -1, -2, -5, -1, 2, -5, 1, 2, 1, 7, -6], [2, -4, -5, -2, -6, 0, -3, 1, 6, 0, 0, -6, 4, -4, 1, -1], [-1, -6, -8, 0, -14, -1, -11, 1, 12, 2, -1, -8, 4, -2, 2, -2], [-9, 3, 3, 3, 7, 0, 9, -5, -14, -3, -2, 9, -6, 4, 0, 3], [-5, -3, -1, 6, -4, -1, -2, -4, -1, 1, -4, 2, -1, 2, 1, -1], [1, 4, -3, -7, 10, -2, 4, 7, 6, -8, 4, -7, -8, 3, -6, 3], [-4, 2, 2, -6, 6, -1, -5, 2, 8, 0, 0, -9, 0, -7, 0, -1], [2, -4, 4, 1, -2, 6, -1, -5, 3, -1, -6, -3, 8, 3, -5, 4], [-4, -1, -5, 5, -3, -6, -1, -7, -5, 6, -1, 2, -1, 1, 9, -6], [-11, 4, 1, 4, 7, -1, -1, -3, -5, -1, -2, 1, -4, 1, 2, 0], [-3, 6, -1, -2, 5, 3, -2, 5, 0, -7, 2, -3, -5, 5, -8, 5], [0, -3, -13, 0, -6, 5, -4, 2, -1, -3, -1, -5, -2, 2, -5, 5], [-10, 3, 1, -4, 6, -6, -3, 4, -6, -2, 1, 5, -3, 3, 4, -2], [-6, 2, -4, 0, 0, -2, -7, 0, 2, -4, 2, -2, -2, 0, 4, -4], [-10, -4, 4, 3, 2, 0, 5, -3, -5, -3, -4, 1, 2, 10, -7, 4], [2, -6, -6, 0, -5, -2, -4, -2, 3, 0, 2, 2, 7, 2, 0, -4], [9, 8, -2, -7, 5, 2, -4, 5, 3, -2, 6, -5, 0, -2, -1, 1], [-1, -2, 6, 4, -5, 0, -3, -2, -5, 6, -2, -8, -4, -4, 6, 0], [-4, 6, 2, -2, 6, -1, 1, 2, -1, -5, 5, 3, -1, -3, -4, 2], [-2, 13, 4, 2, 10, -6, 0, 4, -3, 3, 6, 3, 1, -4, 8, -6], [-3, 7, 3, 0, 13, -1, 8, 0, -11, 1, 1, 5, -1, -2, 1, 0], [2, 11, -2, -11, 12, 0, 0, 14, 2, -7, 7, -4, -10, -4, -4, 0], [-9, 14, 2, 0, 13, -1, 11, -2, -3, -2, 10, 3, -11, -6, 4, -1], [-3, -5, 0, 1, 1, 3, -4, 5, 0, 0, 0, -10, -8, -2, -5, 8], [-8, 5, -2, 7, -4, -2, -2, 4, -8, -3, 7, -5, -8, -1, 8, -1], [5, 2, -1, 2, -3, 4, 8, -3, -3, 3, 2, 10, -7, -1, 1, -1], [-6, 0, 2, 2, 14, 4, 8, -3, -11, -1, -1, 17, 0, 2, -4, -3], [5, -9, -6, -5, -9, 0, -20, 7, 23, -7, -5, -11, 3, 0, -5, 0], [-7, -2, -11, 8, -12, 1, -1, -4, 2, 0, 0, -7, 1, 2, 9, -8], [7, -3, 1, -2, 9, 0, -4, 8, 4, 0, 4, -5, 0, -2, -9, 7], [-1, 4, -3, 6, -3, 7, 2, -1, -2, -4, 1, -1, -4, 3, -8, 3], [10, -2, -6, -4, -10, -5, -5, 2, 15, 5, 0, -4, 0, -5, 3, 0], [17, -3, -4, -5, -7, -2, 2, 3, 5, 7, 1, 0, -1, -7, 2, 0], [7, -9, 3, 1, -11, -4, -8, -5, 5, 2, -1, 9, 17, 1, 1, -2], [-7, -2, 2, 2, 4, 1, -2, 2, 4, 4, 2, -6, 8, -1, 2, 0], [9, -5, 12, -13, 6, 5, -1, 12, 7, -12, -1, -1, 10, 0, -5, 7], [5, -4, 6, 2, -2, 1, 2, -7, -8, 6, -4, 9, 2, 0, 3, -4], [-5, -6, 5, 8, -24, 5, 12, -17, 1, -5, -9, -1, 12, 11, -5, 0], [-2, -9, 4, -4, -1, -3, -12, -1, 2, 4, -2, -2, 12, -5, 2, -2], [-20, 8, -4, -3, 4, 0, 7, 8, -1, -12, 4, -17, -17, 9, 0, 9], [14, -6, -15, -2, -5, -6, -12, 3, 10, 1, 9, -5, 0, -9, 5, -1], [-3, -4, -6, -1, -4, -6, -6, 1, 10, -2, 6, -2, -8, 3, 5, 0], [-10, -2, 1, -1, 13, 7, 16, 3, -5, -15, 2, -7, -2, 13, -15, 13], [8, 8, 10, 0, -2, -3, -1, -1, 3, 5, -1, 13, 5, -3, 8, -3], [6, 10, -3, 1, 5, 3, 5, -1, 5, -1, 9, -2, -2, -10, -4, 2], [9, -3, 8, -7, -1, -11, -5, -4, 3, 7, 1, 11, 19, -1, 5, -12], [0, 7, -5, -7, 10, 3, 8, 12, 12, -19, 8, -10, -10, 0, -15, 8], [6, -4, 2, -10, 4, -7, -3, 4, 12, 3, -4, -3, 7, -6, -1, 1], [19, -13, 8, 5, -4, 0, 12, -1, 3, 3, 2, 9, 11, -2, 3, 3], [24, -11, -15, -9, -16, 4, -15, 3, 25, 2, 3, -12, 8, -4, -1, -8], [10, -9, -1, -6, -11, -2, -3, 5, 13, -3, 2, 6, 6, 0, -4, 1], [15, -13, -14, 6, -23, 24, 1, -6, 3, 0, -6, -7, 6, 0, -9, 0], [-3, 2, 7, -3, -9, 6, 7, -3, -8, -5, -6, 0, 6, 7, -9, 6], [-3, 5, 5, -1, 6, 8, -1, 0, -3, 0, 0, -7, -13, -9, 0, 8], [1, -5, -7, 13, -16, 9, 5, -13, -11, 15, -14, 1, 5, 1, 6, -3], [3, 7, -8, 6, 8, 4, 9, 5, -9, -5, 11, -4, -14, 0, -4, 1], [7, -11, 3, -9, -4, 0, -12, 13, 22, -8, 4, -21, 4, 0, 1, 4], [-18, 2, 10, 0, 7, -6, 9, -6, -5, 0, -10, -3, -1, 3, 3, 4], [6, -2, 4, 4, -18, 3, 3, -8, -1, 5, 1, 2, 16, 3, 1, 0], [18, -3, 1, -9, -2, 0, -2, 1, 5, 0, 0, 9, 6, -6, -4, 4], [-3, -4, 9, -6, 0, -4, 14, -1, -3, -7, 2, -3, -4, 5, 2, 5], [-22, 3, 8, 10, 5, -1, 12, -11, -27, 5, -10, 14, 2, 10, 10, -5], [2, -14, -4, 2, -13, -4, -2, 1, 2, 0, 4, 8, 2, 0, 3, 0], [8, 4, 11, 16, -9, 4, 16, -5, -8, 12, 6, 0, 7, -12, 12, 0], [-6, 17, 15, -1, 22, 4, 12, -1, -20, -5, -1, 13, -9, -4, -4, 3], [2, -8, -9, -9, -2, 17, -10, 8, 16, -13, -2, -19, -8, 5, -14, 12], [-10, 9, -2, -2, 7, -4, -10, -2, 3, 2, -2, 6, -8, -10, 12, -2], [3, 17, 1, -11, 15, 6, 13, 18, -7, -14, 7, -20, -34, -2, -6, 8], [-6, 11, 8, -4, 9, -4, 7, 9, -8, -13, 4, 5, -11, 5, -1, 1], [17, -10, 0, 1, -11, 21, 0, -1, 6, 1, -4, -10, 11, 3, -20, 10], [10, -12, -9, 0, -7, -7, -17, 4, 27, 3, 7, -3, -2, -6, 7, -4], [-13, 17, 12, 7, -12, -4, 6, -6, -5, 1, -2, 8, -3, 2, 12, -1], [0, -18, 5, 7, 2, -1, -6, 4, 6, 6, 4, -6, 5, 1, 2, 5], [29, -15, 14, -7, -15, 4, -6, 2, 23, -3, -8, -8, 29, -3, -3, -10], [20, -9, -7, 1, -22, 6, -2, -13, 16, 6, -6, -3, 22, 0, -1, -6], [13, 17, 2, -1, -1, 2, 7, 3, 0, 1, 7, -2, -11, -12, 9, -5], [20, -18, -13, -1, -22, 13, 16, -8, -5, -13, -1, 14, 0, 8, -13, 7], [-9, 3, 12, 5, 1, -17, -16, -5, -5, 9, 1, 9, 8, -6, 26, -13], [-11, -2, 2, 0, 18, 2, 8, 5, -7, 1, -4, -10, -8, -2, 3, 2], [-16, 13, 6, -4, 22, -15, 17, 2, -24, -11, 0, 13, -20, 11, 0, 0], [11, -16, -18, 4, -32, 9, -15, -6, -2, 3, -15, -14, 12, 15, -7, -3], [5, 0, 10, 10, -2, 0, 8, -12, -20, 13, -6, 28, 12, -3, 5, -8], [-12, 7, 5, 0, 19, -4, 4, 8, -3, -2, 0, -4, -11, -6, 4, -4], [-19, 2, 11, -14, 20, 5, 4, 14, -7, -29, -5, -6, -1, 19, -34, 17], [7, 17, -11, -10, 6, -3, -4, 6, 12, -8, 9, -12, -1, -4, 6, -6], [0, -12, 0, 8, -22, 8, 4, -16, 0, -10, -8, 6, 24, 13, -8, 2], [-22, 14, 2, 5, 18, 2, 18, -5, -28, 7, 2, 21, -18, 0, 0, 2], [0, 12, 4, -3, 22, -4, 0, 2, -14, 5, -4, 18, -2, -3, 5, -6], [0, 5, 0, 4, -6, 0, -3, -6, -9, 1, -3, 14, 14, 3, 17, -14], [-4, -1, 5, -3, -4, 1, -7, 1, -3, 0, -7, 7, -2, 7, -5, 7], [-1, -2, 10, -8, 26, 5, 9, 6, -5, -1, 1, 9, 7, -1, -15, 1], [-17, 14, 8, 5, 12, -10, 26, -2, -26, -13, 1, 11, -17, 13, 1, 0], [-21, 11, -16, -1, 6, 3, -9, 2, -2, -5, -1, -14, -16, 6, -7, 6], [0, 1, -3, -7, 11, 0, 1, 14, 9, -3, 7, -4, -12, -4, -2, -2], [-7, -3, 11, 4, -4, 7, 15, -12, -7, -1, -15, 11, 11, 13, -9, -6], [-15, -6, -18, 11, -20, -2, 4, -13, -2, -11, -2, 0, -3, 19, -6, 0], [7, -10, 10, 9, -6, -10, -10, -5, -8, 6, -6, 5, 6, 0, 7, -6], [7, -6, 4, -8, 3, -7, -9, 2, -11, 1, -9, 4, 9, -3, -5, -4], [-24, 7, -1, 0, 11, -1, 7, -5, -8, -7, 9, -5, -12, 3, -10, -1], [7, -7, 13, 2, -10, 7, -9, 1, 16, 6, -6, -3, 10, 6, -2, -6], [24, -6, 4, -6, -13, 3, -15, 11, 22, 3, -3, -3, 19, -12, -9, -5], [5, 18, -2, -10, 13, -2, 12, 4, -2, -11, 4, 1, -20, 2, -15, 5], [8, 3, 5, 1, -1, 14, 9, -1, 3, -11, -2, -10, 2, -2, -11, -1], [14, -1, 26, -5, 13, 5, 2, 10, -8, 5, -1, 8, 8, 2, -12, 6], [8, 9, -8, -4, 5, 5, -6, 3, -10, 1, 4, -2, -5, 0, 0, 4], [-3, -17, -25, 4, -6, 7, 0, -6, 22, 10, -1, -12, -5, -2, -2, 2], [8, -16, 12, -13, 2, -7, -6, 13, 21, -19, 0, -10, -1, 13, -12, 6], [-6, 3, -14, -2, -14, -2, 8, -1, 9, -9, -1, -8, -3, 2, -8, 6], [9, -16, -7, -7, -6, 3, -13, 2, 19, -2, -3, -12, -3, -3, -10, 5], [-17, 11, -1, 5, 14, -10, -10, 0, 7, 5, 5, -4, -8, -5, 10, 0], [-5, 3, -4, 0, 5, -9, 0, -7, -3, 10, -11, 18, 15, 8, 2, -9], [-4, 6, -14, 11, 13, -11, 6, -11, 0, 17, 12, 11, -13, -6, 17, -5], [7, -10, 5, 13, -6, -7, 1, -7, -1, 11, 6, 11, 20, -2, 7, -4], [24, -4, -36, -2, -33, -1, -18, 1, 20, 2, 6, -15, -7, -9, 8, -7], [23, 13, 6, 2, -7, 1, 10, 7, -21, 0, 0, 23, 1, -13, 7, -6], [-26, -1, 18, 17, 4, -4, 6, -9, -14, 6, -9, 2, 4, 4, 15, 2], [13, -14, -6, 2, -6, 0, -15, 0, 18, 6, 0, -13, 11, -4, -5, 1], [-9, 8, -6, -5, -4, -4, -20, 2, 1, 5, -5, -23, -10, 0, 3, 0], [-3, -12, -17, -14, 11, 1, -16, 10, 3, -9, 6, 4, -9, 9, -12, 0], [13, 1, 0, -23, -2, -16, -21, -5, 21, 0, 0, 11, 18, -3, 1, -17], [-9, -5, -8, 8, -8, -13, -18, -1, -17, 24, -3, 6, -16, -10, 24, -2], [19, 3, 0, -9, 7, -6, 2, 3, -1, 7, 5, 5, 7, -10, 1, 4], [10, -25, -8, -1, -8, 3, -3, 4, 5, 1, 1, -9, 19, -7, 3, 2], [-2, -24, -3, 2, -27, -3, -31, -13, 29, 7, -13, -4, 21, 6, -4, -9], [-7, 12, -1, 9, 10, -6, -4, -9, -11, 14, 6, 3, 3, -15, 20, -10], [-26, 19, 33, 4, 38, 4, 37, 3, -32, 0, 0, 4, -4, 11, -14, 18], [13, -22, -1, 0, -16, 0, -5, -9, 2, 9, -6, -5, 17, 6, 3, 0], [2, -12, 6, 8, -23, 1, -8, -13, -6, 17, -16, -4, 8, -1, 6, -1], [-1, -9, -20, 0, 11, 7, 24, -5, 1, -10, 9, -12, -3, 6, -16, 7], [-8, 3, 6, -18, 7, -13, -13, 3, -6, -4, -1, 0, -4, 14, -4, -4], [-21, 6, 7, 0, 17, -7, -20, 11, -32, 6, 4, 2, -17, 0, 13, 4], [-8, 17, -3, -8, 7, -8, 1, 7, 2, -16, 9, -7, -2, -1, 10, -10], [-7, 15, -2, -10, 38, -15, 8, 20, -2, -15, 20, 8, -19, 10, -15, 0], [29, -8, -14, -11, 9, 5, -2, 18, -3, -4, 18, 9, -16, -5, -22, 11], [16, -13, 1, 9, -10, 5, -3, -1, 3, 12, -5, 4, 12, -7, -1, -7], [9, -22, -8, 2, -1, 3, 13, -2, -2, -3, -3, 24, 6, 8, -1, 0], [2, -11, -7, -6, -11, 0, -13, -4, 24, -10, -2, -29, 6, 4, -11, 15], [-10, 26, 26, 3, 22, 5, 36, -11, -33, 0, 0, 25, 2, 9, 0, 5], [16, -17, 3, -10, -24, 9, -16, -4, -4, 0, -9, -8, 26, 4, -14, 5], [8, -11, 8, 0, -16, 1, 6, -14, 10, -8, -13, 11, 16, 0, -9, -13], [-20, -2, 6, 3, -1, -9, 4, -12, -6, -3, -9, 8, 5, 19, -7, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_961_g_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_961_2_g_m();".
// 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_961_2_g_m(:prec:=16)
    chi := MakeCharacter_961_g();
    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_961_2_g_m();".
// 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_961_2_g_m( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_961_g();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![81, -81, 729, 189, 1521, -18, 561, 132, 292, -282, 221, -22, 6, -4, 9, -4, 1]>,<3,R![961, 3162, 7574, 15771, 20442, 14157, 4258, -219, -244, 129, 118, 108, 72, 9, -1, 3, 1]>],Snew);
    return Vf;
end function;