Opened 11 years ago

Closed 11 years ago

#11873 closed defect (fixed)

Cannot compute p-adic absolute value of zero

Reported by: Jeroen Demeyer Owned by: David Roe
Priority: minor Milestone: sage-4.7.2
Component: padics Keywords:
Cc: Merged in: sage-4.7.2.alpha4
Authors: Jeroen Demeyer Reviewers: Marco Streng
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

sage: Qp(7)(0).abs()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)

/usr/local/src/sage-4.7.2.alpha2/<ipython console> in <module>()

/usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-packages/sage/rings/padics/padic_base_generic_element.so in sage.rings.padics.padic_base_generic_element.pAdicBaseGenericElement.abs (sage/rings/padics/padic_base_generic_element.c:2727)()

/usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-packages/sage/rings/padics/padic_base_generic_element.so in sage.rings.padics.padic_base_generic_element.pAdicBaseGenericElement.abs (sage/rings/padics/padic_base_generic_element.c:2580)()

/usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-packages/sage/rings/integer.so in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:12552)()

/usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.RingElement.__pow__ (sage/structure/element.c:12576)()

/usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.generic_power_c (sage/structure/element.c:22607)()

NotImplementedError: non-integral exponents not supported

Attachments (1)

11873.patch (4.8 KB) - added by Jeroen Demeyer 11 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 11 years ago by Jeroen Demeyer

Authors: Jeroen Demeyer
Priority: majorminor
Status: newneeds_review

comment:2 Changed 11 years ago by Marco Streng

sage: L.<a> = Qp(5).ext(x^2-5)
sage: L(5).abs()
0.200000000000000
sage: L(5).abs(prec=100)
0.20000000000000000000000000000
sage: L(5).abs(prec=0)
1/25
sage: L(5).abs(prec=False)
1/25

(yes, I deliberately tried to break it because I didn't understand the code at first)

Also: (why) is the code for pAdicExtElement a copy of the code for pAdicGenericElement? Why not remove the abs function for extension elements and move its examples to the generic one?

comment:3 in reply to:  2 Changed 11 years ago by Jeroen Demeyer

Replying to mstreng:

sage: L.<a> = Qp(5).ext(x^2-5)
sage: L(5).abs()
0.200000000000000
sage: L(5).abs(prec=100)
0.20000000000000000000000000000
sage: L(5).abs(prec=0)
1/25
sage: L(5).abs(prec=False)
1/25

(yes, I deliberately tried to break it because I didn't understand the code at first)

I changed if prec is None to if not prec. Do you prefer this?

Also: (why) is the code for pAdicExtElement a copy of the code for pAdicGenericElement? Why not remove the abs function for extension elements and move its examples to the generic one?

Done, moved all code to padic_generic_element.pyx

Changed 11 years ago by Jeroen Demeyer

Attachment: 11873.patch added

comment:4 Changed 11 years ago by Marco Streng

Reviewers: Marco Streng
Status: needs_reviewpositive_review

comment:5 Changed 11 years ago by Jeroen Demeyer

Merged in: sage-4.7.2.alpha4
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.