First time here? Check out the FAQ!

Ask Your Question
3

Power Series Ring over p-adics: TypeError: unhashable

asked 3 years ago

Alboin.matt@gmail.com gravatar image

I'm trying to construct a power series with coefficients in an Eisenstein extension of Qq, the unramified extension of the p-adic rationals. The following code works when a=1, but when a=2, I get the error: "TypeError: unhashable type: 'sage.rings.padics.qadic_flint_CR.qAdicCappedRelativeElement'".

p = 3
a = 2

ZZq.<xi> = Qq(p^a)
R.<x_pi> = ZZq[]
Zpi.<pi> = QuotientRing(R, R.ideal(x_pi^(p-1)+p))
L.<x> = PowerSeriesRing(Zpi)

Does anyone know a way to fix this for a>1?

Thank you!

Preview: (hide)

3 Answers

Sort by » oldest newest most voted
2

answered 3 years ago

saraedum gravatar image

In this case there is a specialized type for this p-adic base field which is called a "relative extension" in SageMath, i.e., an Eisenstein extension put on top of an unramified extension:

sage: K.<u> = Qq(3^2)
sage: R.<x> = K[]
sage: L.<pi> = R.extension(x^2 - 3)
sage: R.<x> =  L[[]]
sage: R
Power Series Ring in x over 3-adic Eisenstein Extension Field in w defined by x^2 + 3 over its base field

When you used QuotientRing, it only gives you the formal quotient but does not understand enough about the underlying structure, e.g., that this is a field (which I suspect is because the base ring is not exact.) In any case, the above construction might also not prove too useful. It's tricky to get the interplay between the non-exact p-adic base and the non-exact power series ring right and SageMath is (last time I checked) not particularly good about it; but it depends a lot on your application. I don't know what's your application, but sometimes one can replace the base ring by an exact ring, e.g., a Henselization or some other number field based approach.

PS: If you want to discuss your application, some of the people who care about p-adics in SageMath are meeting most Thursdays at 11pm CET at https://sagemath.zulipchat.com/#narro....

Preview: (hide)
link
1

answered 3 years ago

caruso gravatar image

Depending on what you want to do, you can maybe also consider using the constructor TateAlgebra (it is not exactly the same than power series but much effort is done to handle precision correctly):

sage: K.<u> = Qq(3^2)
sage: L.<pi> = K.extension(x^2 - 3)
sage: L                                                                         
3-adic Eisenstein Extension Field in pi defined by x^2 - 3 over its base field
sage: A.<x> = TateAlgebra(L)
sage: (1 - pi*x).inverse_of_unit()
(1 + O(pi^40)) + (pi + O(pi^40))*x + ... + O(pi^40 * <x>)
Preview: (hide)
link
0

answered 3 years ago

vdelecroix gravatar image

(Not a solution). The problem comes from the fact that sage is not able to derive enough information on Zpi

sage: ZZq.<xi> = Qq(3^1)
sage: R.<x_pi> = ZZq[]
sage: Zpi.<pi> = QuotientRing(R, R.ideal(x_pi^(p-1)+p))
sage: print(Zpi.is_field())
True
sage: ZZq.<xi> = Qq(3^2)
sage: R.<x_pi> = ZZq[]
sage: Zpi.<pi> = QuotientRing(R, R.ideal(x_pi^(p-1)+p))
sage: print(Zpi.is_field())
Traceback (most recent call last):
...
NotImplementedError
Preview: (hide)
link

Comments

Do you know if there's a way I can supply sage with more information? In particular, how would I make it hashable by implementing _cache_key()?

Alboin.matt@gmail.com gravatar imageAlboin.matt@gmail.com ( 3 years ago )

Implementing _cache_key does not help here unfortunately. polynomial_ring_constructor.py uses an (old?) cache that does not know about the _cache_key machinery. If you can use ZqFM instead of QqFM, then the elements become hashable and your example works.

saraedum gravatar imagesaraedum ( 3 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 3 years ago

Seen: 433 times

Last updated: Apr 14 '21