Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241852 views
�
eYc@s+dZddlmZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZddlmZdd	lmZdd
lmZd�Zd�Zd
�Zdefd��YZdefd��YZdefd��YZdefd��YZdS(s5
Weight 2 Hilbert modular forms over F = Q(sqrt(5)).
i����(t
cached_method(tFtO_F(tprimes_of_bounded_norm(tIcosiansModP1ModN(tis_Ideal(tIntegertprime_divisorstQQt
next_primetZZ(tideals_of_norm(tmatrix(tSequencecCst|�stj|�S|S(N(RRtideal(tX((s"psage/modform/hilbert/sqrt5/hmf.pyR*s
cCsXt|j��}t|j��}x ||dkrFt|�}q'Wtj|�dS(Ni(R	tsmallest_integerR
tnormRtprimes_above(tPtItptN((s"psage/modform/hilbert/sqrt5/hmf.pyt'next_prime_of_characteristic_coprime_to/s
cCs�x�tr�|j�}|dkr3tjd�}n�|ddkr_tjt|��d}nc|dkr}tjd�}nEtj|�}|d|kr�|d}ntjt|��d}|j|�s�|S|}qWdS(Niiiiii(ii(tTrueRRRRR	tdivides(RRRtQtA((s"psage/modform/hilbert/sqrt5/hmf.pytnext_prime_not_dividing6s	
tSpacecBsPeZd�Zd�Zd�Zd�Zdd�Zed�Z	ed�Z
RS(cCs[t|t�st�nt|j�|j�|j�f|j�|j�|j�f�S(N(t
isinstanceRtNotImplementedErrortcmptlevelt	dimensiontvector_space(tselftright((s"psage/modform/hilbert/sqrt5/hmf.pyt__cmp__Ks	!cCs
t�dS(N(R(R$tV((s"psage/modform/hilbert/sqrt5/hmf.pytsubspaceQscCs
t�dS(N(R(R$((s"psage/modform/hilbert/sqrt5/hmf.pyR#TscCs|j�j�S(N(R#tbasis(R$((s"psage/modform/hilbert/sqrt5/hmf.pyR)WscCs"|j|�j�}|j|�S(s]
        Return (p-)new subspace of this space of Hilbert modular forms.

        WARNING: There are known examples where this is still wrong somehow...

        INPUT:
            - p -- None or a prime divisor of the level

        OUTPUT:
            - subspace of this space of Hilbert modular forms

        EXAMPLES::

        We make a space of level a product of 2 split primes and (2)::

            sage: from psage.modform.hilbert.sqrt5.hmf import F, HilbertModularForms
            sage: P = F.prime_above(31); Q = F.prime_above(11); R = F.prime_above(2)
            sage: H = HilbertModularForms(P*Q*R); H
            Hilbert modular forms of dimension 32, level 2*a-38 (of norm 1364=2^2*11*31) over QQ(sqrt(5))

        The full new space::

            sage: N = H.new_subspace(); N
            Subspace of dimension 22 of Hilbert modular forms of dimension 32, level 2*a-38 (of norm 1364=2^2*11*31) over QQ(sqrt(5))

        The new subspace for each prime divisor of the level::

            sage: N_P = H.new_subspace(P); N_P
            Subspace of dimension 31 of Hilbert modular forms of dimension 32, level 2*a-38 (of norm 1364=2^2*11*31) over QQ(sqrt(5))
            sage: N_Q = H.new_subspace(Q); N_Q
            Subspace of dimension 28 of Hilbert modular forms of dimension 32, level 2*a-38 (of norm 1364=2^2*11*31) over QQ(sqrt(5))
            sage: N_R = H.new_subspace(R); N_R
            Subspace of dimension 24 of Hilbert modular forms of dimension 32, level 2*a-38 (of norm 1364=2^2*11*31) over QQ(sqrt(5))
            sage: N_P.intersection(N_Q).intersection(N_R) == N
            True

        (tdegeneracy_matrixtkernelR((R$RR'((s"psage/modform/hilbert/sqrt5/hmf.pytnew_subspaceZs&c

Cs�ttjd�|j��}|j|�}|j�}xtg|D]}|dsF|^qF�dkr?t||j��}|j�|kr�Pn|r�|j�GHn|j|�}g}xt|D]l}|dr�|j|�q�|r|j	|d�j
�GHnx(|j|d�D]}|j|�qWq�W|}q<Wg|D]}|j|d�^qG}|j
�t|dtdtdtdt�}	|	S(s~
        Return Hecke decomposition of self using Hecke operators T_p
        coprime to the level with norm(p) <= B.
        iit	immutabletcrtuniversetcheck(RRRR!thecke_matrixt
decompositiontlenRtappendtrestricttfcptdecomposition_of_subspaceR(tsortR
RtinttFalse(
R$tBtverboseRtTtDRtD2tZtS((s"psage/modform/hilbert/sqrt5/hmf.pyR2�s.2


&
$c

Cs�|j�j�}ttjd�|j��}|j|�}|j|�}x�tg|D]}|ds[|^q[�dkr>t||j��}|r�|j	�GHn|j|�}g}xt|D]l}|dr�|j
|�q�|r|j|d�j�GHnx(|j|d�D]}|j
|�qWq�W|}qQWg|D]}|j
|d�^qF}|j�t|dtdtdtdt�}	|	S(sZ
        Return complete irreducible Hecke decomposition of new subspace of self.
        iiR-R.R/R0(R*R+RRRR!R1R7R3RR4R5R6R(R8R
RR9R:(
R$R<R'RR=R>RR?R@RA((s"psage/modform/hilbert/sqrt5/hmf.pytnew_decomposition�s,2


&
$N(t__name__t
__module__R&R(R#R)tNoneR,R:R2RB(((s"psage/modform/hilbert/sqrt5/hmf.pyRJs				)"tHilbertModularFormscBs}eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e	Z
dd�Zd	�Z
d
�Zd�ZRS(
cCsot|�|_|jj�d|_t|j�|_|jj�|_t|j|_	i|_
i|_dS(s�
        Space of Hilbert modular forms of weight (2,2) over Q(sqrt(5)).

        INPUT:
            - level -- an ideal or element of ZZ[(1+sqrt(5))/2].

        TESTS::

            sage: import psage
            sage: H = psage.hilbert.sqrt5.HilbertModularForms(3); H
            Hilbert modular forms of dimension 1, level 3 (of norm 9=3^2) over QQ(sqrt(5))
            sage: loads(dumps(H)) == H
            True
        iN(Rt_leveltgens_reducedt_genRt_icosians_mod_p1tcardinalityt
_dimensionRt
_vector_spacet_hecke_matricest_degeneracy_matrices(R$R!((s"psage/modform/hilbert/sqrt5/hmf.pyt__init__�s	cCsVd|jt|j�jdd�|jj�t|jj�j��jdd�fS(NsPHilbert modular forms of dimension %s, level %s (of norm %s=%s) over QQ(sqrt(5))t t(RLtstrRItreplaceRGRtfactor(R$((s"psage/modform/hilbert/sqrt5/hmf.pyt__repr__�scCsZt|t�r%||ks!t�|St|t�rP||j�ksLt�|St�dS(N(RRFtAssertionErrortHilbertModularFormsSubspacetambientt	TypeError(R$tM((s"psage/modform/hilbert/sqrt5/hmf.pytintersection�scCs|jS(N(RG(R$((s"psage/modform/hilbert/sqrt5/hmf.pyR!�scCs|jS(N(RM(R$((s"psage/modform/hilbert/sqrt5/hmf.pyR#�scCstd�td�fS(Ni(R(R$((s"psage/modform/hilbert/sqrt5/hmf.pytweight�scCs|jS(N(RL(R$((s"psage/modform/hilbert/sqrt5/hmf.pyR"�scCsVt|�}|jj|�r)|j|S|jj|�}|j�||j|<|S(N(RRNthas_keyRJR1t
set_immutable(R$tntt((s"psage/modform/hilbert/sqrt5/hmf.pyR1�s

cCs�|j�j�r.tt|j�ddt�S|dkr�d}xMt|j�D]<}|dkrt|j	|�}qP|j
|j	|��}qPW|St|�}|jj
|�r�|j|S|jj	|�}|j�||j|<|S(Nitsparse(R!tis_primeRRR"RRERRGR*taugmentRROR^RJR_(R$RRtd((s"psage/modform/hilbert/sqrt5/hmf.pyR*s 

cCsIt|t�st�nt|jj�|jf|jj�|jf�S(N(RRFRR RGR(R$tother((s"psage/modform/hilbert/sqrt5/hmf.pyR&s	cCs
t||�S(N(RX(R$R'((s"psage/modform/hilbert/sqrt5/hmf.pyR(sc
CsXg|j�D]}|j�dkr
|^q
}ttjd�|j��}x�tr
|j�j�d}g|D]%}|j	|�d|kru|^qu}t
|�dkr�PqRt
|�dkr�g|D]}||dkr�|^q�}PqRt||j��}qRWtgt|�D]\}}t
||�^qdtdtdtdt�S(NiiR-R.R/R0(ii(RBR"RRRR!Rt
residue_fieldRKR1R3R
t	enumeratetEllipticCurveFactorR9R:(R$RR>RtqRtEtnumber((s"psage/modform/hilbert/sqrt5/hmf.pytelliptic_curve_factorss1	2)1N(RCRDRPRVR\R!R#R]R"R1R=RER*R&R(Rm(((s"psage/modform/hilbert/sqrt5/hmf.pyRF�s									
		RXcBsheZd�Zd�Zd�Zd�Zd�Zd�Zd�ZeZ	d�Z
d�Zd	�ZRS(
cCs4|j�|j�kst�||_||_dS(N(R"tdegreeRWt_Ht_V(R$tHR'((s"psage/modform/hilbert/sqrt5/hmf.pyRP.s	cCsd|jj�|jfS(NsSubspace of dimension %s of %s(RpR"Ro(R$((s"psage/modform/hilbert/sqrt5/hmf.pyRV3scCs
t�dS(N(R(R$R'((s"psage/modform/hilbert/sqrt5/hmf.pyR(6scCs�t|t�r+|j�|ks't�|St|t�r�|j�|j�ksXt�|j�}|j�j|j��}t||�St�dS(N(RRFRYRWRXR#R\RZ(R$R[RqR'((s"psage/modform/hilbert/sqrt5/hmf.pyR\:s
cCs|jS(N(Ro(R$((s"psage/modform/hilbert/sqrt5/hmf.pyRYEscCs|jS(N(Rp(R$((s"psage/modform/hilbert/sqrt5/hmf.pyR#HscCs|jj|�j|j�S(N(RoR1R5Rp(R$R`((s"psage/modform/hilbert/sqrt5/hmf.pyR1KscCs|jj|�j|j�S(N(RoR*trestrict_domainRp(R$R((s"psage/modform/hilbert/sqrt5/hmf.pyR*OscCs
|jj�S(N(RoR!(R$((s"psage/modform/hilbert/sqrt5/hmf.pyR!RscCs
|jj�S(N(RpR"(R$((s"psage/modform/hilbert/sqrt5/hmf.pyR"Us(
RCRDRPRVR(R\RYR#R1R=R*R!R"(((s"psage/modform/hilbert/sqrt5/hmf.pyRX-s									RicBsneZdZd�Zd�Zd�Zd�Zd�Zed
d��Z
ed
d��Zd
dd	�ZRS(s�
    A subspace of the new subspace of a space of weight 2 Hilbert
    modular forms that (conjecturally) corresponds to an elliptic
    curve.
    cCs||_||_dS(s�
        INPUT:
            - S -- subspace of a space of Hilbert modular forms
            - ``number`` -- nonnegative integer indicating some
              ordering among the factors of a given level.
        N(t_St_number(R$RARl((s"psage/modform/hilbert/sqrt5/hmf.pyRP_s	cCsd|j|jj�fS(s�
        EXAMPLES::

            sage: from psage.modform.hilbert.sqrt5.hmf import HilbertModularForms, F
            sage: H = HilbertModularForms(F.prime_above(31)).elliptic_curve_factors()[0]
            sage: type(H)
            <class 'psage.modform.hilbert.sqrt5.hmf.EllipticCurveFactor'>
            sage: H.__repr__()
            'Isogeny class of elliptic curves over QQ(sqrt(5)) attached to form number 0 in Hilbert modular forms of dimension 2, level 5*a-2 (of norm 31=31) over QQ(sqrt(5))'
        sRIsogeny class of elliptic curves over QQ(sqrt(5)) attached to form number %s in %s(RtRsRY(R$((s"psage/modform/hilbert/sqrt5/hmf.pyRViscCstS(s�
        Return the base field of this elliptic curve factor.

        OUTPUT:
            - the field Q(sqrt(5))

        EXAMPLES::

            sage: from psage.modform.hilbert.sqrt5.hmf import HilbertModularForms, F
            sage: H = HilbertModularForms(F.prime_above(31)).elliptic_curve_factors()[0]
            sage: H.base_field()
            Number Field in a with defining polynomial x^2 - x - 1
        (R(R$((s"psage/modform/hilbert/sqrt5/hmf.pyt
base_fieldvscCs
|jj�S(s�
        Return the conductor of this elliptic curve factor, which is
        the level of the space of Hilbert modular forms.

        OUTPUT:
            - ideal of the ring of integers of Q(sqrt(5))

        EXAMPLES::

        (RsR!(R$((s"psage/modform/hilbert/sqrt5/hmf.pyt	conductor�scCsW|j|j��r?||j|j��r8td�SdSn|jj|�dSdS(s}
        Return the trace of Frobenius at the prime P, for a prime P of
        good reduction.

        INPUT:
            - `P` -- a prime ideal of the ring of integers of Q(sqrt(5)).

        OUTPUT:
            - an integer

        EXAMPLES::

            sage: from psage.modform.hilbert.sqrt5.hmf import HilbertModularForms, F
            sage: H = HilbertModularForms(F.primes_above(31)[0]).elliptic_curve_factors()[0]
            sage: H.ap(F.primes_above(11)[0])
            4
            sage: H.ap(F.prime_above(5))
            -2
            sage: H.ap(F.prime_above(7))
            2

        We check that the ap we compute here match with those of a known elliptic curve
        of this conductor::

            sage: a = F.0; E = EllipticCurve(F, [1,a+1,a,a,0])
            sage: E.conductor().norm()
            31
            sage: 11+1 - E.change_ring(F.primes_above(11)[0].residue_field()).cardinality()
            4
            sage: 5+1 - E.change_ring(F.prime_above(5).residue_field()).cardinality()
            -2
            sage: 49+1 - E.change_ring(F.prime_above(7).residue_field()).cardinality()
            2
        it?N(ii(RRvR
RsR1(R$R((s"psage/modform/hilbert/sqrt5/hmf.pytap�s
#
cCs�|j�}|jj�}|j�}|dkrfddlm}||j��j�dd}nx}t	|d�D]k}|j
�}|j�dkr�|S|j|�sw|j
|�j�}||j|�j|�}qwqwWtd�dS(s�
        Return 1-dimensional subspace of the dual of the ambient space
        with the same system of eigenvalues as self.  This is useful when
        computing a large number of `a_P`.

        If we can't find such a subspace using Hecke operators of norm
        less than B, then we raise a RuntimeError.  This should only happen
        if you set B way too small, or self is actually not new.

        INPUT:
            - B -- Integer or None; if None, defaults to a heuristic bound.
        i����(tGamma0iis%unable to isolate 1-dimensional spaceN(RvRsRYR#REtsage.modular.allRyRtindexRt
sage_idealR"RR1t	transposeRxt	kernel_ontRuntimeError(R$R;RRqR'RyRR=((s"psage/modform/hilbert/sqrt5/hmf.pytdual_eigenspace�s##cCs?|j|�}|j�dks't�|j�j�ddS(Nii(R�R"RWtbasis_matrixt_clear_denom(R$R;Rk((s"psage/modform/hilbert/sqrt5/hmf.pytdual_eigenvector�stdualc
Csgt|�D]}|j�^q
}|dkrQg|D]}|j|�^q8S|dkr|j|�}|j�d}||}|jj�j}	|j�}
g}x[|D]S}|j	|
�r�|j|�}n|	j
||�j|�|}|j|�q�W|St
d|�dS(s
        Return list of traces of Frobenius for all primes P of norm
        less than bound.  Use the function
        psage.number_fields.sqrt5.primes_of_bounded_norm(B)
        to get the corresponding primes.

        INPUT:
            - `B` -- a nonnegative integer
            - ``dual_bound`` -- default None; passed to dual_eigenvector function
            - ``algorithm`` -- 'dual' (default) or 'direct'

        OUTPUT:
             - a list of Sage integers

        EXAMPLES::

        We compute the aplists up to B=50::

            sage: from psage.modform.hilbert.sqrt5.hmf import HilbertModularForms, F
            sage: H = HilbertModularForms(F.primes_above(71)[1]).elliptic_curve_factors()[0]
            sage: v = H.aplist(50); v
            [-1, 0, -2, 0, 0, 2, -4, 6, -6, 8, 2, 6, 12, -4]

        This agrees with what we get using an elliptic curve of this
        conductor::

            sage: a = F.0; E = EllipticCurve(F, [a,a+1,a,a,0])
            sage: from psage.ellcurve.lseries.aplist_sqrt5 import aplist
            sage: w = aplist(E, 50)
            sage: v == w
            True

        We compare the output from the two algorithms up to norm 75::

            sage: H.aplist(75, algorithm='direct') == H.aplist(75, algorithm='dual')
            True
        tdirectR�isunknown algorithm '%s'N(RR|RxR�tnonzero_positionsRsRYRJRvRthecke_operator_on_basis_elementtdot_productR4t
ValueError(
R$R;t
dual_boundt	algorithmRtprimestvtitcRRtaplistRx((s"psage/modform/hilbert/sqrt5/hmf.pyR��s"&% 

N(
RCRDt__doc__RPRVRuRvRxRRER�R�R�(((s"psage/modform/hilbert/sqrt5/hmf.pyRiYs	
	
		
	.N( R�tsage.misc.cachefuncRtsqrt5RRtpsage.number_fields.sqrt5Rt
sqrt5_fastRtsage.rings.idealRtsage.rings.allRRRR	R
ttablesRtsage.matrix.allRtsage.structure.allR
RRRtobjectRRFRXRi(((s"psage/modform/hilbert/sqrt5/hmf.pyt<module>s (			un,