Path: blob/master/src/sage/modular/overconvergent/weightspace.py
8820 views
# -*- coding: utf-8 -*-1r"""2The space of `p`-adic weights34A `p`-adic weight is a continuous character `\ZZ_p^\times \to5\CC_p^\times`. These are the `\CC_p`-points of a rigid space over6`\QQ_p`, which is isomorphic to a disjoint union of copies (indexed by7`(\ZZ/p\ZZ)^\times`) of the open unit `p`-adic disc.89Sage supports both "classical points", which are determined by the data of a10Dirichlet character modulo `p^m` for some `m` and an integer `k` (corresponding11to the character `z \mapsto z^k \chi(z)`) and "non-classical points" which are12determined by the data of an element of `(\ZZ/p\ZZ)^\times` and13an element `w \in \CC_p` with `|w - 1| < 1`.1415EXAMPLES::1617sage: W = pAdicWeightSpace(17)18sage: W19Space of 17-adic weight-characters defined over '17-adic Field with capped relative precision 20'20sage: R.<x> = QQ[]21sage: L = Qp(17).extension(x^2 - 17, names='a'); L.rename('L')22sage: W.base_extend(L)23Space of 17-adic weight-characters defined over 'L'2425We create a simple element of `\mathcal{W}`: the algebraic character, `x \mapsto x^6`::2627sage: kappa = W(6)28sage: kappa(5)291562530sage: kappa(5) == 5^631True3233A locally algebraic character, `x \mapsto x^6 \chi(x)` for `\chi` a Dirichlet34character mod `p`::3536sage: kappa2 = W(6, DirichletGroup(17, Qp(17)).0^8)37sage: kappa2(5) == -5^638True39sage: kappa2(13) == 13^640True4142A non-locally-algebraic character, sending the generator 18 of `1 + 1743\ZZ_{17}` to 35 and acting as `\mu \mapsto \mu^4` on the group of 16th44roots of unity::4546sage: kappa3 = W(35 + O(17^20), 4, algebraic=False)47sage: kappa3(2)4816 + 8*17 + ... + O(17^20)4950AUTHORS:5152- David Loeffler (2008-9)53"""5455#*****************************************************************************56# Copyright (C) 2008 William Stein <[email protected]>57# 2008-9 David Loeffler <[email protected]>58#59# Distributed under the terms of the GNU General Public License (GPL)60# http://www.gnu.org/licenses/61#*****************************************************************************6263from sage.structure.parent_base import ParentWithBase64from sage.structure.element import Element65from sage.modular.dirichlet import DirichletGroup, trivial_character66from sage.rings.all import ZZ, QQ, divisors, IntegerModRing, Qp, Infinity67from sage.rings.padics.padic_generic_element import pAdicGenericElement68from sage.misc.misc import verbose69from sage.misc.cachefunc import cached_method70from sage.rings.padics.precision_error import PrecisionError71import weakref7273_wscache = {}74def WeightSpace_constructor(p, base_ring=None):75r"""76Construct the p-adic weight space for the given prime p. A `p`-adic weight77is a continuous character `\ZZ_p^\times \to \CC_p^\times`.78These are the `\CC_p`-points of a rigid space over `\QQ_p`,79which is isomorphic to a disjoint union of copies (indexed by80`(\ZZ/p\ZZ)^\times`) of the open unit `p`-adic disc.8182Note that the "base ring" of a `p`-adic weight is the smallest ring83containing the image of `\ZZ`; in particular, although the default base84ring is `\QQ_p`, base ring `\QQ` will also work.8586EXAMPLES::8788sage: pAdicWeightSpace(3) # indirect doctest89Space of 3-adic weight-characters defined over '3-adic Field with capped relative precision 20'90sage: pAdicWeightSpace(3, QQ)91Space of 3-adic weight-characters defined over 'Rational Field'92sage: pAdicWeightSpace(10)93Traceback (most recent call last):94...95ValueError: p must be prime96"""97if base_ring is None:98base_ring = Qp(p)99if _wscache.has_key((p, base_ring)):100m = _wscache[(p, base_ring)]()101if m is not None:102return m103m = WeightSpace_class(p, base_ring)104_wscache[(p, base_ring)] = weakref.ref(m)105return m106107class WeightSpace_class(ParentWithBase):108r"""109The space of `p`-adic weight-characters `\mathcal{W} = {\rm110Hom}(\ZZ_p^\times, \CC_p^\times)`. This isomorphic to a111disjoint union of `(p-1)` open discs of radius 1 (or 2 such discs if `p =1122`), with the parameter on the open disc corresponding to the image of `1 +113p` (or 5 if `p = 2`)114115TESTS::116117sage: W = pAdicWeightSpace(3)118sage: W is loads(dumps(W))119True120"""121122def __init__(self, p, base_ring):123r"""124Initialisation function.125126EXAMPLE::127128sage: pAdicWeightSpace(17)129Space of 17-adic weight-characters defined over '17-adic Field with capped relative precision 20'130"""131ParentWithBase.__init__(self, base=base_ring)132p = ZZ(p)133if not p.is_prime():134raise ValueError, "p must be prime"135self._p = p136self._param = Qp(p)((p == 2 and 5) or (p + 1))137138def _repr_(self):139r"""140String representation of self.141142EXAMPLE::143144sage: pAdicWeightSpace(17)._repr_()145"Space of 17-adic weight-characters defined over '17-adic Field with capped relative precision 20'"146"""147return "Space of %s-adic weight-characters defined over '%s'" % (self.prime(), self.base_ring())148149def __reduce__(self):150r"""151Used for pickling.152153EXAMPLE::154155sage: pAdicWeightSpace(3).__reduce__()156(<function WeightSpace_constructor at ...>, (3, 3-adic Field with capped relative precision 20))157"""158return (WeightSpace_constructor, (self.prime(), self.base_ring()))159160def __call__(self, arg1, arg2 = None, algebraic=True):161r"""162Create an element of this space.163164If ``algebraic = True`` (the default), create a locally algebraic165character. The arguments should be `(k, \chi)` with `k \in \ZZ`166and `\chi` a Dirichlet character of `p`-power conductor defined over a167`p`-adic field; this corresponds to the weight-character `x \mapsto x^k168\chi(x)`. If `\chi` is omitted, it defaults to the trivial character.169170If ``algebraic = False``, create a general character. The arguments are171now (t, w) where `t \in \ZZ/(p-1)\ZZ` and `w \in172\CC_p` with `|w - 1| < 1`. This corresponds to the character173`\kappa` satisfying `\kappa(\mu) = \mu^t` where `\mu` is a `(p-1)`-st174root of unity, and `\kappa(1 + p) = w`.175176EXAMPLES::177178sage: W = pAdicWeightSpace(17)179sage: W(4)1804181sage: W(4, DirichletGroup(17, Qp(17)).0)182(4, 17, [3 + 13*17 + ... + O(17^20)])183sage: W(1 + O(17^5), 4, algebraic = False)184[1 + O(17^5), 4]185"""186187if isinstance(arg1, WeightCharacter):188if arg1.parent() is self:189return arg1190elif arg1.parent().prime() == self.prime():191return self._coerce_in_wtchar(arg1)192else:193raise TypeError, "Incompatible type!"194195if algebraic:196return AlgebraicWeight(self, arg1, arg2)197else:198return ArbitraryWeight(self, arg1, arg2)199200@cached_method201def zero_element(self):202"""203Return the zero of this weight space.204205EXAMPLES::206207sage: W = pAdicWeightSpace(17)208sage: W.zero_element()2090210"""211return self(0)212213def prime(self):214r"""215Return the prime `p` such that this is a `p`-adic weight space.216217EXAMPLE::218219sage: pAdicWeightSpace(17).prime()22017221"""222return self._p223224def base_extend(self, R):225r"""226Extend scalars to the ring R. There must be a canonical coercion map227from the present base ring to R.228229EXAMPLE::230231sage: W = pAdicWeightSpace(3, QQ)232sage: W.base_extend(Qp(3))233Space of 3-adic weight-characters defined over '3-adic Field with capped relative precision 20'234sage: W.base_extend(IntegerModRing(12))235Traceback (most recent call last):236...237TypeError: No coercion map from 'Rational Field' to 'Ring of integers modulo 12' is defined238"""239if R.has_coerce_map_from(self.base_ring()):240return WeightSpace_constructor(self.prime(), R)241else:242raise TypeError, "No coercion map from '%s' to '%s' is defined" % (self.base_ring(), R)243244def _coerce_impl(self, x):245r"""246Canonical coercion of x into self.247248TESTS::249250sage: W1 = pAdicWeightSpace(23, QQ)251sage: W2 = W1.base_extend(Qp(23))252sage: w = W1(3)253sage: W2.coerce(w) # indirect doctest2543255"""256if isinstance(x, WeightCharacter) \257and x.parent().prime() == self.prime() \258and self.base_ring().has_coerce_map_from(x.base_ring()):259return self._coerce_in_wtchar(x)260raise TypeError261262def _coerce_in_wtchar(self, x):263r"""264Convert in a weight-character whose parent is different from self (with265has the prime, but possibly different base ring).266267EXAMPLE::268269sage: W1 = pAdicWeightSpace(23, Qp(3))270sage: W2 = pAdicWeightSpace(23, QQ)271sage: w = W1(3)272sage: W2._coerce_in_wtchar(w)2733274"""275if isinstance(x, AlgebraicWeight):276return AlgebraicWeight(self, x.k(), x.chi().change_ring(self.base_ring()))277else:278return ArbitraryWeight(self, self.base_ring()(x.w()), x.teichmuller_type())279280class WeightCharacter(Element):281r"""282Abstract base class representing an element of the p-adic weight space283`Hom(\ZZ_p^\times, \CC_p^\times)`.284"""285286# This should probably derive from Morphism or even from287# AbelianGroupMorphism; but Sage doesn't know about the abelian group288# Z_p^*, so Hom(Z_p^*, C_p^*) is a bit beyond it!289290def __init__(self, parent):291r"""292Initialisation function.293294EXAMPLE::295296sage: pAdicWeightSpace(17)(0)2970298"""299300Element.__init__(self, parent)301self._p = self.parent().prime()302303def base_extend(self, R):304r"""305Extend scalars to the base ring R (which must have a canonical map from306the current base ring)307308EXAMPLE::309310sage: w = pAdicWeightSpace(17, QQ)(3)311sage: w.base_extend(Qp(17))3123313"""314return self.parent().base_extend(R).coerce(self)315316def is_even(self):317r"""318Return True if this weight-character sends -1 to +1.319320EXAMPLE::321322sage: pAdicWeightSpace(17)(0).is_even()323True324sage: pAdicWeightSpace(17)(11).is_even()325False326sage: pAdicWeightSpace(17)(1 + 17 + O(17^20), 3, False).is_even()327False328sage: pAdicWeightSpace(17)(1 + 17 + O(17^20), 4, False).is_even()329True330"""331if self(-1) == -1:332return False333else:334return True335336def pAdicEisensteinSeries(self, ring, prec=20):337r"""338Calculate the q-expansion of the p-adic Eisenstein series of given339weight-character, normalised so the constant term is 1.340341EXAMPLE::342343sage: kappa = pAdicWeightSpace(3)(3, DirichletGroup(3,QQ).0)344sage: kappa.pAdicEisensteinSeries(QQ[['q']], 20)3451 - 9*q + 27*q^2 - 9*q^3 - 117*q^4 + 216*q^5 + 27*q^6 - 450*q^7 + 459*q^8 - 9*q^9 - 648*q^10 + 1080*q^11 - 117*q^12 - 1530*q^13 + 1350*q^14 + 216*q^15 - 1845*q^16 + 2592*q^17 + 27*q^18 - 3258*q^19 + O(q^20)346"""347if not self.is_even():348raise ValueError, "Eisenstein series not defined for odd weight-characters"349q = ring.gen()350s = ring(1) + 2*self.one_over_Lvalue() * sum([sum([self(d)/d for d in divisors(n)]) * q**n for n in xrange(1, prec)])351return s.add_bigoh(prec)352353def values_on_gens(self):354r"""355If `\kappa` is this character, calculate the values `(\kappa(r), t)`356where `r` is `1 + p` (or 5 if `p = 2`) and `t` is the unique element of357`\ZZ/(p-1)\ZZ` such that `\kappa(\mu) = \mu^t` for `\mu`358a (p-1)st root of unity. (If `p = 2`, we take `t` to be 0 or 1359according to whether `\kappa` is odd or even.) These two values360uniquely determine the character `\kappa`.361362EXAMPLES::363364sage: W=pAdicWeightSpace(11); W(2).values_on_gens()365(1 + 2*11 + 11^2 + O(11^20), 2)366sage: W(2, DirichletGroup(11, QQ).0).values_on_gens()367(1 + 2*11 + 11^2 + O(11^20), 7)368sage: W(1 + 2*11 + O(11^5), 4, algebraic = False).values_on_gens()369(1 + 2*11 + O(11^5), 4)370"""371372return ( self(self.parent()._param), self.teichmuller_type())373374def is_trivial(self):375r"""376Return True if and only if this is the trivial character.377378EXAMPLES::379380sage: pAdicWeightSpace(11)(2).is_trivial()381False382sage: pAdicWeightSpace(11)(2, DirichletGroup(11, QQ).0).is_trivial()383False384sage: pAdicWeightSpace(11)(0).is_trivial()385True386"""387if self.values_on_gens() == (1, 0):388return True389else:390return False391392def __cmp__(self, other):393r"""394Compare self to other.395396EXAMPLES::397398sage: W=pAdicWeightSpace(11)399sage: W(2) == W(3)400False401sage: W(2, DirichletGroup(11, QQ).0) == W(2)402False403sage: W(2, DirichletGroup(11, QQ).0) == W(144 + O(11^20), 7, False)404True405"""406if not isinstance(other, WeightCharacter):407return cmp(type(self), type(other))408else:409return cmp(self.values_on_gens(), other.values_on_gens())410411def Lvalue(self):412r"""413Return the value of the p-adic L-function of `\QQ`, which can be414regarded as a rigid-analytic function on weight space, evaluated at415this character.416417EXAMPLES::418419sage: W = pAdicWeightSpace(11)420sage: sage.modular.overconvergent.weightspace.WeightCharacter(W).Lvalue()421Traceback (most recent call last):422...423NotImplementedError424"""425raise NotImplementedError426427def one_over_Lvalue(self):428r"""429Return the reciprocal of the p-adic L-function evaluated at this430weight-character. If the weight-character is odd, then the L-function431is zero, so an error will be raised.432433EXAMPLES::434435sage: pAdicWeightSpace(11)(4).one_over_Lvalue()436-12/133437sage: pAdicWeightSpace(11)(3, DirichletGroup(11, QQ).0).one_over_Lvalue()438-1/6439sage: pAdicWeightSpace(11)(3).one_over_Lvalue()440Traceback (most recent call last):441...442ZeroDivisionError: Rational division by zero443sage: pAdicWeightSpace(11)(0).one_over_Lvalue()4440445sage: type(_)446<type 'sage.rings.integer.Integer'>447"""448if self.is_trivial():449return ZZ(0)450else:451return 1/self.Lvalue()452453class AlgebraicWeight(WeightCharacter):454r"""455A point in weight space corresponding to a locally algebraic character, of456the form `x \mapsto \chi(x) x^k` where `k` is an integer and `\chi` is a457Dirichlet character modulo `p^n` for some `n`.458459TESTS::460461sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, QQ).0) # exact462sage: w == loads(dumps(w))463True464sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, Qp(23)).0) # inexact465sage: w == loads(dumps(w))466True467sage: w is loads(dumps(w)) # elements are not globally unique468False469"""470471def __init__(self, parent, k, chi=None):472r"""473Create a locally algebraic weight-character.474475EXAMPLES::476477sage: pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0)478(13, 29, [2 + 2*29 + ... + O(29^20)])479"""480WeightCharacter.__init__(self, parent)481k = ZZ(k)482self._k = k483if chi is None:484chi = trivial_character(self._p, QQ)485n = ZZ(chi.conductor())486if n == 1:487n = self._p488if not n.is_power_of(self._p):489raise ValueError, "Character must have %s-power conductor" % p490self._chi = DirichletGroup(n, chi.base_ring())(chi)491492def __call__(self, x):493r"""494Evaluate this character at an element of `\ZZ_p^\times`.495496EXAMPLES:497498Exact answers are returned when this is possible::499500sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, QQ).0)501sage: kappa(1)5021503sage: kappa(0)5040505sage: kappa(12)506-106993205379072507sage: kappa(-1)508-1509sage: kappa(13 + 4*29 + 11*29^2 + O(29^3))5109 + 21*29 + 27*29^2 + O(29^3)511512When the character chi is defined over a p-adic field, the results returned are inexact::513514sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14)515sage: kappa(1)5161 + O(29^20)517sage: kappa(0)5180519sage: kappa(12)52017 + 11*29 + 7*29^2 + 4*29^3 + 5*29^4 + 2*29^5 + 13*29^6 + 3*29^7 + 18*29^8 + 21*29^9 + 28*29^10 + 28*29^11 + 28*29^12 + 28*29^13 + 28*29^14 + 28*29^15 + 28*29^16 + 28*29^17 + 28*29^18 + 28*29^19 + O(29^20)521sage: kappa(12) == -106993205379072522True523sage: kappa(-1) == -1524True525sage: kappa(13 + 4*29 + 11*29^2 + O(29^3))5269 + 21*29 + 27*29^2 + O(29^3)527"""528if isinstance(x, pAdicGenericElement):529if x.parent().prime() != self._p:530raise TypeError, "x must be an integer or a %s-adic integer" % self._p531if self._p**(x.precision_absolute()) < self._chi.conductor():532raise PrecisionError("Precision too low")533xint = x.lift()534else:535xint = x536if (xint % self._p == 0): return 0537return self._chi(xint) * x**self._k538539def k(self):540r"""541If this character is `x \mapsto x^k \chi(x)` for an integer `k` and a542Dirichlet character `\chi`, return `k`.543544EXAMPLE::545546sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14)547sage: kappa.k()54813549"""550return self._k551552def chi(self):553r"""554If this character is `x \mapsto x^k \chi(x)` for an integer `k` and a555Dirichlet character `\chi`, return `\chi`.556557EXAMPLE::558559sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14)560sage: kappa.chi()561Dirichlet character modulo 29 of conductor 29 mapping 2 |--> 28 + 28*29 + 28*29^2 + ... + O(29^20)562"""563return self._chi564565def _repr_(self):566r"""567String representation of self.568569EXAMPLES::570571sage: pAdicWeightSpace(17)(2)._repr_()572'2'573sage: pAdicWeightSpace(17)(2, DirichletGroup(17, QQ).0)._repr_()574'(2, 17, [-1])'575sage: pAdicWeightSpace(17)(2, DirichletGroup(17, QQ).0^2)._repr_()576'2'577"""578if self._chi.is_trivial():579return "%s" % self._k580else:581return "(%s, %s, %s)" % (self._k, self._chi.modulus(), self._chi._repr_short_())582583def teichmuller_type(self):584r"""585Return the Teichmuller type of this weight-character `\kappa`, which is586the unique `t \in \ZZ/(p-1)\ZZ` such that `\kappa(\mu) =587\mu^t` for \mu a `(p-1)`-st root of 1.588589For `p = 2` this doesn't make sense, but we still want the Teichmuller590type to correspond to the index of the component of weight space in591which `\kappa` lies, so we return 1 if `\kappa` is odd and 0 otherwise.592593EXAMPLE::594595sage: pAdicWeightSpace(11)(2, DirichletGroup(11,QQ).0).teichmuller_type()5967597sage: pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0).teichmuller_type()59814599sage: pAdicWeightSpace(2)(3, DirichletGroup(4,QQ).0).teichmuller_type()6000601"""602# Special case p == 2603if self._p == 2:604if self.is_even():605return IntegerModRing(2)(0)606else:607return IntegerModRing(2)(1)608m = IntegerModRing(self._p).multiplicative_generator()609x = [y for y in IntegerModRing(self._chi.modulus()) if y == m and y**(self._p - 1) == 1]610if len(x) != 1: raise ArithmeticError611x = x[0]612f = IntegerModRing(self._p)(self._chi(x)).log(m)613return IntegerModRing(self._p - 1)(self._k + f)614615def Lvalue(self):616r"""617Return the value of the p-adic L-function of `\QQ` evaluated at618this weight-character. If the character is `x \mapsto x^k \chi(x)`619where `k > 0` and `\chi` has conductor a power of `p`, this is an620element of the number field generated by the values of `\chi`, equal to621the value of the complex L-function `L(1-k, \chi)`. If `\chi` is622trivial, it is equal to `(1 - p^{k-1})\zeta(1-k)`.623624At present this is not implemented in any other cases, except the625trivial character (for which the value is `\infty`).626627TODO: Implement this more generally using the Amice transform machinery628in sage/schemes/elliptic_curves/padic_lseries.py, which should clearly629be factored out into a separate class.630631EXAMPLES::632633sage: pAdicWeightSpace(7)(4).Lvalue() == (1 - 7^3)*zeta__exact(-3)634True635sage: pAdicWeightSpace(7)(5, DirichletGroup(7, Qp(7)).0^4).Lvalue()6360637sage: pAdicWeightSpace(7)(6, DirichletGroup(7, Qp(7)).0^4).Lvalue()6381 + 2*7 + 7^2 + 3*7^3 + 3*7^5 + 4*7^6 + 2*7^7 + 5*7^8 + 2*7^9 + 3*7^10 + 6*7^11 + 2*7^12 + 3*7^13 + 5*7^14 + 6*7^15 + 5*7^16 + 3*7^17 + 6*7^18 + O(7^19)639"""640if self._k > 0:641return -self._chi.bernoulli(self._k)/self._k642if self.is_trivial():643return Infinity644else:645raise NotImplementedError, "Don't know how to compute value of this L-function"646647class ArbitraryWeight(WeightCharacter):648649def __init__(self, parent, w, t):650r"""651Create the element of p-adic weight space in the given component652mapping 1 + p to w. Here w must be an element of a p-adic field, with653finite precision.654655EXAMPLE::656657sage: pAdicWeightSpace(17)(1 + 17^2 + O(17^3), 11, False)658[1 + 17^2 + O(17^3), 11]659"""660WeightCharacter.__init__(self, parent)661662self.t = ZZ(t) % (self._p > 2 and (self._p - 1) or 2)663# do we store w precisely?664if (w - 1).valuation() <= 0:665raise ValueError, "Must send generator to something nearer 1"666self.w = w667668def _repr_(self):669r"""String representation of this character.670671EXAMPLES::672673sage: pAdicWeightSpace(97)(1 + 2*97 + O(97^20), 12, False)._repr_()674'[1 + 2*97 + O(97^20), 12]'675"""676return "[%s, %s]" % (self.w, self.t)677678def __call__(self, x):679r"""680Evaluate this character at an element of `\ZZ_p^\times`.681682EXAMPLES::683684sage: kappa = pAdicWeightSpace(23)(1 + 23^2 + O(23^20), 4, False)685sage: kappa(2)68616 + 7*23 + 7*23^2 + 16*23^3 + 23^4 + 20*23^5 + 15*23^7 + 11*23^8 + 12*23^9 + 8*23^10 + 22*23^11 + 16*23^12 + 13*23^13 + 4*23^14 + 19*23^15 + 6*23^16 + 7*23^17 + 11*23^19 + O(23^20)687sage: kappa(-1)6881 + O(23^20)689sage: kappa(23)6900691sage: kappa(2 + 2*23 + 11*23^2 + O(23^3))69216 + 7*23 + O(23^3)693"""694695if not isinstance(x, pAdicGenericElement):696x = Qp(self._p)(x)697if x.valuation() != 0:698return 0699700teich = x.parent().teichmuller(x)701xx = x / teich702if (xx - 1).valuation() <= 0:703raise ArithmeticError704verbose("Normalised element is %s" % xx)705706e = xx.log() / self.parent()._param.log()707verbose("Exponent is %s" % e)708709return teich**(self.t) * (self.w.log() * e).exp()710711def teichmuller_type(self):712r"""713Return the Teichmuller type of this weight-character `\kappa`, which is714the unique `t \in \ZZ/(p-1)\ZZ` such that `\kappa(\mu) =715\mu^t` for \mu a `(p-1)`-st root of 1.716717For `p = 2` this doesn't make sense, but we still want the Teichmuller718type to correspond to the index of the component of weight space in719which `\kappa` lies, so we return 1 if `\kappa` is odd and 0 otherwise.720721EXAMPLES::722723sage: pAdicWeightSpace(17)(1 + 3*17 + 2*17^2 + O(17^3), 8, False).teichmuller_type()7248725sage: pAdicWeightSpace(2)(1 + 2 + O(2^2), 1, False).teichmuller_type()7261727"""728return self.t729730731732