Opened 6 years ago
Closed 6 years ago
#21517 closed defect (fixed)
Log of integer to base 1/n can have exact numeric results
Reported by:  Ralf Stephan  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, GitHub, GitLab)  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 6 years ago by
Branch:  → u/rws/log_of_integer_to_base_1_n_can_have_exact_numeric_results 

comment:2 Changed 6 years ago by
Authors:  → Ralf Stephan 

Commit:  → 0ae5fd8ffaff03cf83217a68b2247b1556a934c2 
Status:  new → needs_review 
comment:3 Changed 6 years ago by
Commit:  0ae5fd8ffaff03cf83217a68b2247b1556a934c2 → de1acfad2c24ba8c587eeb84cdba0d88579c614a 

comment:4 Changed 6 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 6 years ago by
Reviewers:  → Travis Scrimshaw 

comment:6 Changed 6 years ago by
Commit:  de1acfad2c24ba8c587eeb84cdba0d88579c614a → 4aba8a99c827b6ca3088c5703a98bb0b0c1271e9 

Branch pushed to git repo; I updated commit sha1. New commits:
4aba8a9  21517: avoid duplicate computations

comment:8 Changed 6 years ago by
Branch:  u/rws/log_of_integer_to_base_1_n_can_have_exact_numeric_results → 4aba8a99c827b6ca3088c5703a98bb0b0c1271e9 

Resolution:  → fixed 
Status:  positive_review → 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)