Spaces of \(p\)-adic automorphic forms - Modular Symbols

Skip to content
Back to top
View this page
Edit this page

# Spaces of \(p\)-adic automorphic forms

Compute with harmonic cocycles and \(p\)-adic automorphic forms, including overconvergent \(p\)-adic automorphic forms.

For a discussion of nearly rigid analytic modular forms and the rigid analytic Shimura-Maass operator, see [Fra2011]. It is worth also looking at [FM2014] for information on how these are implemented in this code.

EXAMPLES:

Create a quotient of the Bruhat-Tits tree:

Sage

    sage: X = BruhatTitsQuotient(13, 11)

Python

    >>> from sage.all import *
    >>> X = BruhatTitsQuotient(Integer(13), Integer(11))

Declare the corresponding space of harmonic cocycles:

Sage

    sage: H = X.harmonic_cocycles(2, prec=5)

[Python]

    >>> from sage.all import *
    >>> H = X.harmonic_cocycles(Integer(2), prec=Integer(5))

And the space of \(p\)-adic automorphic forms:

Sage

    sage: A = X.padic_automorphic_forms(2, prec=5, overconvergent=True)                 # needs sage.rings.padics

Python

    >>> from sage.all import *
    >>> A = X.padic_automorphic_forms(Integer(2), prec=Integer(5), overconvergent=True)                 # needs sage.rings.padics

Harmonic cocycles, unlike \(p\)-adic automorphic forms, can be used to compute a basis:

Sage

    sage: a = H.gen(0)                                                                  # needs sage.rings.padics

[Python]

    >>> from sage.all import *
    >>> a = H.gen(Integer(0))                                                                  # needs sage.rings.padics

This can then be lifted to an overconvergent \(p\)-adic modular form:

Sage

    sage: A.lift(a)  # long time                                                        # needs sage.rings.padics
    p-adic automorphic form of cohomological weight 0

Python

    >>> from sage.all import *
    >>> A.lift(a)  # long time                                                        # needs sage.rings.padics
    p-adic automorphic form of cohomological weight 0

