Opened 11 years ago
Closed 5 years ago
#11228 closed defect (fixed)
integer_rational_power problems
Reported by:  gerbicz  Owned by:  AlexGhitza 

Priority:  major  Milestone:  sage7.4 
Component:  algebra  Keywords:  
Cc:  leif, darij, tscrim  Merged in:  
Authors:  Frédéric Chapoton  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  ff92822 (Commits, GitHub, GitLab)  Commit:  ff92822014f3efa9fc6518b44f20517179535088 
Dependencies:  Stopgaps: 
Description
The following answers are all wrongs/inconsistent with the documentation:
from sage.rings.rational import integer_rational_power print integer_rational_power(10, 1/1) print integer_rational_power(10, 2/2) print integer_rational_power(10, 4/2) print integer_rational_power(10, 6/3) print integer_rational_power(0, 0/1) print integer_rational_power(0, 1/2) print integer_rational_power(10, 0/1) sage gives: None None None None 0 0 1 From the first four examples it is clear that sage is unable to observe if b evaluate as an integer when compute a^b for negative "a" value. (the answers should be 10,10,100,100). The fifth example: as 0^0 is undefined it should return by None. The sixth example: 0^(1/2)=0 is correct but shows that the documentation is broken, because from it: "The positive real root is taken for even denominators.", here 2 is even, but the result 0 is not positive. The seventh example: 10^(0/1)=1 is correct, but from the documentation: "b  a positive Rational", so change the documentation or return by None.}}}
Change History (6)
comment:1 Changed 8 years ago by
 Status changed from new to needs_info
comment:2 Changed 5 years ago by
 Branch set to u/chapoton/11228
 Cc leif added
 Commit set to ff92822014f3efa9fc6518b44f20517179535088
 Milestone set to sage7.4
 Status changed from needs_info to needs_review
New commits:
ff92822  trac 11228 fine details in integer_rational_power

comment:4 Changed 5 years ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
muhahahaha
comment:5 Changed 5 years ago by
./sage Wunusedfunction
?
(If you want to have further fun, perhaps take a look at rational_power_parts()
in the same file, the only instance in the Sage library where integer_rational_power()
is used at all.)
comment:6 Changed 5 years ago by
 Branch changed from u/chapoton/11228 to ff92822014f3efa9fc6518b44f20517179535088
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Someone^{TM} should check what of the above still applies.