
// Make newform 208.3.bd.g in Magma, downloaded from the LMFDB on 26 February 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_208_bd();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_208_bd_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_208_3_bd_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_208_3_bd_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 := [9409, 0, -3674, 0, 555, 0, -38, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [97, 2, -19, 0, 1, 0, 0, 0], [-97, 2, 19, 0, -1, 0, 0, 0], [-194, -1831, 0, 458, 0, -38, 0, 1], [78279, -12478, -25414, 3389, 2716, -321, -97, 11], [78279, 12478, -25414, -3389, 2716, 321, -97, -11], [-1067, 0, 288, 0, -28, 0, 1, 0], [-100977, 54476, 27936, -19460, -2716, 2222, 97, -84]];
    Rf_basisdens := [1, 4, 4, 388, 5044, 5044, 26, 5044];
    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_208_bd();"
function MakeCharacter_208_bd()
    N := 208;
    order := 12;
    char_gens := [79, 53, 145];
    v := [12, 12, 11];
    // 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_208_bd_Hecke();"
function MakeCharacter_208_bd_Hecke( : Kf := false)
    N := 208;
    order := 12;
    char_gens := [79, 53, 145];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 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 := 3;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0], [0, -1, 0, -2, -1, 0, 0, 0], [0, 0, -1, -1, 0, -1, 1, -1], [7, -1, 0, 4, 4, 2, 1, 0], [2, -2, -1, 0, -3, 0, -1, 2], [7, 4, 2, 7, -3, 6, 0, -1], [2, 2, 1, -5, -4, 1, 0, 3], [8, 1, 5, 8, -8, 1, 1, -5], [-12, 3, 6, -6, -3, -2, -4, 4], [0, 2, 0, 9, 42, -20, 0, 0], [-11, -2, 2, -22, -13, -9, -2, 4], [19, -8, -6, 16, -21, 16, -2, 8], [-21, 4, 2, -12, -19, 12, -2, 4], [9, 12, 6, -20, -23, 6, 0, 11], [-17, -8, -12, -28, 23, 5, -12, 4], [7, 5, 5, 0, -8, -3, 0, 0], [-7, 7, -2, 8, 8, -8, -7, -2], [-28, 0, -17, -27, 4, 9, -2, 1], [-2, -11, 3, 11, -16, -11, 14, -11], [-4, -11, -19, 44, -44, 37, -11, 19], [19, 1, 2, 32, -15, -17, 2, -1], [-20, -2, -2, 0, 32, 30, 0, 0], [-4, 13, -7, 1, 12, -11, 7, -20], [10, 11, 17, -41, -16, -41, -6, -11], [-60, -23, -21, -28, 28, 9, -23, 21], [-16, 3, 6, -8, -3, 67, -9, 9], [-33, 1, -1, -55, 23, -22, -11, 0], [0, 5, 0, 48, -67, 36, -20, -20], [81, -2, 0, 40, -41, 81, 0, 2], [62, 0, -11, 55, 34, -57, 14, -7], [72, -3, -6, 36, 3, -100, 42, -42], [-1, 9, 9, -3, -37, -28, -3, 6], [-104, 14, -1, -88, -88, -2, -14, -1], [73, 0, 14, 50, -15, 16, 46, -23], [-123, 18, 0, -72, 72, 69, 18, 0], [-31, 2, 6, -102, 65, 37, 6, -4], [166, 36, 36, 25, 31, 67, 25, -50], [25, 27, 22, -24, -24, 76, -27, 22], [-50, 26, 3, 16, 73, 16, 23, -26], [-15, 40, 20, 62, -39, 20, 0, -47], [-82, 4, 8, -41, -4, 19, -43, 43], [56, 40, -40, 93, 75, -35, 19, 0], [-56, 0, 65, -80, 27, -119, 48, -24], [103, 0, -18, 92, -85, 92, 18, 0], [-68, -13, -53, 57, -28, -57, -40, -13], [-6, -26, -13, 8, -131, -13, 0, -2], [0, -31, 0, 100, 145, -88, 0, 0], [16, 7, -19, 21, 42, -21, -26, 7], [-152, 23, -3, -124, 124, 51, 23, 3], [-113, 0, 14, -122, -5, 127, 14, -14], [52, -12, 12, 126, -62, 50, -22, 0], [-6, 3, -25, -177, -146, -31, 25, -28], [-84, -2, 19, -144, -144, 58, 2, 19], [80, 58, 29, -38, 43, 29, 0, -42], [-50, -34, -68, -25, 34, 26, -14, 14], [0, 30, 0, -31, 32, -1, 37, 37], [15, 0, 42, 4, -11, -20, 22, -11], [-92, 2, -23, -12, 117, -12, 25, -2], [52, 14, 7, -5, 172, 7, 0, -47], [-22, 10, -47, -147, 172, -25, -47, 57], [-410, 8, 16, -205, -8, 117, -29, 29], [-64, -4, -5, 20, 20, -88, 4, -5], [107, -38, -48, 196, -41, -155, -48, 10], [115, -19, 19, 137, 87, -106, 93, 0], [60, 10, 10, -6, -98, -88, -6, 12], [-23, 43, -8, -128, -97, -31, 8, -51], [27, -73, -56, -134, 134, -234, -73, 56], [-77, -19, 19, -156, 44, -63, 2, 0], [106, 0, -25, 116, -185, 395, -20, 10], [-26, -7, -43, -163, 62, -163, 36, 7], [151, -57, -42, 209, 136, -209, 15, -57], [242, -43, 47, 77, 118, -195, 47, -90], [0, 23, 0, 114, -65, 44, 40, 40], [-131, 0, 0, -127, 176, -352, -8, 4], [4, -39, 17, -9, -52, 9, 56, -39], [-169, -17, 0, -98, 98, 54, -17, 0], [164, 52, -52, 373, -141, 193, -45, 0], [278, -13, -15, -204, -204, 469, 13, -15], [-257, -131, -42, -193, 168, -193, -89, 131], [27, -10, 58, 64, -64, 27, -10, -58], [0, 29, 0, 396, 169, -70, 22, 22], [-23, -67, -32, 0, 55, -55, 32, 35], [-192, 42, -11, -70, -139, 70, -53, 42], [41, 64, 32, -191, -138, 32, 0, 150], [-170, -44, -88, -85, 44, -3, -89, 89], [578, 20, 20, 14, -62, -42, 14, -28], [86, -101, -27, 240, 240, -255, 101, -27], [-81, -8, -114, 104, 25, -104, -106, -8], [-207, 14, -36, -80, 80, 141, 14, 36], [348, -3, 17, 207, 124, -331, 17, -20], [20, 60, -60, 168, -184, 244, -128, 0], [-154, -81, -109, -125, 182, -125, 28, 81], [-333, -43, 12, -62, 62, 228, -43, -12], [-194, -12, -24, -97, 12, 201, -49, 49], [-169, 8, 28, -444, -303, -141, -28, 20], [-283, 0, -26, -348, -73, 172, 130, -65], [249, 1, 56, -149, 194, 149, 55, 1], [-143, 63, 63, 34, -18, 45, 34, -68], [0, 36, 0, -117, 154, -59, 43, 43], [-111, -47, -112, -106, 107, -1, -112, 65], [-201, 89, 89, 55, -7, 82, 55, -110], [281, -49, -8, 125, -322, 125, -41, 49], [39, -152, -76, 0, 61, -76, 0, -39], [-610, -2, -4, -305, 2, -411, -33, 33], [-182, 14, -14, -442, 106, -92, 78, 0], [-107, 79, 156, 76, 27, 49, -156, 77], [102, -106, -37, 122, 33, -122, 69, -106], [107, -59, -30, -120, 257, -137, -30, -29], [-95, -117, -117, -19, 43, -74, -19, 38], [0, -63, 0, 208, 423, -243, 35, 35], [-392, 0, 9, -404, -41, 73, 24, -12], [-319, -38, -80, -70, -277, 70, -42, -38], [130, 92, 137, 258, -258, 220, 92, -137], [162, -13, 63, 545, -446, -99, 63, -76], [39, 101, 152, 68, 68, 72, -101, 152], [8, -82, -41, 63, 136, -41, 0, -71], [177, 187, 230, -90, 90, -80, 187, -230], [308, 3, 6, 154, -3, 16, 66, -66], [0, -182, 0, 111, 196, -189, -87, -87], [303, 0, 196, 312, -173, 150, -18, 9], [289, -64, 8, -20, -361, -20, -72, 64], [792, -77, -154, 396, 77, 69, -71, 71], [246, -68, -68, 74, 110, 42, 74, -148], [278, -7, -173, 368, 368, -97, 7, -173], [208, 0, 29, -128, 179, 128, 29, 0], [158, -174, 174, 212, -388, 214, 104, 0], [1, -56, 60, -324, -324, 269, 56, 60], [-325, 184, 92, 332, -175, 92, 0, -7], [264, -56, 56, 384, -48, -8, 144, 0], [-172, 80, 123, 147, 196, -49, -123, 43], [-218, -94, 27, -404, 97, -404, -121, 94], [482, -104, 23, 308, 355, -308, 127, -104], [-190, 146, 292, -95, -146, 75, 69, -69], [0, 126, 0, 119, 180, -27, 63, 63], [100, -73, -5, 264, 264, -237, 73, -5], [-360, 35, 71, -347, -396, 347, 36, 35], [204, -53, -57, -588, 588, -845, -53, 57], [82, 63, 143, 600, 600, -455, -63, 143], [-421, -212, -106, 176, -361, -106, 0, 245], [0, -21, 0, -630, -203, 91, -115, -115], [-487, 58, 62, -370, 55, -425, -62, 4], [-196, 131, -69, 97, 4, -97, -200, 131], [71, 32, 16, 284, -55, 16, 0, -355], [-454, -51, -145, 109, -418, 309, -145, 94], [192, -93, -186, 96, 93, -231, 113, -113], [-142, 5, 219, -372, -372, 235, -5, 219], [168, -100, 31, 71, 66, -137, 31, -131], [102, -30, 30, 289, 87, -117, -85, 0], [-511, 171, 171, -67, 363, 534, -67, 134], [290, -65, 7, 383, 86, 297, -7, 72], [58, 128, 85, -314, 314, -244, 128, -85], [-302, 128, 256, -151, -128, -270, -146, 146], [-313, 153, -153, -807, -417, 570, 181, 0], [0, 202, 0, -63, -912, 557, -1, -1], [-606, -98, -196, -303, 98, -417, -259, 259], [-256, 146, 146, -6, -354, -208, -6, 12], [344, 0, -135, 314, 241, -347, 60, -30], [-553, 200, 46, -132, 132, 621, 200, -46], [440, 54, 54, 41, -553, -499, 41, -82], [629, -264, -220, 116, -293, 409, 220, 44], [-46, 91, -1, 267, 138, 267, 92, -91], [-161, -20, -10, -14, 1061, -10, 0, 175], [-53, -234, -184, -288, -51, -237, 184, 50], [-682, 0, -21, -696, -285, 591, 28, -14], [417, -108, -208, 396, 517, -396, -100, -108], [-3, -22, 66, 438, -507, 69, 66, -88], [0, 267, 0, -42, -1053, 660, -16, -16], [-458, 0, -103, -451, 60, -17, -14, 7]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_208_bd_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_208_3_bd_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_208_3_bd_g(:prec:=8)
    chi := MakeCharacter_208_bd();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 3));
    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_208_3_bd_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_208_3_bd_g( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_208_bd();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<3,R![4, -116, 3370, 142, 475, -140, 61, -8, 1]>],Snew);
    return Vf;
end function;