class sage.modular.btquotients.pautomorphicform.BruhatTitsHarmonicCocycleElement(_parent, vec)

  Bases: `HeckeModuleElement`

  \(\Gamma\)-invariant harmonic cocycles on the Bruhat-Tits tree. \(\Gamma\)-invariance is necessary so that the cocycle can be stored in terms of a finite amount of data.

  More precisely, given a `BruhatTitsQuotient` \(T\), harmonic cocycles are stored as a list of values in some coefficient module (e.g. for weight 2 forms can take \(\CC_p\)) indexed by edges of a fundamental domain for \(T\) in the Bruhat-Tits tree. Evaluate the cocycle at other edges using Gamma invariance (although the values may not be equal over an orbit of edges as the coefficient module action may be nontrivial).

  EXAMPLES:

  Harmonic cocycles form a vector space, so they can be added and/or subtracted from each other:

  Sage

      sage: X = BruhatTitsQuotient(5,23)
      sage: H = X.harmonic_cocycles(2,prec=10)
      sage: v1 = H.basis()[0]; v2 = H.basis()[1] # indirect doctest
      sage: v3 = v1+v2
      sage: v1 == v3-v2
      True

  Python

      >>> from sage.all import *
      >>> X = BruhatTitsQuotient(Integer(5),Integer(23))
      >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
      >>> v1 = H.basis()[Integer(0)]; v2 = H.basis()[Integer(1)] # indirect doctest
      >>> v3 = v1+v2
      >>> v1 == v3-v2
      True

  and rescaled:

  Sage

      sage: v4 = 2*v1
      sage: v1 == v4 - v1
      True

  [Python]

      >>> from sage.all import *
      >>> v4 = Integer(2)*v1
      >>> v1 == v4 - v1
      True

  AUTHORS:

  - Cameron Franc (2012-02-20)

  - Marc Masdeu

  derivative(z=None, level=0, order=1)

    Integrate Teitelbaum’s \(p\)-adic Poisson kernel against the measure corresponding to `self` to evaluate the rigid analytic Shimura-Maass derivatives of the associated modular form at \(z\).

    If `z = None`, a function is returned that encodes the derivative of the modular form.

    Note

    This function uses the integration method of Riemann summation and is incredibly slow! It should only be used for testing and bug-finding. Overconvergent methods are quicker.

    INPUT:

    - `z` – an element in the quadratic unramified extension of \(\QQ_p\) that is not contained in \(\QQ_p\) (default: `None`); if `z = None` then a function encoding the derivative is returned.

    - `level` – integer; how fine of a mesh should the Riemann sum use

    - `order` – integer; how many derivatives to take

    OUTPUT:

    An element of the quadratic unramified extension of \(\QQ_p\), or a function encoding the derivative.

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(3,23)
        sage: H = X.harmonic_cocycles(2,prec=5)
        sage: b = H.basis()[0]
        sage: R.<a> = Qq(9,prec=10)
        sage: b.modular_form(a,level=0) == b.derivative(a,level=0,order=0)
        True
        sage: b.derivative(a,level=1,order=1)
        (2*a + 2)*3 + (a + 2)*3^2 + 2*a*3^3 + 2*3^4 + O(3^5)
        sage: b.derivative(a,level=2,order=1)
        (2*a + 2)*3 + 2*a*3^2 + 3^3 + a*3^4 + O(3^5)

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(3),Integer(23))
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(5))
        >>> b = H.basis()[Integer(0)]
        >>> R = Qq(Integer(9),prec=Integer(10), names=('a',)); (a,) = R._first_ngens(1)
        >>> b.modular_form(a,level=Integer(0)) == b.derivative(a,level=Integer(0),order=Integer(0))
        True
        >>> b.derivative(a,level=Integer(1),order=Integer(1))
        (2*a + 2)*3 + (a + 2)*3^2 + 2*a*3^3 + 2*3^4 + O(3^5)
        >>> b.derivative(a,level=Integer(2),order=Integer(1))
        (2*a + 2)*3 + 2*a*3^2 + 3^3 + a*3^4 + O(3^5)

  evaluate(e1)

    Evaluate a harmonic cocycle on an edge of the Bruhat-Tits tree.

    INPUT:

    - `e1` – a matrix corresponding to an edge of the Bruhat-Tits tree

    OUTPUT:

    - An element of the coefficient module of the cocycle which describes the value of the cocycle on `e1`

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(5,17)
        sage: e0 = X.get_edge_list()[0]
        sage: e1 = X.get_edge_list()[1]
        sage: H = X.harmonic_cocycles(2,prec=10)
        sage: b = H.basis()[0]
        sage: b.evaluate(e0.rep)
        1 + O(5^10)
        sage: b.evaluate(e1.rep)
        4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10)

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(5),Integer(17))
        >>> e0 = X.get_edge_list()[Integer(0)]
        >>> e1 = X.get_edge_list()[Integer(1)]
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> b = H.basis()[Integer(0)]
        >>> b.evaluate(e0.rep)
        1 + O(5^10)
        >>> b.evaluate(e1.rep)
        4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10)

  modular_form(z=None, level=0)

    Integrate Teitelbaum’s \(p\)-adic Poisson kernel against the measure corresponding to `self` to evaluate the associated modular form at `z`.

    If `z` = None, a function is returned that encodes the modular form.

    Note

    This function uses the integration method of Riemann summation and is incredibly slow! It should only be used for testing and bug-finding. Overconvergent methods are quicker.

    INPUT:

    - `z` – an element in the quadratic unramified extension of \(\QQ_p\) that is not contained in \(\QQ_p\) (default: `None`)

    - `level` – integer; how fine of a mesh should the Riemann sum use

    OUTPUT: an element of the quadratic unramified extension of \(\QQ_p\)

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(3,23)
        sage: H = X.harmonic_cocycles(2,prec = 8)
        sage: b = H.basis()[0]
        sage: R.<a> = Qq(9,prec=10)
        sage: x1 = b.modular_form(a,level = 0); x1
        a + (2*a + 1)*3 + (a + 1)*3^2 + (a + 1)*3^3 + 3^4 + (a + 2)*3^5 + a*3^7 + O(3^8)
        sage: x2 = b.modular_form(a,level = 1); x2
        a + (a + 2)*3 + (2*a + 1)*3^3 + (2*a + 1)*3^4 + 3^5 + (a + 2)*3^6 + a*3^7 + O(3^8)
        sage: x3 = b.modular_form(a,level = 2); x3
        a + (a + 2)*3 + (2*a + 2)*3^2 + 2*a*3^4 + (a + 1)*3^5 + 3^6 + O(3^8)
        sage: x4 = b.modular_form(a,level = 3);x4
        a + (a + 2)*3 + (2*a + 2)*3^2 + (2*a + 2)*3^3 + 2*a*3^5 + a*3^6 + (a + 2)*3^7 + O(3^8)
        sage: (x4-x3).valuation()
        3

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(3),Integer(23))
        >>> H = X.harmonic_cocycles(Integer(2),prec = Integer(8))
        >>> b = H.basis()[Integer(0)]
        >>> R = Qq(Integer(9),prec=Integer(10), names=('a',)); (a,) = R._first_ngens(1)
        >>> x1 = b.modular_form(a,level = Integer(0)); x1
        a + (2*a + 1)*3 + (a + 1)*3^2 + (a + 1)*3^3 + 3^4 + (a + 2)*3^5 + a*3^7 + O(3^8)
        >>> x2 = b.modular_form(a,level = Integer(1)); x2
        a + (a + 2)*3 + (2*a + 1)*3^3 + (2*a + 1)*3^4 + 3^5 + (a + 2)*3^6 + a*3^7 + O(3^8)
        >>> x3 = b.modular_form(a,level = Integer(2)); x3
        a + (a + 2)*3 + (2*a + 2)*3^2 + 2*a*3^4 + (a + 1)*3^5 + 3^6 + O(3^8)
        >>> x4 = b.modular_form(a,level = Integer(3));x4
        a + (a + 2)*3 + (2*a + 2)*3^2 + (2*a + 2)*3^3 + 2*a*3^5 + a*3^6 + (a + 2)*3^7 + O(3^8)
        >>> (x4-x3).valuation()
        3

  monomial_coefficients(copy=True)

    Return a dictionary whose keys are indices of basis elements in the support of `self` and whose values are the corresponding coefficients.

    EXAMPLES:

    Sage

        sage: M = BruhatTitsQuotient(3,5).harmonic_cocycles(2, prec=10)
        sage: M.monomial_coefficients()
        {}

    Python

        >>> from sage.all import *
        >>> M = BruhatTitsQuotient(Integer(3),Integer(5)).harmonic_cocycles(Integer(2), prec=Integer(10))
        >>> M.monomial_coefficients()
        {}

  print_values()

    Print the values of the cocycle on all of the edges.

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(5,23)
        sage: H = X.harmonic_cocycles(2,prec=10)
        sage: H.basis()[0].print_values()
        0   |1 + O(5^10)
        1   |0
        2   |0
        3   |4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10)
        4   |0
        5   |0
        6   |0
        7   |0
        8   |0
        9   |0
        10  |0
        11  |0

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(5),Integer(23))
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> H.basis()[Integer(0)].print_values()
        0   |1 + O(5^10)
        1   |0
        2   |0
        3   |4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10)
        4   |0
        5   |0
        6   |0
        7   |0
        8   |0
        9   |0
        10  |0
        11  |0

  riemann_sum(f, center=1, level=0, E=None)

    Evaluate the integral of the function `f` with respect to the measure determined by `self` over \(\mathbf{P}^1(\QQ_p)\).

    INPUT:

    - `f` – a function on \(\mathbf{P}^1(\QQ_p)\)

    - `center` – integer (default: 1); Center of integration

    - `level` – integer (default: 0); Determines the size of the covering when computing the Riemann sum. Runtime is exponential in the level.

    - `E` – list of edges (default: `None`); They should describe a covering of \(\mathbf{P}^1(\QQ_p)\)

    OUTPUT: a \(p\)-adic number

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(5,7)
        sage: H = X.harmonic_cocycles(2,prec=10)
        sage: b = H.basis()[0]
        sage: R.<z> = PolynomialRing(QQ,1)
        sage: f = z^2

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(5),Integer(7))
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> b = H.basis()[Integer(0)]
        >>> R = PolynomialRing(QQ,Integer(1), names=('z',)); (z,) = R._first_ngens(1)
        >>> f = z**Integer(2)

    Note that \(f\) has a pole at infinity, so that the result will be meaningless:

    Sage

        sage: b.riemann_sum(f,level=0)
        1 + 5 + 2*5^3 + 4*5^4 + 2*5^5 + 3*5^6 + 3*5^7 + 2*5^8 + 4*5^9 + O(5^10)

    [Python]

        >>> from sage.all import *
        >>> b.riemann_sum(f,level=Integer(0))
        1 + 5 + 2*5^3 + 4*5^4 + 2*5^5 + 3*5^6 + 3*5^7 + 2*5^8 + 4*5^9 + O(5^10)

  valuation()

    Return the valuation of the cocycle, defined as the minimum of the values it takes on a set of representatives.

    OUTPUT: integer

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(3,17)
        sage: H = X.harmonic_cocycles(2,prec=10)
        sage: b1 = H.basis()[0]
        sage: b2 = 3*b1
        sage: b1.valuation()
        0
        sage: b2.valuation()
        1
        sage: H(0).valuation()
        +Infinity

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(3),Integer(17))
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> b1 = H.basis()[Integer(0)]
        >>> b2 = Integer(3)*b1
        >>> b1.valuation()
        0
        >>> b2.valuation()
        1
        >>> H(Integer(0)).valuation()
        +Infinity

