Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log of integer to base 1/n can have exact numeric results #21517

Closed
rwst opened this issue Sep 17, 2016 · 11 comments
Closed

Log of integer to base 1/n can have exact numeric results #21517

rwst opened this issue Sep 17, 2016 · 11 comments

Comments

@rwst
Copy link

rwst commented Sep 17, 2016

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

Component: numerical

Author: Ralf Stephan

Branch/Commit: 4aba8a9

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/21517

@rwst rwst added this to the sage-7.4 milestone Sep 17, 2016
@rwst
Copy link
Author

rwst commented Sep 21, 2016

@rwst
Copy link
Author

rwst commented Sep 21, 2016

Author: Ralf Stephan

@rwst
Copy link
Author

rwst commented Sep 21, 2016

Commit: 0ae5fd8

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 22, 2016

Changed commit from 0ae5fd8 to de1acfa

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 22, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

de1acfa21517: handle ZZ.log(1/n)

@tscrim
Copy link
Collaborator

tscrim commented Sep 22, 2016

comment:4

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.

@tscrim
Copy link
Collaborator

tscrim commented Sep 22, 2016

Reviewer: Travis Scrimshaw

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 22, 2016

Changed commit from de1acfa to 4aba8a9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 22, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

4aba8a921517: avoid duplicate computations

@rwst
Copy link
Author

rwst commented Sep 22, 2016

comment:7

Thanks.

@vbraun
Copy link
Member

vbraun commented Oct 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants