
// Make newform 21.7.b.a in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_21_b();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_21_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_21_7_b_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_21_7_b_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 := [256461520896, 0, 26369892864, 0, 1003321428, 0, 17813036, 0, 155265, 0, 642, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [107, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [231704485963776, -58019012432640, 18284751065952, -3869925659460, 465298015776, -91199451516, 4963685432, -988016909, 23410928, -4877786, 39992, -8717], [-1920833907406848, 58019012432640, -106787303818272, 3869925659460, -1690333280736, 91199451516, -7060434152, 988016909, 14227504, 4877786, 90904, 8717], [-1857542063118336, -58438210634496, -129447717958944, -3869925659460, -3119382867936, -91199451516, -33639776680, -988016909, -163888720, -4877786, -289192, -8717], [-525309830019072, -290933458566912, -30739378559904, -19349628297300, -104547702624, -455997257580, 10582264888, -4940084545, 107895664, -24388930, 269368, -43585], [-5591050360971264, -58438210634496, -435891166897536, -3869925659460, -11431899856128, -91199451516, -126929581600, -988016909, -618140608, -4877786, -1078816, -8717], [-231704485963776, -156046906439424, -18284751065952, -24121328749812, -465298015776, -656997677004, -4963685432, -6963320137, -23410928, -32188498, -39992, -53833], [929885722859520, -406599919665408, 56308713695136, -29894528044332, 1258190804832, -738896370324, 13785034952, -7927736159, 70245008, -38044286, 129224, -66143], [0, -80801728729344, 0, -6307998860604, 0, -165238859332, 0, -1831850931, 0, -8910438, 0, -15539], [-6985183452162048, 2044783165420800, -528769382724576, 134787719825388, -13620686692512, 2929763188308, -150641987416, 26450785807, -735207472, 104296798, -1288024, 149263]];
    Rf_basisdens := [1, 1, 1, 838396403712, 838396403712, 419198201856, 838396403712, 419198201856, 838396403712, 838396403712, 139732733952, 838396403712];
    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_21_b();"
function MakeCharacter_21_b()
    N := 21;
    order := 2;
    char_gens := [8, 10];
    v := [1, 2];
    // 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_21_b_Hecke();"
function MakeCharacter_21_b_Hecke(Kf)
    N := 21;
    order := 2;
    char_gens := [8, 10];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 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+1)]];
    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 := 7;
    raw_aps := [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [-4, -7, 0, -7, 2, 0, -2, 1, 1, 2, -2, -2], [28, 4, -4, -18, -10, 7, 0, -3, 0, 0, 0, 0], [-13, 145, 0, -44, 3, -3, -3, 2, -6, -4, -13, -4], [974, -32, 8, 46, -18, -23, 0, -9, 0, 0, 0, 0], [-13, 343, 0, -7, 17, 6, -17, 4, -5, 38, 62, -8], [-87, -854, 0, -362, 5, -48, -5, -7, 4, -72, 38, 14], [-761, 38, -80, -38, -133, 122, -57, -27, 0, 0, 0, 0], [17809, -126, -62, 340, 43, -156, -15, 45, 0, 0, 0, 0], [181, -1101, 0, 736, -83, 93, 83, 44, 2, -68, 121, -88], [2775, -330, -678, 1360, 385, -120, -105, -105, 0, 0, 0, 0], [394, -6662, 0, 1570, -170, 192, 170, 80, 14, -116, -216, -160], [-105, 5336, 0, -786, -141, -132, 141, -9, -48, -528, -148, 18], [-1125, 1704, 0, -3332, 371, -315, -371, 62, 178, -12, -72, -124], [76974, 512, 2000, 146, 396, 845, -258, -75, 0, 0, 0, 0], [-18639, 1058, -202, 956, 39, 1598, -1011, 471, 0, 0, 0, 0], [-2162, -12701, 0, -7645, 1008, -822, -1008, -245, -33, 862, -606, 490], [49818, 0, -128, 180, 972, -114, 264, -150, 0, 0, 0, 0], [-22564, -808, 5220, 2748, 2032, -1552, 300, 444, 0, 0, 0, 0], [-1179, -12634, 0, -1594, 793, 165, -793, 358, 104, 1200, -1132, -716], [1793, -55735, 0, 4164, -575, 303, 575, -306, -634, 68, 2299, 612], [135098, 224, -10160, 2168, 2004, -328, -204, 756, 0, 0, 0, 0], [1694, 8581, 0, 2764, -2202, -180, 2202, 74, 96, -4912, -1805, -148], [-181501, 382, 3156, 1290, -493, -572, -849, 1803, 0, 0, 0, 0], [296, 52319, 0, 1995, 1546, 150, -1546, -771, 803, 4934, 3082, 1542], [-131708, -516, -2804, -7676, 346, -3090, 3018, -444, 0, 0, 0, 0], [5299, 21460, 0, 17738, -1257, 2154, 1257, 133, -1476, 1528, -4040, -266], [-372745, 6038, 10, -15100, 2709, 830, 1911, 3297, 0, 0, 0, 0], [-3817, -9222, 0, -17702, 963, -2193, -963, -766, -1296, -928, 2060, 1532], [14912, -5718, 0, 45972, -5960, 4314, 5960, -162, -1108, -2968, -722, 324], [-1394965, -12918, 9592, 40400, 11135, -8607, -1143, -3168, 0, 0, 0, 0], [-15225, 87260, 0, -38690, 8291, -1416, -8291, 2051, -2576, 9648, 9248, -4102], [-321451, 23186, 3786, -49824, 7915, 21398, 3789, -2001, 0, 0, 0, 0], [1685174, 2232, 16040, -8126, -5876, -3015, -738, 5985, 0, 0, 0, 0], [1248483, 4558, 710, -10132, -2735, -1292, -573, 6423, 0, 0, 0, 0], [-10050, -268110, 0, -25350, 2874, -3618, -2874, -30, 9222, -1428, -2780, 60], [12376, 229577, 0, 43760, -9336, 3732, 9336, 2212, 4080, -15632, 14151, -4424], [27460, -278549, 0, 81231, -13186, 7014, 13186, -123, -1745, -12098, -21646, 246], [-2662962, -19024, -9352, 37454, -26100, -15697, -8502, 5175, 0, 0, 0, 0], [33308, -50435, 0, 94505, -12238, 7302, 12238, -3233, -1319, -3406, -8946, 6466], [-316984, -1296, -48792, -55836, -61776, 546, -1116, -726, 0, 0, 0, 0], [-47527, 213928, 0, -158058, 12085, -17028, -12085, 693, 5108, -11272, 2112, -1386], [2248900, -46992, 67240, 142888, -14636, -17796, -21180, -8016, 0, 0, 0, 0], [-5137499, -10214, -99322, 30540, -40333, 6850, -16815, -249, 0, 0, 0, 0], [1314936, -2016, 25952, 113804, 41408, 25302, -22788, -4530, 0, 0, 0, 0], [-37671, -274064, 0, -159028, 5377, -21759, -5377, -5612, 3350, -21540, -20084, 11224], [-2113816, 37412, 14436, -272022, -67634, -5311, 43188, -465, 0, 0, 0, 0], [12440, -286878, 0, 65728, -17736, 7854, 17736, 10502, 9432, -40768, -42254, -21004], [-83335, 826311, 0, -298939, 26159, -29946, -26159, -1358, -12485, -4858, 1702, 2716], [4720604, 17636, -91764, -33000, 46354, 1904, 14694, 1038, 0, 0, 0, 0], [-46657, -611924, 0, -131700, 10375, -8043, -10375, 10098, -6214, -15532, 42948, -20196], [85609, 593179, 0, 253948, -19319, 22935, 19319, -10210, -9010, 27652, -24727, 20420], [44380, -495419, 0, 182601, -8782, 24054, 8782, 6255, -2375, 18034, 97846, -12510], [-114132, 32819, 0, -264012, 63348, -8442, -63348, 16950, -1980, 75912, 53453, -33900], [6726933, -68262, -105652, 247730, 12629, -54822, -32859, 19419, 0, 0, 0, 0], [10326123, 63390, -24082, -88792, 19925, 54330, -6021, 15081, 0, 0, 0, 0], [84004, -324506, 0, 193760, -27228, 6366, 27228, -22022, 288, 2320, 74054, 44044], [-1072626, -116720, 64760, 259154, 64630, -103493, 12972, -26199, 0, 0, 0, 0], [-78222, -1704355, 0, -289528, 24418, -35922, -24418, -9020, 10604, -4968, -1229, 18040], [-3736004, 39524, -151684, -237450, 63592, -27811, 73998, -6663, 0, 0, 0, 0], [46268, 65534, 0, 113294, 14288, 8514, -14288, -21764, -13298, 89132, -9816, 43528], [-19657298, 84168, 42192, -272116, -30700, 39426, 24360, 20382, 0, 0, 0, 0], [-63905, 2292628, 0, -222986, 19051, -26616, -19051, -4189, 11288, -6752, -33600, 8378], [15576199, -145530, -111306, 602036, 54413, -36684, -85521, -23325, 0, 0, 0, 0], [8327133, -79322, 341822, 322652, -42767, -67484, -68925, 57087, 0, 0, 0, 0], [-2804, 1585115, 0, 63979, 19486, 20484, -19486, 12143, -12349, 55654, 243570, -24286], [-12029132, -39476, 363644, 221826, -23626, 46297, -55500, -30273, 0, 0, 0, 0], [62239, 1084867, 0, 276504, -63337, 25983, 63337, 26532, 48094, -127772, 47449, -53064], [83507, 1406911, 0, 215129, -56143, 7002, 56143, -6680, 20107, -84922, -219122, 13360], [-3892812, -65288, 100528, 830628, 223340, 77086, -158904, 16530, 0, 0, 0, 0], [-65828, 80452, -468012, -162040, 110014, -46040, 37050, 89442, 0, 0, 0, 0], [24347003, 57134, 62230, 142268, 222705, 68684, -11277, -273, 0, 0, 0, 0], [-31834, -2005880, 0, -59728, 18086, -9708, -18086, -2834, 42772, 22424, 83324, 5668], [-172461, -2850830, 0, -369766, 101047, -16224, -101047, 19483, 40052, 130680, 52774, -38966], [16306474, 9872, -705608, 230506, 42476, 52301, -69258, 26829, 0, 0, 0, 0], [-122309, 1058130, 0, -346686, 85103, -26304, -85103, -7701, 3148, 133000, 22406, 15402], [-8826880, 165780, -416052, -412092, 178830, 91506, 86454, -12180, 0, 0, 0, 0], [347755, 1405436, 0, 1086564, -79405, 117123, 79405, -17052, -77438, 109540, -113888, 34104], [-21442387, -32366, 46338, -449856, -325165, 51034, 63141, -146541, 0, 0, 0, 0], [-143369, -3598203, 0, -689449, -20823, -107010, 20823, -24914, 25329, -205838, -37030, 49828], [49237258, -291064, -95344, 745584, -22664, -145144, -62040, -83880, 0, 0, 0, 0], [-74682882, 184092, 692116, -269232, 107034, 101856, 2694, 79542, 0, 0, 0, 0], [96096, 4168125, 0, 592217, -2186, 105930, 2186, 58975, -23695, 89538, 214470, -117950], [-463416, 5780124, 0, -1469916, 199968, -126516, -199968, 5208, -37020, 136488, 207000, -10416], [-5892531, -452954, -222514, 710804, 123505, -592592, 106203, 33435, 0, 0, 0, 0], [87354, -5592921, 0, 625692, 6066, 98820, -6066, 52110, 55704, 105552, 129665, -104220], [-30598158, 100868, 316052, 34136, 502614, -156760, 88914, 168714, 0, 0, 0, 0], [99265, 3634736, 0, 85052, -164055, -28767, 164055, 3628, 1590, -392900, 58972, -7256], [-55200, 4584026, 0, 32046, 46980, -252, -46980, 3858, 143454, 85740, -425096, -7716], [5667539, -153794, 872222, 1912792, 130797, 248050, -491469, 89625, 0, 0, 0, 0], [222298, 7878825, 0, 415585, -69008, -15090, 69008, -91735, 31349, 15274, -37130, 183470], [52193061, 382698, 167570, -861160, 50423, 450210, 48729, -116241, 0, 0, 0, 0], [853626, 54936, 0, 2422956, -307566, 165198, 307566, -107832, 54912, -69072, -155844, 215664], [92034, 6209667, 0, 93872, 5746, -12450, -5746, -61340, -40396, 109272, -55843, 122680], [372953, -8184125, 0, 1420936, -109887, 161037, 109887, 29504, 30882, 43292, 331481, -59008], [-24815997, -579398, -631420, 2314316, 176923, -291071, -326199, 37872, 0, 0, 0, 0], [14181481, -471286, -1024230, 1363880, -615825, -238834, -345711, 113259, 0, 0, 0, 0], [-22232219, 83858, 707030, -886752, 3403, 160604, 240813, -317559, 0, 0, 0, 0], [-438415, 2021580, 0, -1009134, 215221, -41040, -215221, 70557, 31856, 207248, 8504, -141114], [-402149, -6153696, 0, -1012804, 288339, -7563, -288339, 49342, -178254, 462868, -285168, -98684], [-706891, 4076902, 0, -3170470, -31447, -436548, 31447, -67379, -10496, -801232, -739554, 134758], [-58239749, -258290, 39522, 527216, 569797, -724592, 186387, 279915, 0, 0, 0, 0], [117364800, 927060, 987884, -2824960, -341650, 924744, 209730, -207414, 0, 0, 0, 0], [-160095, -5136884, 0, -216392, 7793, 20757, -7793, 96908, 20770, -136716, -286852, -193816], [-593727, -7908983, 0, -1154976, 291705, -36903, -291705, 114108, 180090, 281388, 274483, -228216], [-1177100, 10031635, 0, -3502785, 552686, -329286, -552686, -17079, 168559, 480958, 291162, 34158], [-109753414, 534024, -862400, -1356004, -486352, 336054, -66132, 264102, 0, 0, 0, 0], [-73605458, 70572, -290532, 1388012, 887402, 388770, -213918, -104280, 0, 0, 0, 0], [62295576, 49140, -1195468, -1610212, -688522, -273126, 274470, 47796, 0, 0, 0, 0], [356141, 3616062, 0, 1754774, -54007, 254184, 54007, 103117, 25756, 194120, 402946, -206234], [106128885, 229510, 263456, -2966308, 688369, -700415, 1065219, -135294, 0, 0, 0, 0], [-122040816, -29248, 144216, -459584, -1572304, 91388, -351408, 230772, 0, 0, 0, 0], [370109, -1718322, 0, 1091718, -121415, 130176, 121415, 5829, -169204, 5864, -1535486, -11658], [-49467708, 27588, -2212356, -1375310, 52024, 122523, 457386, -552321, 0, 0, 0, 0], [-668316, -4241502, 0, -2106050, 45896, -180918, -45896, 130292, -45746, -530628, -1472836, -260584], [-513925, -6419930, 0, -3305698, -104425, -494796, 104425, -185621, -298664, -827200, 942278, 371242], [1026138, -22588897, 0, 2977811, -200180, 317940, 200180, -95039, -346225, 425598, 736202, 190078], [154339688, -716116, -67972, 766282, -522814, -1374583, 47712, 610755, 0, 0, 0, 0], [-124919205, -112746, -1569802, 478400, 821537, -149754, 189543, -152535, 0, 0, 0, 0], [1610586, -14494689, 0, 4565792, -748310, 322518, 748310, -108620, 54548, -634344, -1507695, 217240], [-266418, 18102389, 0, -482379, 8412, 21198, -8412, 150201, -34335, -241182, 2308094, -300402], [-94404907, -1478282, 605004, 4873968, -335035, -797243, -750813, 69774, 0, 0, 0, 0], [-1630933, -10790950, 0, -4744562, 400455, -453840, -400455, 161399, 332664, -429568, 55674, -322798], [46667842, 51216, 2667664, 5557396, 1161520, 1292874, -1499436, 257778, 0, 0, 0, 0], [-1045538, -12997000, 0, -2987440, 565566, -168096, -565566, 71890, -223980, 651160, -44108, -143780], [73872951, -555098, 2814984, 3854134, 2133963, -703676, -203325, 351903, 0, 0, 0, 0], [-24806198, 1368384, 1879888, -5888498, -555716, 551307, 865338, -48261, 0, 0, 0, 0], [165592147, -1944146, -3116594, 4589716, 510705, -1362332, -63573, -518241, 0, 0, 0, 0], [-1521815, 6624173, 0, -5762421, 503267, -640146, -503267, -130872, -158207, -12014, 1644730, 261744], [261334871, 1626774, 1852874, -6439412, -1512611, 954042, 557751, 114981, 0, 0, 0, 0], [-360589170, 187848, -451272, 190732, 1014052, -71538, 149208, 110178, 0, 0, 0, 0], [1851151, -2587545, 0, 7775244, -29569, 1043229, 29569, 132438, -99974, 1762444, -1666315, -264876], [-220044568, -516916, 1682580, 5835384, 2045806, -247672, -918582, 649338, 0, 0, 0, 0], [205628, 1633487, 0, -405796, 428996, -72270, -428996, -389582, -527972, 1492616, 1097129, 779164], [73329849, 460622, -2959288, 4398992, -213963, 2428523, -1844733, -123168, 0, 0, 0, 0], [-1458868, 24168587, 0, -4431536, 367740, -538860, -367740, 6704, 641640, -355648, -409139, -13408], [87745, 17926128, 0, 341438, 567213, 54486, -567213, -272993, -51996, 1789384, 2914724, 545986], [2366033, 132582, 3669936, -2902560, -2725731, 993831, -29445, -831804, 0, 0, 0, 0], [-710135, 10474928, 0, -3256582, 265821, -537876, -265821, -315719, 315192, 87328, -2511324, 631438], [90341122, -1035612, 2014408, -690788, -1345646, -852072, 472122, -655662, 0, 0, 0, 0], [1301440, -2728607, 0, 2720237, -517458, -53706, 517458, -445697, 332181, -250934, 1117062, 891394], [200721352, -242660, -664500, 626642, -1790186, -401783, -643836, 802959, 0, 0, 0, 0], [2244340, 13028462, 0, 7731666, -521296, 827022, 521296, -34500, -65102, 680452, -923356, 69000], [-39358372, -1108932, 1920924, 8540610, 2512506, 764397, -1270080, -603249, 0, 0, 0, 0], [1111045, 38503999, 0, 3705480, -1168915, 188037, 1168915, 216972, 731242, -2395700, 421285, -433944], [-101612824, -4297052, -337908, 12910362, 1834580, -3294365, -827226, -175461, 0, 0, 0, 0], [4236788, -19645329, 0, 13131427, -1133658, 1304958, 1133658, -246607, -561981, 835814, -591374, 493214], [47937810, -2785752, -1400584, 5864516, 1804508, -4198422, 503832, 908838, 0, 0, 0, 0], [-3658571, 28894591, 0, -13751236, 1421781, -1506921, -1421781, -388526, -406410, 606772, -668499, 777052], [-940765, -1807594, -3322986, -498432, -4965191, -731218, -283857, -792519, 0, 0, 0, 0], [-2268414, -19162242, 0, -7411978, -397082, -871962, 397082, 460786, 612698, -3459660, -3608524, -921572], [259062089, 3411778, 3916458, -5420976, -1703293, 3856702, -1035291, 590367, 0, 0, 0, 0], [-479631, -5523949, 0, 1368617, 760351, 742710, -760351, 602350, -642961, 1801422, -77434, -1204700], [165251870, 60556, -8653608, -3038940, -4759210, 1126000, -613794, -451650, 0, 0, 0, 0], [2680151, 6396855, 0, 6212056, -1808673, 66807, 1808673, -368932, 584526, -2745868, 817725, 737864], [-86028598, -4474904, 3910216, 5642516, 1559296, -5216162, 1622196, -880938, 0, 0, 0, 0], [1726598, -49770627, 0, 5028372, -1106306, 500880, 1106306, 190734, -428344, -1592320, -4369509, -381468], [1557176, 15846957, 0, 8438725, 517830, 1299504, -517830, 262001, 126357, 3110666, -901674, -524002], [-1432042, 31200648, 0, -3684172, 939230, -135960, -939230, 110446, -276248, 1385648, 516408, -220892], [182289181, 2375986, 6184622, -11916924, -2072113, 541918, 1697613, 136455, 0, 0, 0, 0], [-214115, 27849338, 0, -1164850, 541617, -251319, -541617, -415070, 268656, 1410736, 340840, 830140], [4188970, 26112418, 0, 14345772, -2010814, 1425234, 2010814, 336156, 266896, -1843472, -536694, -672312], [-3351252, 61930660, 0, -14744200, 314956, -1984314, -314956, -466166, -104440, -2406384, 115480, 932332], [534237944, 574128, 275796, -6452220, -5495916, 512520, -63984, 125592, 0, 0, 0, 0], [111901764, 5092996, -7302796, -11047486, -1875974, 4688593, -338160, 742563, 0, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_21_b_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_21_7_b_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_21_7_b_a(:prec:=12)
    chi := MakeCharacter_21_b();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 7));
    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_21_7_b_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_21_7_b_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_21_b();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,7,sign)));
    Vf := Kernel([],Snew);
    return Vf;
end function;