class sage.modular.btquotients.pautomorphicform.BruhatTitsHarmonicCocycles(X, k, prec=None, basis_matrix=None, base_field=None)

  Bases: `AmbientHeckeModule`, `UniqueRepresentation`

  Ensure unique representation.

  EXAMPLES:

  Sage

      sage: X = BruhatTitsQuotient(3,5)
      sage: M1 = X.harmonic_cocycles( 2, prec = 10)
      sage: M2 = X.harmonic_cocycles( 2, 10)
      sage: M1 is M2
      True

  Python

      >>> from sage.all import *
      >>> X = BruhatTitsQuotient(Integer(3),Integer(5))
      >>> M1 = X.harmonic_cocycles( Integer(2), prec = Integer(10))
      >>> M2 = X.harmonic_cocycles( Integer(2), Integer(10))
      >>> M1 is M2
      True

  Element

    alias of `BruhatTitsHarmonicCocycleElement`

  base_extend(base_ring)

    Extend the base ring of the coefficient module.

    INPUT:

    - `base_ring` – a ring that has a coerce map from the current base ring

    OUTPUT: a new space of HarmonicCocycles with the base extended

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(3,19)
        sage: H = X.harmonic_cocycles(2,10)
        sage: H.base_ring()
        3-adic Field with capped relative precision 10
        sage: H1 = H.base_extend(Qp(3,prec=15))
        sage: H1.base_ring()
        3-adic Field with capped relative precision 15

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(3),Integer(19))
        >>> H = X.harmonic_cocycles(Integer(2),Integer(10))
        >>> H.base_ring()
        3-adic Field with capped relative precision 10
        >>> H1 = H.base_extend(Qp(Integer(3),prec=Integer(15)))
        >>> H1.base_ring()
        3-adic Field with capped relative precision 15

  basis_matrix()

    Return a basis of `self` in matrix form.

    If the coefficient module \(M\) is of finite rank then the space of Gamma invariant \(M\) valued harmonic cocycles can be represented as a subspace of the finite rank space of all functions from the finitely many edges in the corresponding BruhatTitsQuotient into \(M\). This function computes this representation of the space of cocycles.

    OUTPUT:

    - A basis matrix describing the cocycles in the spaced of all \(M\) valued Gamma invariant functions on the tree.

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(5,3)
        sage: M = X.harmonic_cocycles(4,prec = 20)
        sage: B = M.basis() # indirect doctest
        sage: len(B) == X.dimension_harmonic_cocycles(4)
        True

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(5),Integer(3))
        >>> M = X.harmonic_cocycles(Integer(4),prec = Integer(20))
        >>> B = M.basis() # indirect doctest
        >>> len(B) == X.dimension_harmonic_cocycles(Integer(4))
        True

    AUTHORS:

    - Cameron Franc (2012-02-20)

    - Marc Masdeu (2012-02-20)

  change_ring(new_base_ring)

    Change the base ring of the coefficient module.

    INPUT:

    - `new_base_ring` – a ring that has a coerce map from the current base ring

    OUTPUT: new space of HarmonicCocycles with different base ring

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(5,17)
        sage: H = X.harmonic_cocycles(2,10)
        sage: H.base_ring()
        5-adic Field with capped relative precision 10
        sage: H1 = H.base_extend(Qp(5,prec=15)) # indirect doctest
        sage: H1.base_ring()
        5-adic Field with capped relative precision 15

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(5),Integer(17))
        >>> H = X.harmonic_cocycles(Integer(2),Integer(10))
        >>> H.base_ring()
        5-adic Field with capped relative precision 10
        >>> H1 = H.base_extend(Qp(Integer(5),prec=Integer(15))) # indirect doctest
        >>> H1.base_ring()
        5-adic Field with capped relative precision 15

  character()

    The trivial character.

    OUTPUT: the identity map

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(3,7)
        sage: H = X.harmonic_cocycles(2,prec = 10)
        sage: f = H.character()
        sage: f(1)
        1
        sage: f(2)
        2

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(3),Integer(7))
        >>> H = X.harmonic_cocycles(Integer(2),prec = Integer(10))
        >>> f = H.character()
        >>> f(Integer(1))
        1
        >>> f(Integer(2))
        2

  embed_quaternion(g, scale=1, exact=None)

    Embed the quaternion element `g` into the matrix algebra.

    INPUT:

    - `g` – a quaternion, expressed as a 4x1 matrix

    OUTPUT: a 2x2 matrix with \(p\)-adic entries

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(7,2)
        sage: q = X.get_stabilizers()[0][1][0]
        sage: H = X.harmonic_cocycles(2,prec = 5)
        sage: Hmat = H.embed_quaternion(q)
        sage: Hmat.matrix().trace() == X._conv(q).reduced_trace() and Hmat.matrix().determinant() == 1
        True

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(7),Integer(2))
        >>> q = X.get_stabilizers()[Integer(0)][Integer(1)][Integer(0)]
        >>> H = X.harmonic_cocycles(Integer(2),prec = Integer(5))
        >>> Hmat = H.embed_quaternion(q)
        >>> Hmat.matrix().trace() == X._conv(q).reduced_trace() and Hmat.matrix().determinant() == Integer(1)
        True

  free_module()

    Return the underlying free module.

    OUTPUT: a free module

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(3,7)
        sage: H = X.harmonic_cocycles(2,prec=10)
        sage: H.free_module()
        Vector space of dimension 1 over 3-adic Field with
        capped relative precision 10

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(3),Integer(7))
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> H.free_module()
        Vector space of dimension 1 over 3-adic Field with
        capped relative precision 10

  is_simple()

    Whether `self` is irreducible.

    OUTPUT: boolean; `True` if and only if `self` is irreducible

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(3, 29)
        sage: H = X.harmonic_cocycles(4, prec=10)
        sage: H.rank()
        14
        sage: H.is_simple()
        False
        sage: X = BruhatTitsQuotient(7, 2)
        sage: H = X.harmonic_cocycles(2, prec=10)
        sage: H.rank()
        1
        sage: H.is_simple()
        True

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(3), Integer(29))
        >>> H = X.harmonic_cocycles(Integer(4), prec=Integer(10))
        >>> H.rank()
        14
        >>> H.is_simple()
        False
        >>> X = BruhatTitsQuotient(Integer(7), Integer(2))
        >>> H = X.harmonic_cocycles(Integer(2), prec=Integer(10))
        >>> H.rank()
        1
        >>> H.is_simple()
        True

  monomial_coefficients()

    Void method to comply with pickling.

    EXAMPLES:

    Sage

        sage: M = BruhatTitsQuotient(3,5).harmonic_cocycles(2,prec=10)
        sage: M.monomial_coefficients()
        {}

    Python

        >>> from sage.all import *
        >>> M = BruhatTitsQuotient(Integer(3),Integer(5)).harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> M.monomial_coefficients()
        {}

  rank()

    Return the rank (dimension) of `self`.

    OUTPUT: integer

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(7,11)
        sage: H = X.harmonic_cocycles(2,prec = 10)
        sage: X.genus() == H.rank()
        True
        sage: H1 = X.harmonic_cocycles(4,prec = 10)
        sage: H1.rank()
        16

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(7),Integer(11))
        >>> H = X.harmonic_cocycles(Integer(2),prec = Integer(10))
        >>> X.genus() == H.rank()
        True
        >>> H1 = X.harmonic_cocycles(Integer(4),prec = Integer(10))
        >>> H1.rank()
        16

  submodule(v, check=False)

    Return the submodule of `self` spanned by `v`.

    INPUT:

    - `v` – submodule of `self.free_module()`

    - `check` – boolean (default: `False`)

    OUTPUT: subspace of harmonic cocycles

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(3,17)
        sage: H = X.harmonic_cocycles(2,prec=10)
        sage: H.rank()
        3
        sage: v = H.gen(0)
        sage: N = H.free_module().span([v.element()])
        sage: H1 = H.submodule(N)
        Traceback (most recent call last):
        ...
        NotImplementedError

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(3),Integer(17))
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> H.rank()
        3
        >>> v = H.gen(Integer(0))
        >>> N = H.free_module().span([v.element()])
        >>> H1 = H.submodule(N)
        Traceback (most recent call last):
        ...
        NotImplementedError

