Opened 10 years ago

Closed 10 years ago

#11873 closed defect (fixed)

Cannot compute p-adic absolute value of zero

Reported by: jdemeyer Owned by: roed
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 jdemeyer 10 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Priority changed from major to minor
  • Status changed from new to needs_review

comment:2 follow-up: Changed 10 years ago by 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)

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 10 years ago by jdemeyer

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 10 years ago by jdemeyer

comment:4 Changed 10 years ago by mstreng

  • Reviewers set to Marco Streng
  • Status changed from needs_review to positive_review

comment:5 Changed 10 years ago by jdemeyer

  • Merged in set to sage-4.7.2.alpha4
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.