
// Make newform 675.4.b.k in Magma, downloaded from the LMFDB on 06 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_675_b();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_675_b_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_675_4_b_k();".
// 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_675_4_b_k();".
// 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 := [36, 0, 541, 0, 47, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [6, 0, 24, 0, 1, 0], [0, 397, 0, 41, 0, 1], [261, 0, 41, 0, 1, 0], [0, 2007, 0, 157, 0, 3]];
    Rf_basisdens := [1, 1, 17, 102, 17, 34];
    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_675_b();"
function MakeCharacter_675_b()
    N := 675;
    order := 2;
    char_gens := [326, 352];
    v := [2, 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_675_b_Hecke();"
function MakeCharacter_675_b_Hecke( : Kf := false)
    N := 675;
    order := 2;
    char_gens := [326, 352];
    char_values := [[1, 0, 0, 0, 0, 0], [-1, 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 := 4;
    raw_aps := [[0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 2, 0, 14, 0, 0], [-12, 0, 2, 0, 4, 0], [0, 10, 0, -14, 0, -4], [0, 2, 0, 3, 0, -8], [-59, 0, -14, 0, -4, 0], [0, 32, 0, -39, 0, -4], [42, 0, 42, 0, 8, 0], [83, 0, -30, 0, -8, 0], [0, -64, 0, 50, 0, 8], [132, 0, -42, 0, 16, 0], [0, -78, 0, 16, 0, -8], [0, -28, 0, 168, 0, 4], [0, 14, 0, 165, 0, -12], [78, 0, -82, 0, 12, 0], [173, 0, 60, 0, -16, 0], [0, -52, 0, 302, 0, -24], [192, 0, -34, 0, -60, 0], [0, -22, 0, -404, 0, 60], [-221, 0, 22, 0, -12, 0], [0, 120, 0, -489, 0, -60], [756, 0, -66, 0, 48, 0], [0, 64, 0, 440, 0, -8], [180, 0, 208, 0, 64, 0], [0, -272, 0, -140, 0, -56], [0, 200, 0, 120, 0, 20], [-953, 0, 224, 0, -28, 0], [0, -116, 0, -342, 0, 20], [0, -108, 0, -322, 0, -16], [-1470, 0, 144, 0, 72, 0], [0, -2, 0, 1845, 0, -68], [844, 0, 288, 0, 144, 0], [1380, 0, -210, 0, 80, 0], [-700, 0, 0, 0, -28, 0], [0, -34, 0, 1112, 0, 140], [0, 176, 0, 2350, 0, -112], [0, -56, 0, -1257, 0, -128], [0, -34, 0, -909, 0, 80], [-2436, 0, 308, 0, -72, 0], [41, 0, -592, 0, -196, 0], [-1182, 0, 56, 0, -24, 0], [0, -430, 0, 262, 0, 332], [0, 154, 0, 1905, 0, 4], [880, 0, -276, 0, 136, 0], [-3295, 0, -242, 0, 40, 0], [0, -720, 0, 970, 0, 0], [0, -812, 0, -495, 0, 56], [3049, 0, 228, 0, 20, 0], [0, -64, 0, 30, 0, 8], [234, 0, -188, 0, -160, 0], [1103, 0, -1108, 0, 220, 0], [-792, 0, 492, 0, -216, 0], [0, 690, 0, 1689, 0, 252], [0, -268, 0, -1188, 0, 268], [294, 0, 580, 0, -16, 0], [-85, 0, -46, 0, -152, 0], [0, -498, 0, -340, 0, -524], [-1254, 0, 290, 0, -184, 0], [0, -770, 0, 1084, 0, 144], [0, 698, 0, 4227, 0, -28], [0, 56, 0, -1066, 0, -128], [-1914, 0, -662, 0, 340, 0], [0, 740, 0, -4256, 0, -256], [0, -90, 0, 7707, 0, -56], [-3772, 0, -404, 0, 104, 0], [0, -1370, 0, 5246, 0, 156], [0, -168, 0, 4164, 0, -760], [-4301, 0, 152, 0, 312, 0], [0, 116, 0, -1134, 0, -256], [-5358, 0, 1660, 0, -128, 0], [0, -558, 0, -5506, 0, -200], [0, 364, 0, 2488, 0, -400], [2491, 0, -822, 0, 232, 0], [0, -1156, 0, 465, 0, -232], [264, 0, -1886, 0, 16, 0], [0, 1254, 0, 1586, 0, -412], [-3930, 0, 1120, 0, -320, 0], [-7037, 0, 248, 0, 644, 0], [-6900, 0, -2490, 0, -580, 0], [-2797, 0, -48, 0, -112, 0], [-6774, 0, 986, 0, 44, 0], [0, 38, 0, -7658, 0, 756], [-515, 0, 1746, 0, -1064, 0], [0, 1444, 0, 8823, 0, -164], [3306, 0, 2138, 0, -240, 0], [0, 2500, 0, 4148, 0, 768], [4518, 0, -1892, 0, -368, 0], [0, 1668, 0, 4642, 0, 56], [0, 180, 0, 8865, 0, 592], [3636, 0, 1958, 0, 380, 0], [0, 390, 0, -3868, 0, 1032], [-5154, 0, -764, 0, -376, 0], [-6155, 0, 1754, 0, -240, 0], [0, -1112, 0, -10983, 0, -540], [6636, 0, -2928, 0, 1072, 0], [-708, 0, 902, 0, 48, 0], [0, 2002, 0, -5054, 0, 32], [5210, 0, -464, 0, -604, 0], [0, -1538, 0, -1504, 0, -888], [0, -3700, 0, 66, 0, 776], [0, 2152, 0, -1440, 0, -44], [4746, 0, -146, 0, -392, 0], [-4849, 0, 2550, 0, 552, 0], [0, -82, 0, 11552, 0, 596], [0, 520, 0, -5913, 0, 700], [0, -3098, 0, -741, 0, -1476], [-1878, 0, -2334, 0, 1100, 0], [-13087, 0, 532, 0, 268, 0], [0, 2334, 0, -664, 0, -712], [0, 1072, 0, 22792, 0, -232], [0, -166, 0, 531, 0, -364], [2584, 0, -4420, 0, 248, 0], [1949, 0, 1202, 0, -1484, 0], [-360, 0, -2096, 0, 1432, 0], [0, 1690, 0, 1750, 0, 0], [0, 164, 0, 9651, 0, -1760], [0, -442, 0, -11343, 0, 1312], [13698, 0, -2770, 0, 828, 0], [-7966, 0, -1880, 0, 636, 0], [0, -2574, 0, -4430, 0, 908], [0, -2364, 0, 11406, 0, -156], [0, 1632, 0, 9459, 0, -1824], [-4711, 0, 4358, 0, 1192, 0], [-7542, 0, 1992, 0, -776, 0], [18130, 0, -2936, 0, -292, 0], [-11034, 0, -1368, 0, 192, 0], [0, 3588, 0, -3904, 0, 1800], [0, 4176, 0, 8080, 0, 1728], [-2597, 0, -1634, 0, 1808, 0], [0, 5144, 0, -3216, 0, -1464], [-3499, 0, 498, 0, 1004, 0], [0, -3660, 0, -17422, 0, 248], [17442, 0, 698, 0, 176, 0], [1687, 0, -584, 0, -2492, 0], [0, -4834, 0, 8913, 0, 1400], [0, -3878, 0, 620, 0, 1416], [0, 4230, 0, 7809, 0, -404], [26412, 0, 730, 0, -648, 0], [12896, 0, -7472, 0, 452, 0], [19050, 0, 4160, 0, -880, 0], [0, 1786, 0, -6368, 0, -80], [0, 7212, 0, 3195, 0, -256], [8350, 0, -3540, 0, -2044, 0], [-4224, 0, 4380, 0, -2104, 0], [0, -6572, 0, 7492, 0, 1776], [0, -2786, 0, -8901, 0, 864], [-14933, 0, 1614, 0, -1088, 0], [0, -4820, 0, -7239, 0, 2292], [0, 2690, 0, -20344, 0, -1404], [-6222, 0, -7718, 0, -1896, 0], [0, -8442, 0, 18898, 0, 1272], [0, 804, 0, -7689, 0, 396], [0, -1416, 0, -124, 0, 2248], [-25710, 0, -858, 0, -4, 0], [-11864, 0, 2424, 0, 664, 0], [2292, 0, -486, 0, -16, 0], [0, 5084, 0, 1832, 0, 24], [-4602, 0, -7416, 0, 880, 0], [0, -3976, 0, -10443, 0, -2428], [0, -1344, 0, 14742, 0, 1600], [0, 9120, 0, -1150, 0, -1680], [12090, 0, 368, 0, 1664, 0], [0, -8116, 0, 5598, 0, -440], [0, 2652, 0, 26925, 0, 180], [14153, 0, 3938, 0, -772, 0], [0, -542, 0, -17128, 0, 836]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_675_b_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_675_4_b_k();".
// 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_675_4_b_k(:prec:=6)
    chi := MakeCharacter_675_b();
    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_675_4_b_k();".
// 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_675_4_b_k( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_675_b();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![36, 0, 541, 0, 47, 0, 1]>,<7,R![3240000, 0, 146304, 0, 832, 0, 1]>,<11,R![-83280, -2612, 38, 1]>],Snew);
    return Vf;
end function;