
// Make newform 630.2.p.d in Magma, downloaded from the LMFDB on 23 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_630_p();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_630_p_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_630_2_p_d();".
// 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_630_2_p_d();".
// 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 := [2468, -4200, 9396, -2304, -10018, 9000, -390, -3980, 4381, -3208, 2038, -1060, 468, -160, 44, -8, 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], [16793034015612124938834, -23934903887294784577138, -12858765819814149851826, 40926323054469298392220, -14869090366419581274744, -6695413208073282320117, 14333925806545738314504, -11596558662862234489243, 8265744621093985000804, -4640011116922379602702, 2304181202426676368848, -873602417480851021066, 276826158413708919586, -60226927826888690507, 9725668908794807656, -562774495916439491], [25428183643435011904222, -30733834512706408492174, -43500953698777555881398, 55004701280349802299110, -4632388111963587305282, -11393698035435722579071, 11404262927773692236552, -5840398348573958212519, 4041144679322934429097, -1474112962276570407201, 529003231006925222794, 63465843780546289592, -73226907986136757077, 54606837403045596474, -12857249350888456272, 3032213158147542467], [-171306259365481837890, -6282113274102365639270, 2813217164198405391858, 2806180570477024502882, -2956065946843436515956, 561711968930130667115, 765999972577503723114, -893491663953354193145, 741787274106664740395, -479944271264554242956, 265577982917706831017, -115017586349089287380, 40115815228609518917, -10343507322599023945, 1869162384591272303, -189459389142179401], [-324369565471513571944470, 1849963039848331753034156, -474734476808790873758424, -1166154161806684523511884, 772189209163740001297146, 49401968719452752461618, -455821767744051239478084, 416425293635482663454870, -313204335175317848830532, 186997739457420263140595, -98131604157273713792417, 40455076680968739685154, -13650394975942461250082, 3387560389117442984821, -597005577051774160985, 57463446804324806656], [-3218130862221316538534, 3339839835977293349898, 1619614908646747909682, -2955414070604991316176, 2661507747042555238142, -618864174639387271983, -286903665924818362211, 654579449574064483973, -504358216480809646874, 361692566299709366750, -186854794378572238334, 87675942193827205916, -29425093514769579652, 8634399112046000627, -1546309609679851165, 227047847353294299], [-655384310526658061176370, 20238558435966527819712, 1021142421592277410545392, 139470629485648349543592, -453196884126645332894878, 50920577558339281235796, 258990795525416463441187, -266536283275387839780190, 199765418250704265275221, -127178239159417515900055, 70059724593100097181046, -32097269990110482202582, 11605767789241353876971, -3301533228439445143333, 629327280663332126915, -79393919449945982658], [4953314979671091914386, -69563417855887811590262, 67900382345440146475406, 49567018320092361398900, -72665216739127518232476, 26164113918064529317727, 8438196783448240455141, -17194421975418673487047, 14629612538510323928936, -10411668810910321121773, 5869982234656506140567, -2790998167482497394304, 1005021514527650595044, -291795068279263826738, 55010642157042931244, -7270374004730849089], [-4285668192530769907422386, -2592868999138249940614148, 2567652840116457753626444, 1187244358445528299700630, -4296148423430864009402104, 2018015801148467685315368, -384798314261186376875246, -466559481317881834487178, 444420381814494964716084, -409082101096983763763172, 240477100633737707938593, -130265800528395650400111, 48303109409228407231966, -15499530293127657597122, 2976365375903507830141, -451540371515658961741], [-1033776143387810, 3458622748428252, -1096315632766148, -2643357173350068, 2753738310846052, 114794981919506, -1402281541160623, 1550894197011720, -1095910859562429, 703579068436430, -361379135004859, 161459582546958, -54947015505279, 15345912920792, -2785448219070, 359914193422], [2118358297674795444358, -38991596719983247152546, 27649780135417412017838, 24341772922882024917510, -25686711644419981275748, 6939475770899603865201, 5770157961952380282553, -7586621148118675715941, 6321377338356961835278, -4219203221956064221654, 2337020074135779742216, -1050704722097228912452, 369620489788913193872, -100507911482473376449, 18422035725630218987, -2136755173393956537], [-2727415758009807248978, 14752471807310663707076, -3586718726373599708128, -8340994337342145566510, 7677744594236830729478, 559092735008078950804, -3800763965873456023913, 4107392096222455956256, -2902980954388466060128, 1845624747525023896384, -943439733400410174751, 413916755474349826567, -139292972117143184172, 37822391627481407274, -6746315322756100452, 826870315589366827], [379485684210882592230610, 814993291216169839937792, -1451259131988305719273048, -625178300561486523321368, 1826517547109681729360192, -695427388009028119680704, -117120318288446016059333, 411129215312623326596290, -339339423619584840260674, 254775083938374246045175, -143941943857202520100519, 71684166227624070090898, -26187829276220583422754, 7983976218280707666207, -1531595387977550439150, 218010357224216855032], [19209607994805100637038, -27165458842316960766446, 5876474567708689444658, 37866971456218682590040, -32933562512625700111528, 1140026327625884844041, 16160012204491785422233, -17506491487619123080851, 12783956130069292443813, -8089346472767506923204, 4204434454087245352251, -1865023315567112028582, 639633442179814967167, -178049224987654779479, 32595493434039515362, -4203295526671980907], [1885508666811359864666, 28088748085547452270978, -26036469505035005939294, -19048480265548976785870, 38897781555211737964354, -13475706307345786680013, -3419009165993693319694, 9190291533438197521343, -7559652252786560805284, 5535124469636135513822, -3085189341782475635168, 1501217166126032625926, -540283331114565981906, 161571028352294150697, -30591939162939049716, 4287121088875049501], [833692262762822152533230, -1865713490580482581284796, 722074358538118259020744, 2244799658106319196409964, -1959283812947569855415696, 38959621588397290216042, 1004704531523452089260264, -1052130145208000634459150, 770113770605984702119257, -482557387209924002440485, 251275270334916803372172, -110445657388178462570154, 37853779211639745645017, -10397613705066909427681, 1896764069680093807580, -236601075845042384366]];
    Rf_basisdens := [1, 7654781868523811633850, 36125198642682549640450, 1530956373704762326770, 411827264526581065901130, 1530956373704762326770, 411827264526581065901130, 36125198642682549640450, 2059136322632905329505650, 1629687746447810, 7654781868523811633850, 2705829596101058251650, 411827264526581065901130, 7654781868523811633850, 7654781868523811633850, 411827264526581065901130];
    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_630_p();"