sage.modular.btquotients.pautomorphicform.eval_dist_at_powseries(phi, f)

  Evaluate a distribution on a powerseries.

  A distribution is an element in the dual of the Tate ring. The elements of coefficient modules of overconvergent modular symbols and overconvergent \(p\)-adic automorphic forms give examples of distributions in Sage.

  INPUT:

  - `phi` – a distribution

  - `f` – a power series over a ring coercible into a \(p\)-adic field

  OUTPUT:

  The value of `phi` evaluated at `f`, which will be an element in the ring of definition of `f`

  EXAMPLES:

  Sage

      sage: from sage.modular.btquotients.pautomorphicform import eval_dist_at_powseries
      sage: R.<X> = PowerSeriesRing(ZZ,10)
      sage: f = (1 - 7*X)^(-1)

      sage: D = OverconvergentDistributions(0,7,10)                                   # needs sage.rings.padics
      sage: phi = D(list(range(1,11)))                                                # needs sage.rings.padics
      sage: eval_dist_at_powseries(phi,f)                                             # needs sage.rings.padics
      1 + 2*7 + 3*7^2 + 4*7^3 + 5*7^4 + 6*7^5 + 2*7^7 + 3*7^8 + 4*7^9 + O(7^10)

  Python

      >>> from sage.all import *
      >>> from sage.modular.btquotients.pautomorphicform import eval_dist_at_powseries
      >>> R = PowerSeriesRing(ZZ,Integer(10), names=('X',)); (X,) = R._first_ngens(1)
      >>> f = (Integer(1) - Integer(7)*X)**(-Integer(1))

      >>> D = OverconvergentDistributions(Integer(0),Integer(7),Integer(10))                                   # needs sage.rings.padics
      >>> phi = D(list(range(Integer(1),Integer(11))))                                                # needs sage.rings.padics
      >>> eval_dist_at_powseries(phi,f)                                             # needs sage.rings.padics
      1 + 2*7 + 3*7^2 + 4*7^3 + 5*7^4 + 6*7^5 + 2*7^7 + 3*7^8 + 4*7^9 + O(7^10)

