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

Add 1/e constant #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add 1/e constant #13

wants to merge 2 commits into from

Conversation

alyst
Copy link

@alyst alyst commented Jan 3, 2022

Adds inve = 1/e constant (cherry-picked from #12). Required by JuliaMath/SpecialFunctions.jl/issues/371

useful in many situations, also -exp(-1) is the branching point of
Lambert's W_0(t) and W_{-1}(t)
@coveralls
Copy link

coveralls commented Jan 3, 2022

Pull Request Test Coverage Report for Build 1649138962

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 1333249280: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

@devmotion
Copy link
Member

Required by JuliaMath/SpecialFunctions.jl/issues/371

It seems it's only used in the tests but not required by the implementation in the PR?

@alyst
Copy link
Author

alyst commented Jan 3, 2022

It seems it's only used in the tests but not required by the implementation in the PR?

I can make it required from the code too, because there it is used several times implicitly (as in the original version).
What I want to avoid is another round of discussions of whether "inve" required or not.
Just tell me whether you hesitate adding it.

@devmotion
Copy link
Member

I am not hesitant per se, I just want to understand the motivation for this PR so I can review it properly.

You provided one argument for adding it but at first glance it does not seem completely convincing since the constant is not used in the package but only in the tests. Maybe you can update the SpecialFunctions PR and show how it is useful for the actual implementation as well?

I would guess that often one could also just use eg. x / e instead of inve * x. I am away from a computer but maybe you can benchmark both approaches? And provide some other examples where the constant would be useful?

@alyst
Copy link
Author

alyst commented Jan 3, 2022

-1/e is a branching point of Lambert's W, so inve appears there "as is" several times, you can check my PR for lambertw. I think your suggestion to use x/e instead of x * inve, although it does not apply for lambertw, would lead to degraded performance. Especially for broadcasting (x .* inve). In general, I have thought that if invpi made it here, inve also deserves that.

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

Successfully merging this pull request may close these issues.

3 participants