Opened 3 years ago
Closed 3 years ago
#21517 closed defect (fixed)
Log of integer to base 1/n can have exact numeric results
Reported by:  rws  Owned by:  

Priority:  major  Milestone:  sage7.4 
Component:  numerical  Keywords:  
Cc:  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  4aba8a9 (Commits)  Commit:  4aba8a99c827b6ca3088c5703a98bb0b0c1271e9 
Dependencies:  Stopgaps: 
Description
Log of integer to base 1/n can have nonsymbolic results but this is not recognized in Integer::log()
:
sage: ZZ(8).log(1/2) log(8)/log(1/2)
nor in Integer.exact_log()
:
sage: ZZ(8).exact_log(1/2) ... TypeError: no conversion of this rational to integer
Change History (8)
comment:1 Changed 3 years ago by
 Branch set to u/rws/log_of_integer_to_base_1_n_can_have_exact_numeric_results
comment:2 Changed 3 years ago by
 Commit set to 0ae5fd8ffaff03cf83217a68b2247b1556a934c2
 Status changed from new to needs_review
comment:3 Changed 3 years ago by
 Commit changed from 0ae5fd8ffaff03cf83217a68b2247b1556a934c2 to de1acfad2c24ba8c587eeb84cdba0d88579c614a
comment:4 Changed 3 years ago by
I would avoid doing the exact_log
twice:
if type(m) == Integer and type(self) == Integer: elog = self.exact_log(m): if m**elog == self: return elog
Similarly for the other one. Otherwise LGTM.
comment:5 Changed 3 years ago by
 Reviewers set to Travis Scrimshaw
comment:6 Changed 3 years ago by
 Commit changed from de1acfad2c24ba8c587eeb84cdba0d88579c614a to 4aba8a99c827b6ca3088c5703a98bb0b0c1271e9
Branch pushed to git repo; I updated commit sha1. New commits:
4aba8a9  21517: avoid duplicate computations

comment:8 Changed 3 years ago by
 Branch changed from u/rws/log_of_integer_to_base_1_n_can_have_exact_numeric_results to 4aba8a99c827b6ca3088c5703a98bb0b0c1271e9
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Branch pushed to git repo; I updated commit sha1. New commits:
21517: handle ZZ.log(1/n)