class sage.modular.btquotients.pautomorphicform.pAdicAutomorphicFormElement(parent, vec)

  Bases: `ModuleElement`

  Rudimentary implementation of a class for a \(p\)-adic automorphic form on a definite quaternion algebra over \(\QQ\). These are required in order to compute moments of measures associated to harmonic cocycles on the Bruhat-Tits tree using the overconvergent modules of Darmon-Pollack and Matt Greenberg. See Greenberg’s thesis [Gr2006] for more details.

  INPUT:

  - `vec` – a preformatted list of data

  EXAMPLES:

  Sage

      sage: X = BruhatTitsQuotient(17,3)
      sage: H = X.harmonic_cocycles(2,prec=10)
      sage: h = H.an_element()
      sage: HH = X.padic_automorphic_forms(2,10)
      sage: a = HH(h)
      sage: a
      p-adic automorphic form of cohomological weight 0

  Python

      >>> from sage.all import *
      >>> X = BruhatTitsQuotient(Integer(17),Integer(3))
      >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
      >>> h = H.an_element()
      >>> HH = X.padic_automorphic_forms(Integer(2),Integer(10))
      >>> a = HH(h)
      >>> a
      p-adic automorphic form of cohomological weight 0

  AUTHORS:

  - Cameron Franc (2012-02-20)

  - Marc Masdeu

  coleman(t1, t2, E=None, method='moments', mult=False)

    If `self` is a \(p\)-adic automorphic form that corresponds to a rigid modular form, then this computes the Coleman integral of this form between two points on the boundary \(P^1(\QQ_p)\) of the \(p\)-adic upper half plane.

    INPUT:

    - `t1`, `t2` – elements of \(P^1(\QQ_p)\) (the endpoints of integration)

    - `E` – (default: `None`) if specified, will not compute the covering adapted to `t1` and `t2` and instead use the given one. In that case, `E` should be a list of matrices corresponding to edges describing the open balls to be considered.

    - `method` – string (default: `'moments'`); tells which algorithm to use (alternative is `'riemann_sum'`, which is unsuitable for computations requiring high precision)

    - `mult` – boolean (default: `False`); whether to compute the multiplicative version

    OUTPUT: the result of the Coleman integral

    EXAMPLES:

    Sage

        sage: p = 7
        sage: lev = 2
        sage: prec = 10
        sage: X = BruhatTitsQuotient(p, lev)
        sage: k = 2
        sage: M = X.harmonic_cocycles(k, prec)
        sage: B = M.basis()
        sage: f = 3*B[0]
        sage: MM = X.padic_automorphic_forms(k, prec, overconvergent=True)
        sage: D = -11
        sage: X.is_admissible(D)
        True
        sage: K.<a> = QuadraticField(D)
        sage: Kp.<g> = Qq(p**2, prec)
        sage: P = Kp.gen()
        sage: Q = 2 + Kp.gen() + p*(Kp.gen()+1)
        sage: F = MM.lift(f)  # long time
        sage: J0 = F.coleman(P, Q, mult=True)  # long time

    Python

        >>> from sage.all import *
        >>> p = Integer(7)
        >>> lev = Integer(2)
        >>> prec = Integer(10)
        >>> X = BruhatTitsQuotient(p, lev)
        >>> k = Integer(2)
        >>> M = X.harmonic_cocycles(k, prec)
        >>> B = M.basis()
        >>> f = Integer(3)*B[Integer(0)]
        >>> MM = X.padic_automorphic_forms(k, prec, overconvergent=True)
        >>> D = -Integer(11)
        >>> X.is_admissible(D)
        True
        >>> K = QuadraticField(D, names=('a',)); (a,) = K._first_ngens(1)
        >>> Kp = Qq(p**Integer(2), prec, names=('g',)); (g,) = Kp._first_ngens(1)
        >>> P = Kp.gen()
        >>> Q = Integer(2) + Kp.gen() + p*(Kp.gen()+Integer(1))
        >>> F = MM.lift(f)  # long time
        >>> J0 = F.coleman(P, Q, mult=True)  # long time

    AUTHORS:

    - Cameron Franc (2012-02-20)

    - Marc Masdeu (2012-02-20)

  derivative(z=None, level=0, method='moments', order=1)

    Return the derivative of the modular form corresponding to `self`.

    INPUT:

    - `z` – (default: `None`) if specified, evaluates the derivative at the point `z` in the \(p\)-adic upper half plane

    - `level` – integer (default: 0); if `method` is ‘riemann_sum’, will use a covering of \(P^1(\QQ_p)\) with balls of size \(p^-\mbox{level}\).

    - `method` – string (default: `'moments'`); it must be either `'moments'` or `'riemann_sum'`

    - `order` – integer (default: 1); the order of the derivative to be computed

    OUTPUT:

    A function from the \(p\)-adic upper half plane to \(\CC_p\). If an argument `z` was passed, returns instead the value of the derivative at that point.

    EXAMPLES:

    Integrating the Poisson kernel against a measure yields a value of the associated modular form. Such values can be computed efficiently using the overconvergent method, as long as one starts with an ordinary form:

    Sage

        sage: X = BruhatTitsQuotient(7, 2)
        sage: X.genus()
        1

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(7), Integer(2))
        >>> X.genus()
        1

    Since the genus is 1, the space of weight 2 forms is 1 dimensional. Hence any nonzero form will be a \(U_7\) eigenvector. By Jacquet-Langlands and Cerednik-Drinfeld, in this case the Hecke eigenvalues correspond to that of any nonzero form on \(\Gamma_0(14)\) of weight \(2\). Such a form is ordinary at \(7\), and so we can apply the overconvergent method directly to this form without \(p\)-stabilizing:

    Sage

        sage: H = X.harmonic_cocycles(2,prec=5)
        sage: h = H.gen(0)
        sage: A = X.padic_automorphic_forms(2,prec=5,overconvergent=True)
        sage: f0 = A.lift(h)

    [Python]

        >>> from sage.all import *
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(5))
        >>> h = H.gen(Integer(0))
        >>> A = X.padic_automorphic_forms(Integer(2),prec=Integer(5),overconvergent=True)
        >>> f0 = A.lift(h)

    Now that we’ve lifted our harmonic cocycle to an overconvergent automorphic form, we extract the associated modular form as a function and test the modular property:

    Sage

        sage: T.<x> = Qq(49,prec=10)
        sage: f = f0.modular_form()
        sage: g = X.get_embedding_matrix()*X.get_units_of_order()[1]
        sage: a,b,c,d = g.change_ring(T).list()
        sage: (c*x +d)^2*f(x)-f((a*x + b)/(c*x + d))
        O(7^5)

    Python

        >>> from sage.all import *
        >>> T = Qq(Integer(49),prec=Integer(10), names=('x',)); (x,) = T._first_ngens(1)
        >>> f = f0.modular_form()
        >>> g = X.get_embedding_matrix()*X.get_units_of_order()[Integer(1)]
        >>> a,b,c,d = g.change_ring(T).list()
        >>> (c*x +d)**Integer(2)*f(x)-f((a*x + b)/(c*x + d))
        O(7^5)

    We can also compute the Shimura-Maass derivative, which is a nearly rigid analytic modular forms of weight 4:

    Sage

        sage: f = f0.derivative()
        sage: (c*x + d)^4*f(x)-f((a*x + b)/(c*x + d))
        O(7^5)

    [Python]

        >>> from sage.all import *
        >>> f = f0.derivative()
        >>> (c*x + d)**Integer(4)*f(x)-f((a*x + b)/(c*x + d))
        O(7^5)

  evaluate(e1)

    Evaluate a \(p\)-adic automorphic form on a matrix in \(GL_2(\QQ_p)\).

    INPUT:

    - `e1` – a matrix in \(GL_2(\QQ_p)\)

    OUTPUT: the value of `self` evaluated on `e1`

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(7,5)
        sage: M = X.harmonic_cocycles(2,prec=5)
        sage: A = X.padic_automorphic_forms(2,prec=5)
        sage: a = A(M.basis()[0])
        sage: a.evaluate(Matrix(ZZ,2,2,[1,2,3,1]))
        4 + 6*7 + 6*7^2 + 6*7^3 + 6*7^4 + O(7^5)
        sage: a.evaluate(Matrix(ZZ,2,2,[17,0,0,1]))
        1 + O(7^5)

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(7),Integer(5))
        >>> M = X.harmonic_cocycles(Integer(2),prec=Integer(5))
        >>> A = X.padic_automorphic_forms(Integer(2),prec=Integer(5))
        >>> a = A(M.basis()[Integer(0)])
        >>> a.evaluate(Matrix(ZZ,Integer(2),Integer(2),[Integer(1),Integer(2),Integer(3),Integer(1)]))
        4 + 6*7 + 6*7^2 + 6*7^3 + 6*7^4 + O(7^5)
        >>> a.evaluate(Matrix(ZZ,Integer(2),Integer(2),[Integer(17),Integer(0),Integer(0),Integer(1)]))
        1 + O(7^5)

  integrate(f, center=1, level=0, method='moments')

    Calculate

    \[\int_{\mathbf{P}^1(\QQ_p)} f(x)d\mu(x)\]

    were \(\mu\) is the measure associated to `self`.

    INPUT:

    - `f` – an analytic function

    - `center` – 2x2 matrix over \(\QQ_p\) (default: 1)

    - `level` – integer (default: 0)

    - `method` – string (default: `'moments'`); which method of integration to use. Either `'moments'` or `'riemann_sum'`.

    EXAMPLES:

    Integrating the Poisson kernel against a measure yields a value of the associated modular form. Such values can be computed efficiently using the overconvergent method, as long as one starts with an ordinary form:

    Sage

        sage: X = BruhatTitsQuotient(7,2)
        sage: X.genus()
        1

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(7),Integer(2))
        >>> X.genus()
        1

    Since the genus is 1, the space of weight 2 forms is 1 dimensional. Hence any nonzero form will be a \(U_7\) eigenvector. By Jacquet-Langlands and Cerednik-Drinfeld, in this case the Hecke eigenvalues correspond to that of any nonzero form on \(\Gamma_0(14)\) of weight \(2\). Such a form is ordinary at \(7\), and so we can apply the overconvergent method directly to this form without \(p\)-stabilizing:

    Sage

        sage: H = X.harmonic_cocycles(2,prec = 5)
        sage: h = H.gen(0)
        sage: A = X.padic_automorphic_forms(2,prec = 5,overconvergent=True)
        sage: a = A.lift(h)
        sage: a._value[0].moment(2)
        2 + 6*7 + 4*7^2 + 4*7^3 + 6*7^4 + O(7^5)

    [Python]

        >>> from sage.all import *
        >>> H = X.harmonic_cocycles(Integer(2),prec = Integer(5))
        >>> h = H.gen(Integer(0))
        >>> A = X.padic_automorphic_forms(Integer(2),prec = Integer(5),overconvergent=True)
        >>> a = A.lift(h)
        >>> a._value[Integer(0)].moment(Integer(2))
        2 + 6*7 + 4*7^2 + 4*7^3 + 6*7^4 + O(7^5)

    Now that we’ve lifted our harmonic cocycle to an overconvergent automorphic form we simply need to define the Teitelbaum-Poisson Kernel, and then integrate:

    Sage

        sage: Kp.<x> = Qq(49,prec = 5)
        sage: z = Kp['z'].gen()
        sage: f = 1/(z-x)
        sage: a.integrate(f)
        (5*x + 5) + (4*x + 4)*7 + (5*x + 5)*7^2 + (5*x + 6)*7^3 + O(7^5)

    Python

        >>> from sage.all import *
        >>> Kp = Qq(Integer(49),prec = Integer(5), names=('x',)); (x,) = Kp._first_ngens(1)
        >>> z = Kp['z'].gen()
        >>> f = Integer(1)/(z-x)
        >>> a.integrate(f)
        (5*x + 5) + (4*x + 4)*7 + (5*x + 5)*7^2 + (5*x + 6)*7^3 + O(7^5)

    AUTHORS:

    - Cameron Franc (2012-02-20)

    - Marc Masdeu (2012-02-20)

  modular_form(z=None, level=0, method='moments')

    Return the modular form corresponding to `self`.

    INPUT:

    - `z` – (default: `None`) if specified, returns the value of the form at the point `z` in the \(p\)-adic upper half plane

    - `level` – integer (default: 0); if `method` is ‘riemann_sum’, will use a covering of \(P^1(\QQ_p)\) with balls of size \(p^-\mbox{level}\)

    - `method` – string (default: `'moments'`); it must be either `'moments'` or `'riemann_sum'`

    OUTPUT:

    A function from the \(p\)-adic upper half plane to \(\CC_p\). If an argument `z` was passed, returns instead the value at that point.

    EXAMPLES:

    Integrating the Poisson kernel against a measure yields a value of the associated modular form. Such values can be computed efficiently using the overconvergent method, as long as one starts with an ordinary form:

    Sage

        sage: X = BruhatTitsQuotient(7, 2)
        sage: X.genus()
        1

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(7), Integer(2))
        >>> X.genus()
        1

    Since the genus is 1, the space of weight 2 forms is 1 dimensional. Hence any nonzero form will be a \(U_7\) eigenvector. By Jacquet-Langlands and Cerednik-Drinfeld, in this case the Hecke eigenvalues correspond to that of any nonzero form on \(\Gamma_0(14)\) of weight \(2\). Such a form is ordinary at \(7\), and so we can apply the overconvergent method directly to this form without \(p\)-stabilizing:

    Sage

        sage: H = X.harmonic_cocycles(2,prec = 5)
        sage: A = X.padic_automorphic_forms(2,prec = 5,overconvergent=True)
        sage: f0 = A.lift(H.basis()[0])

    [Python]

        >>> from sage.all import *
        >>> H = X.harmonic_cocycles(Integer(2),prec = Integer(5))
        >>> A = X.padic_automorphic_forms(Integer(2),prec = Integer(5),overconvergent=True)
        >>> f0 = A.lift(H.basis()[Integer(0)])

    Now that we’ve lifted our harmonic cocycle to an overconvergent automorphic form, we extract the associated modular form as a function and test the modular property:

    Sage

        sage: T.<x> = Qq(7^2,prec = 5)
        sage: f = f0.modular_form(method = 'moments')
        sage: a,b,c,d = X.embed_quaternion(X.get_units_of_order()[1]).change_ring(T.base_ring()).list()
        sage: ((c*x + d)^2*f(x)-f((a*x + b)/(c*x + d))).valuation()
        5

    Python

        >>> from sage.all import *
        >>> T = Qq(Integer(7)**Integer(2),prec = Integer(5), names=('x',)); (x,) = T._first_ngens(1)
        >>> f = f0.modular_form(method = 'moments')
        >>> a,b,c,d = X.embed_quaternion(X.get_units_of_order()[Integer(1)]).change_ring(T.base_ring()).list()
        >>> ((c*x + d)**Integer(2)*f(x)-f((a*x + b)/(c*x + d))).valuation()
        5

  valuation()

    The valuation of `self`, defined as the minimum of the valuations of the values that it takes on a set of edge representatives.

    OUTPUT: integer

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(17,3)
        sage: M = X.harmonic_cocycles(2,prec=10)
        sage: A = X.padic_automorphic_forms(2,prec=10)
        sage: a = A(M.gen(0))
        sage: a.valuation()
        0
        sage: (17*a).valuation()
        1

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(17),Integer(3))
        >>> M = X.harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> A = X.padic_automorphic_forms(Integer(2),prec=Integer(10))
        >>> a = A(M.gen(Integer(0)))
        >>> a.valuation()
        0
        >>> (Integer(17)*a).valuation()
        1