function MakeCharacter_630_p()
    N := 630;
    order := 4;
    char_gens := [281, 127, 451];
    v := [4, 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_630_p_Hecke();"
function MakeCharacter_630_p_Hecke(Kf)
    N := 630;
    order := 4;
    char_gens := [281, 127, 451];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 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 := 2;
    raw_aps := [[0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0], [0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0], [0, 0, 0, 1, 0, -2, 0, 0, 0, 0, 0, 0, 0, -1, 2, 0], [0, 0, 0, 0, -1, 0, -1, 2, -2, 0, 0, 2, -1, 0, 0, -1], [0, 0, 2, 0, 1, 0, 0, 2, 0, 0, 0, -2, 0, 0, 0, 1], [0, 0, 0, 2, 0, -1, 0, 0, 0, 0, 0, 0, 0, 2, -1, 0], [3,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4, 0], [0, 0, 0, 0, -6, 0, -4, 0, 0, 0, 0, 0, 6, 0, 0, 4], [0, 0, -12, 0, -1, 0, 0, -12, 0, 0, 0, 2, 0, 0, 0, -1], [0, 0, 0, -1, 0, -3, 0, 0, 0, 0, 0, 0, 0, -3, 1, 0], [0, 0, 0, 0, 0, 0, -6, 0, -12, 0, 0, 0, -6, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0], [0, 0, 0, 0, -2, 0, 5, 0, 0, 0, 0, 0, -5, 0, 0, -2], [12, 2, 0, 1, 0, -1, 0, 0, 0, 0, -2, 0, 0, -1, 1, 0], [0, 0, -11, 0, 0, 0, -3, 11, -6, 0, 0, 0, -3, 0, 0, 0], [0, 0, 0, -5, 0, 2, 0, 0, 0, 0, 0, 0, 0, -2, -5, 0], [0, 0, 0, -2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, -1, 0], [0, 0, 0, 0, 1, 0, 1, 16, 2, 0, 0, -2, 1, 0, 0, 1], [0, 0, 20, 0, -2, 0, 0, 20, 0, 0, 0, 4, 0, 0, 0, -2], [9, -8, 0, 0, 0, 4, 0, 0, 0, -9, 0, 0, 0, 4, 0, 0], [0, 0, 0, 0, -1, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 1], [-2, 0, 0, -3, 0, 0, 0, 0, 0, -2, 6, 0, 0, 0, -3, 0], [0, 0, 0, 0, -7, 0, -7, 0, 0, 0, 0, 0, -7, 0, 0, -7], [0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6], [-2, 10, 0, 0, 0, -5, 0, 0, 0, 2, 0, 0, 0, -5, 0, 0], [0, 0, 21, 0, 0, 0, -2, -21, -4, 0, 0, 0, -2, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0, 4, 0, 0, 0, 0, 0, -2, 0, 0, -4], [0, 0, 0, 0, -10, 0, 3, 0, 0, 0, 0, 0, -3, 0, 0, -10], [0, 0, 0, 0, -7, 0, -11, 0, 0, 0, 0, 0, -11, 0, 0, 7], [0, 0, 0, -5, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, -5, 0], [-18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-24, 4, 0, 0, 0, -2, 0, 0, 0, 24, 0, 0, 0, -2, 0, 0], [0, 0, 10, 0, -1, 0, 1, 0, 2, 0, 0, 2, 1, 0, 0, -1], [0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, -8, 0, 0, 0], [0, 0, 16, 0, -6, 0, 0, 16, 0, 0, 0, 12, 0, 0, 0, -6], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -4, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0], [0, 0, 0, 0, -1, 0, 5, 0, 0, 0, 0, 0, -1, 0, 0, 5], [0, 0, 0, 0, 8, 0, -13, 0, 0, 0, 0, 0, -8, 0, 0, 13], [0, 0, -11, 0, -1, 0, 0, -11, 0, 0, 0, 2, 0, 0, 0, -1], [0, 0, 0, -2, 0, 8, 0, 0, 0, 0, 0, 0, 0, -2, 8, 0], [0, 0, 0, -1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0], [-19, 0, 0, 1, 0, 0, 0, 0, 0, -19, -2, 0, 0, 0, 1, 0], [0, 0, -14, 0, -4, 0, 4, 0, 8, 0, 0, 8, 4, 0, 0, -4], [0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 0, 0, -5, -6, 0], [16, -2, 0, -1, 0, 1, 0, 0, 0, 0, 2, 0, 0, 1, -1, 0], [0, 0, -26, 0, 0, 0, 2, 26, 4, 0, 0, 0, 2, 0, 0, 0], [0, 0, 0, -3, 0, 3, 0, 0, 0, 0, 0, 0, 0, -3, -3, 0], [0, 0, 0, 0, -6, 0, 4, 0, 0, 0, 0, 0, -6, 0, 0, 4], [0, 0, 0, 0, 2, 0, 2, -14, 4, 0, 0, -4, 2, 0, 0, 2], [0, 0, 11, 0, -6, 0, 0, 11, 0, 0, 0, 12, 0, 0, 0, -6], [0, 0, 0, -5, 0, 5, 0, 0, 0, 0, 0, 0, 0, -5, 5, 0], [19, 0, 0, 4, 0, 0, 0, 0, 0, 19, -8, 0, 0, 0, 4, 0], [0, 0, 0, 0, 12, 0, 7, 0, 0, 0, 0, 0, 12, 0, 0, 7], [0, 0, 0, 0, 4, 0, 4, -12, 8, 0, 0, -8, 4, 0, 0, 4], [0, 0, 0, 4, 0, -3, 0, 0, 0, 0, 0, 0, 0, 4, -3, 0], [0, 0, 26, 0, 0, 0, -3, -26, -6, 0, 0, 0, -3, 0, 0, 0], [0, 10, 0, -5, 0, -5, 0, 0, 0, -4, 10, 0, 0, -5, -5, 0], [0, 0, 0, 0, -6, 0, -2, 0, 0, 0, 0, 0, 2, 0, 0, -6], [0, 0, 0, -7, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 7, 0], [0, 0, 0, -9, 0, -1, 0, 0, 0, 0, 0, 0, 0, 1, -9, 0], [0, -4, 0, 2, 0, 2, 0, 0, 0, 20, -4, 0, 0, 2, 2, 0], [0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0], [-12, -6, 0, -3, 0, 3, 0, 0, 0, 0, 6, 0, 0, 3, -3, 0], [-13, -10, 0, 0, 0, 5, 0, 0, 0, 13, 0, 0, 0, 5, 0, 0], [0, 0, 0, 0, -2, 0, 8, 0, 0, 0, 0, 0, 8, 0, 0, 2], [0, 0, 0, 6, 0, -12, 0, 0, 0, 0, 0, 0, 0, -6, 12, 0], [0, 0, 0, 0, -5, 0, -2, 0, 0, 0, 0, 0, 5, 0, 0, 2], [0, 0, 0, -9, 0, -13, 0, 0, 0, 0, 0, 0, 0, -13, 9, 0], [0, 0, 0, 0, 2, 0, -5, 0, 0, 0, 0, 0, 2, 0, 0, -5], [0, 0, -2, 0, -6, 0, 0, -2, 0, 0, 0, 12, 0, 0, 0, -6], [0, 0, 0, 4, 0, -3, 0, 0, 0, 0, 0, 0, 0, 4, -3, 0], [0, 0, 14, 0, 0, 0, 7, -14, 14, 0, 0, 0, 7, 0, 0, 0], [2, 0, 0, 7, 0, 0, 0, 0, 0, 2, -14, 0, 0, 0, 7, 0], [0, 0, -22, 0, -2, 0, 2, 0, 4, 0, 0, 4, 2, 0, 0, -2], [0, 0, 0, 9, 0, -13, 0, 0, 0, 0, 0, 0, 0, -9, 13, 0], [0, 0, 0, 0, -8, 0, 4, 0, 0, 0, 0, 0, -4, 0, 0, -8], [0, 0, 0, 13, 0, -7, 0, 0, 0, 0, 0, 0, 0, 7, 13, 0], [0, 0, 0, 0, -3, 0, -2, 0, 0, 0, 0, 0, -3, 0, 0, -2], [0, 0, 0, -5, 0, 6, 0, 0, 0, 0, 0, 0, 0, 5, -6, 0], [0, 0, 0, 0, 3, 0, 3, 14, 6, 0, 0, -6, 3, 0, 0, 3], [25, -10, 0, 0, 0, 5, 0, 0, 0, -25, 0, 0, 0, 5, 0, 0], [0, 0, 0, 0, -9, 0, -5, 0, 0, 0, 0, 0, -5, 0, 0, 9], [-16, 0, 0, 4, 0, 0, 0, 0, 0, -16, -8, 0, 0, 0, 4, 0], [0, 0, 0, 0, -16, 0, -8, 0, 0, 0, 0, 0, -16, 0, 0, -8], [24, -4, 0, 0, 0, 2, 0, 0, 0, -24, 0, 0, 0, 2, 0, 0], [0, 0, 25, 0, 0, 0, 1, -25, 2, 0, 0, 0, 1, 0, 0, 0], [0, -14, 0, 7, 0, 7, 0, 0, 0, -12, -14, 0, 0, 7, 7, 0], [0, 0, 0, 0, 12, 0, 6, 0, 0, 0, 0, 0, -6, 0, 0, 12], [0, 0, 0, 12, 0, -5, 0, 0, 0, 0, 0, 0, 0, -5, -12, 0], [0, 0, 0, 0, 5, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, -5], [0, 0, -24, 0, 3, 0, -3, 0, -6, 0, 0, -6, -3, 0, 0, 3], [0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0], [4, 6, 0, 0, 0, -3, 0, 0, 0, -4, 0, 0, 0, -3, 0, 0], [0, 0, 0, 0, 9, 0, -6, 0, 0, 0, 0, 0, -6, 0, 0, -9], [0, 0, 18, 0, -4, 0, 4, 0, 8, 0, 0, 8, 4, 0, 0, -4], [0, 0, 0, 0, 8, 0, 8, 0, 0, 0, 0, 0, -8, 0, 0, -8], [-12, 4, 0, 2, 0, -2, 0, 0, 0, 0, -4, 0, 0, -2, 2, 0], [0, 0, 0, -3, 0, -11, 0, 0, 0, 0, 0, 0, 0, -11, 3, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_630_p_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_630_2_p_d();".
// 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_630_2_p_d(:prec:=16)
    chi := MakeCharacter_630_p();
    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_630_2_p_d();".
// 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_630_2_p_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_630_p();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<11,R![-2, 0, 1]>,<13,R![1024, 0, 0, 0, 720, 0, 0, 0, 1]>],Snew);
    return Vf;
end function;