Opened 10 years ago
Closed 10 years ago
#13639 closed defect (fixed)
Inverting 0 mod 1
Reported by: | jdemeyer | Owned by: | AlexGhitza |
---|---|---|---|
Priority: | minor | Milestone: | sage-5.5 |
Component: | basic arithmetic | Keywords: | |
Cc: | Merged in: | sage-5.5.beta1 | |
Authors: | Jeroen Demeyer | Reviewers: | Robert Bradshaw |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: ~Mod(0,1) --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) /usr/local/src/sage-5.4.rc1/<ipython console> in <module>() /usr/local/src/sage-5.4.rc1/local/lib/python2.7/site-packages/sage/rings/finite_rings/integer_mod.so in sage.rings.finite_rings.integer_mod.IntegerMod_int.__invert__ (sage/rings/finite_rings/integer_mod.c:22320)() ZeroDivisionError: Inverse does not exist.
But modulo 1, the inverse does exist. Note that gcd(0,1) == 1.
Attachments (1)
Change History (6)
Changed 10 years ago by
Attachment: | 13639_inverse_mod_1.patch added |
---|
comment:1 Changed 10 years ago by
Status: | new → needs_review |
---|
comment:2 follow-up: 4 Changed 10 years ago by
Status: | needs_review → positive_review |
---|
comment:3 Changed 10 years ago by
Reviewers: | → Robert Bradshaw |
---|
comment:4 Changed 10 years ago by
Replying to robertwb:
How did you run into this?
Quite naturally in fact. I needed some random numbers to create an exercise for students to solve which involved (amonst other things) inverting Mod(r,s)
. I wrote a loop to randomly generate some numbers, checking that gcd(r,s) == 1
.
comment:5 Changed 10 years ago by
Merged in: | → sage-5.5.beta1 |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
Note: See
TracTickets for help on using
tickets.
Looks good to me, nice cleanup too. How did you run into this?