
// Make newform 175.4.a.g in Magma, downloaded from the LMFDB on 15 March 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_175_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_175_4_a_g();".
// 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_175_4_a_g();".
// 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 := [120, -35, -32, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [0, 1, 0, 0], [22, -20, -3, 1], [38, -18, -4, 1]];
    Rf_basisdens := [1, 1, 1, 1];
    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_175_a();"
function MakeCharacter_175_a()
    N := 175;
    order := 1;
    char_gens := [127, 101];
    v := [1, 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;

function MakeCharacter_175_a_Hecke( : Kf := Kf)
    return MakeCharacter_175_a();
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 := 4;
    raw_aps := [[-1, 1, 0, 0], [1, 0, 0, -1], [0, 0, 0, 0], [-7, 0, 0, 0], [27, 2, -4, -4], [-10, 10, 0, -4], [11, 6, 4, 5], [-5, -14, -12, 3], [-70, -24, -8, -7], [28, -6, 4, 13], [32, 22, -12, -2], [-102, -2, -16, 21], [169, -12, 12, -17], [94, 20, 36, -1], [6, -40, 24, -40], [-8, -20, -60, 2], [256, -10, -12, 6], [10, 78, 8, 2], [-89, -66, -32, -36], [36, -20, 52, 19], [285, -16, -12, 79], [-240, 136, 52, -43], [763, 76, -16, -1], [691, -24, 36, 19], [226, 106, 0, 196], [-104, 318, 56, 28], [-96, -240, -96, 2], [-705, 70, 112, -35], [64, 186, -8, 89], [-711, 4, -56, 172], [-452, 220, 76, -197], [40, -192, -160, 244], [101, -130, -72, 169], [1071, 372, -80, 13], [646, 170, -20, 213], [2, -312, 108, -27], [1476, 254, -72, 124], [289, 154, -108, -245], [-136, 66, -284, 86], [-106, -20, -56, -288], [657, 458, -52, 239], [-850, 206, 208, 182], [-298, 384, -176, 314], [-1801, 252, 92, 10], [-1864, 386, 128, -71], [-1966, -222, 36, -162], [-2221, 290, 4, -355], [1614, -686, -60, -222], [312, -496, 408, -118], [-3014, -292, -176, 112], [1160, -90, -252, -361], [-1660, 52, -192, -72], [693, -706, 156, -171], [-767, -782, 124, -613], [1470, 554, 392, 320], [-1844, -32, -192, 617], [2746, 122, 160, -312], [-1526, -214, 300, 256], [534, -928, 32, 472], [3776, 434, 176, -587], [1227, 42, -252, 335], [-4002, 142, -40, 220], [3409, -958, -20, 275], [-726, -16, -328, -82], [-230, -1068, 456, 72], [6762, -490, 96, -205], [-1149, -194, -64, -22], [2803, 278, 216, -337], [-1315, 330, -304, -16], [-2164, 1072, 880, 418], [2946, 1486, 88, -8], [24, 704, 368, -265], [-3448, -1046, 188, 1052], [-2934, -1122, 300, -181], [4953, -302, 412, -424], [-106, -198, -220, 1688], [2430, -94, -712, -817], [5118, -312, -1152, -520], [3709, 120, 108, 124], [-5747, 806, -628, 361], [-4393, -1592, 160, 351], [-1874, -2394, -400, -583], [2676, -1580, 272, -116], [-3109, -146, -796, -67], [3512, -2042, -564, -518], [1913, 1554, 492, -133], [1381, 1200, -192, 1126], [2187, 1004, -428, 586], [5402, -898, -576, 4], [1720, -844, -572, 644], [1136, 124, -312, -366], [-2230, 1018, 396, -1704], [-7972, -1100, 784, 101], [-4026, -56, 400, -959], [-5316, -140, -980, 1892], [550, -408, 296, 472], [-1198, -1250, 1208, -516], [2661, 2098, -556, 61], [6929, 178, 508, -469], [7844, -290, 476, -773], [-4759, 1474, -324, 182], [82, -1214, -1240, 1319], [7536, 1624, 600, -866], [11773, 556, -140, 164], [-3382, -1992, -2024, -201], [-9419, -358, -372, -91], [-5873, 216, 1392, -299], [5453, -3134, 388, -537], [5062, 4, 612, 983], [8231, -86, 644, -179], [13584, -210, -516, -886], [-8700, -2510, -852, -1641], [1400, -1274, -932, 1371], [-3712, 2946, 532, -1254], [-4442, -3120, 448, 1991], [5156, -2034, -864, 53], [-6752, 1388, 1008, 308], [16620, -2860, -280, 98], [-10320, 1752, 4, 1350], [-1869, 686, -160, -7], [8246, 1240, -272, 2080], [-2610, -624, 1044, 260], [4604, 256, -768, 1062], [-14499, -3406, -472, -1288], [6099, -3308, 1328, -751], [4772, 204, -1160, 50], [5632, -392, 1716, -1878], [-3952, 606, -412, -1708], [-15162, -1140, -56, 146], [4800, 1080, -1296, -1420], [4790, 784, 892, 3037], [-19232, 3972, 1392, 52], [-1322, 128, 356, 2194], [360, 2518, 544, 1587], [15217, 1870, -212, -1237], [-11495, 2460, -2724, 2051], [-600, -2042, 520, 166], [3460, -278, 332, 820], [12042, 1936, -776, -1082], [11492, 1018, 604, 1095], [-20712, 4452, 136, 694], [3876, 2296, 2956, -2942], [-1748, -2764, 248, 1355], [7947, -82, 3092, -94], [-19340, -2492, 296, 3276], [14926, -1038, 3732, -2570], [8926, 2408, -1232, -1318], [431, 2076, 1116, 1697], [17363, 3338, 1532, -289], [-6518, -2480, 2836, -337], [4332, 804, 2124, 458], [1738, 2206, 4024, 392], [-7299, -4402, 1788, -2678], [11494, 678, -1276, -2606], [8876, 1144, 560, -3784], [8682, -4632, -1824, 1671], [-9408, -5792, 512, -1207], [-942, 5246, 792, -5014], [4741, -3376, -2484, -1693], [948, -5166, -288, 270], [4588, 1952, 360, -1608], [-3205, -1284, -1852, 1394], [-3810, 3652, 8, 1026], [17875, -218, -660, 2399], [14827, 2472, 1012, -104], [-20224, 186, -1052, -1798], [5122, -3428, -616, 4779], [19066, -1692, 936, -588]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_175_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_175_4_a_g();".
// 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_175_4_a_g(:prec:=4)
    chi := MakeCharacter_175_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 4));
    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_175_4_a_g();".
// 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_175_4_a_g( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_175_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![54, -95, -26, 4, 1]>],Snew);
    return Vf;
end function;