class sage.modular.btquotients.pautomorphicform.pAdicAutomorphicForms(domain, U, prec=None, t=None, R=None, overconvergent=False)

  Bases: `Module`, `UniqueRepresentation`

  Create a space of \(p\)-automorphic forms.

  EXAMPLES:

  Sage

      sage: X = BruhatTitsQuotient(11,5)
      sage: H = X.harmonic_cocycles(2,prec=10)
      sage: A = X.padic_automorphic_forms(2,prec=10)
      sage: TestSuite(A).run()

  Python

      >>> from sage.all import *
      >>> X = BruhatTitsQuotient(Integer(11),Integer(5))
      >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
      >>> A = X.padic_automorphic_forms(Integer(2),prec=Integer(10))
      >>> TestSuite(A).run()

  Element

    alias of `pAdicAutomorphicFormElement`

  lift(f)

    Lift the harmonic cocycle `f` to a p-automorphic form.

    If one is using overconvergent coefficients, then this will compute all of the moments of the measure associated to `f`.

    INPUT:

    - `f` – a harmonic cocycle

    OUTPUT: a \(p\)-adic automorphic form

    EXAMPLES:

    If one does not work with an overconvergent form then lift does nothing:

    Sage

        sage: X = BruhatTitsQuotient(13,5)
        sage: H = X.harmonic_cocycles(2,prec=10)
        sage: h = H.gen(0)
        sage: A = X.padic_automorphic_forms(2,prec=10)
        sage: A.lift(h) # long time
        p-adic automorphic form of cohomological weight 0

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(13),Integer(5))
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(10))
        >>> h = H.gen(Integer(0))
        >>> A = X.padic_automorphic_forms(Integer(2),prec=Integer(10))
        >>> A.lift(h) # long time
        p-adic automorphic form of cohomological weight 0

    With overconvergent forms, the input is lifted naively and its moments are computed:

    Sage

        sage: X = BruhatTitsQuotient(13,11)
        sage: H = X.harmonic_cocycles(2,prec=5)
        sage: A2 = X.padic_automorphic_forms(2,prec=5,overconvergent=True)
        sage: a = H.gen(0)
        sage: A2.lift(a) # long time
        p-adic automorphic form of cohomological weight 0

    [Python]

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(13),Integer(11))
        >>> H = X.harmonic_cocycles(Integer(2),prec=Integer(5))
        >>> A2 = X.padic_automorphic_forms(Integer(2),prec=Integer(5),overconvergent=True)
        >>> a = H.gen(Integer(0))
        >>> A2.lift(a) # long time
        p-adic automorphic form of cohomological weight 0

  precision_cap()

    Return the precision of `self`.

    OUTPUT: integer

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(13,11)
        sage: A = X.padic_automorphic_forms(2,prec=10)
        sage: A.precision_cap()
        10

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(13),Integer(11))
        >>> A = X.padic_automorphic_forms(Integer(2),prec=Integer(10))
        >>> A.precision_cap()
        10

  prime()

    Return the underlying prime.

    OUTPUT: `p` – prime integer

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(11,5)
        sage: H = X.harmonic_cocycles(2,prec = 10)
        sage: A = X.padic_automorphic_forms(2,prec = 10)
        sage: A.prime()
        11

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(11),Integer(5))
        >>> H = X.harmonic_cocycles(Integer(2),prec = Integer(10))
        >>> A = X.padic_automorphic_forms(Integer(2),prec = Integer(10))
        >>> A.prime()
        11

  zero()

    Return the zero element of `self`.

    EXAMPLES:

    Sage

        sage: X = BruhatTitsQuotient(5, 7)
        sage: H1 = X.padic_automorphic_forms( 2, prec=10)
        sage: H1.zero() == 0
        True

    Python

        >>> from sage.all import *
        >>> X = BruhatTitsQuotient(Integer(5), Integer(7))
        >>> H1 = X.padic_automorphic_forms( Integer(2), prec=Integer(10))
        >>> H1.zero() == Integer(0)
        True