how to cast finite field elements into p-adic ring

26 views
Skip to first unread message

dmharvey

unread,
Feb 2, 2010, 10:04:19 PM2/2/10
to sage-support
Hi,

After I create the residue field of a p-adic ring, how do I cast
elements of the field back into the ring? Any lift is fine. The
obvious thing doesn't work:

sage: R.<z> = Zq(9)
sage: F = R.residue_class_field()
sage: F
Finite Field in z0 of size 3^2
sage: a = F.gen()
sage: R(a)
---------------------------------------------------------------------------
TypeError

....

Also, is it possible to change the name of the generator of the
residue field?

david

Rado

unread,
Feb 3, 2010, 1:59:01 AM2/3/10
to sage-support
Something seems to be broken in extensions of p-adics. Here are two
examples:

sage: R.<z> = Zq(9)

sage: R.residue_system()

TypeError: cannot convert x to a p-adic element

and

sage: el=R.random_element()
sage: el.slice(el.valuation(),el.valuation()+1)

TypeError:
'sage.rings.padics.padic_ZZ_pX_CA_element.pAdicZZpXCAElement' object
cannot be interpreted as an index

Otherwise I saw there is a parameter res_name to be passed to
constructor:

sage: R.<z> = Zq(9,res_name=x)

but then x is not really bound to anything.

sage: x*3
3*x

Sorry, can't be of much help. Even this trick didn't work

sage: R2.<z> = Zq(9,1)
sage: R(z)
NotImplementedError: Conversion from different p-adic extensions not
yet supported

Rado

David Harvey

unread,
Feb 3, 2010, 8:29:39 AM2/3/10
to David Roe, William Stein, sage-s...@googlegroups.com

On Feb 3, 2010, at 1:22 AM, David Roe wrote:

> After I create the residue field of a p-adic ring, how do I cast
> elements of the field back into the ring? Any lift is fine. The
> obvious thing doesn't work:
>

> Sadly, residue fields for p-adic rings currently suck. My hope is
> that they'll be better in the not-so-distant future: one of the
> projects I'm currently taking a break from to work on my thesis is
> making finite fields better. I'll e-mail Martin about this and
> hopefully get this back on track.
>
> In the mean time, you can do the following (sorry for the clunkiness):
>
> sage: b = F.random_element()
> sage: sum([z^i*R.base_ring()(ZZ(b.polynomial()[i])) for i in range
> (b.polynomial().degree()+1)])

Heh, ok.

I'll file a ticket for this.

>
> Also, is it possible to change the name of the generator of the
> residue field?
>

> Yep.
> R.<a> = Zq(5^3, res_name='abar')
> This, along with a bunch of other printing options I suspect nobody
> uses, are documented in Zq??

ok.

> Please, keep sending these bugs and feature requests for p-adic
> extensions. I don't think the code has gotten much use, and I'd
> like to see actual use cases.

I plan to bash it pretty hard over the next few weeks (unless I give
up and switch to Magma ;-))

I already filed #8162 yesterday.

david

dmharvey

unread,
Feb 7, 2010, 2:01:14 PM2/7/10
to sage-support
> > Please, keep sending these bugs and feature requests for p-adic  
> > extensions.  I don't think the code has gotten much use, and I'd  
> > like to see actual use cases.

what about even just coercing from a p-adic field to its residue
field?

sage: R.<a> = Zq(9)
sage: K = R.residue_field()
sage: K(a)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)

/Volumes/secure/projects/zetasqrtp/<ipython console> in <module>()

/Users/david/sage-4.3.1/local/lib/python2.6/site-packages/sage/rings/
finite_field_givaro.so in
sage.rings.finite_field_givaro.FiniteField_givaro.__call__ (sage/rings/
finite_field_givaro.cpp:5285)()

TypeError: unable to coerce

!!!!!!!!

david

Reply all
Reply to author
Forward
0 new messages