-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 exponential scaling support to Bessel function family #6665
Comments
I think this should be in Base. Matlab also makes it available as an option to the There is already |
Note that this is needed for |
The core Julia team have tried very hard to not introduce more function names, and these functions, while arguably important, would introduce a large number of one-off functions. I think we need a better nomenclature for these things. |
@jiahao, we could always use |
If these names are reasonably standard it could be ok to add them. |
@JeffBezanson, both R and MATLAB support scaling through optional arguments rather than separate function names. |
I would much prefer the |
Sounds good. |
Is it worth calling the argument "logscaled" yo make it perfectly clear? On Tuesday, April 29, 2014, Jeff Bezanson [email protected] wrote:
|
I don't think |
How about |
|
I'm unclear on how this scaling is done, which makes it hard to come up with an apt name. |
The scale factor is there to damp the exponentially growing asymptotics of the special function. See, for example, the comment in amos:besseli and compare that with the asymptotic formula from DLMF. Note that it isn't fully accounting for the zeroth order asymptotics, just the exponential part. |
Ok, well, then. I will leave it to those better informed on the subject than I am to pick a good keyword. |
besselj(nu, z, scaled=true) Or are there good reasons to make |
Yes. |
As noted in #4967, there is a substantial performance penalty to using keyword arguments. |
Speed is also my concern with keyword arguments. In the light of #4967, I would prefer Specifically, I suggest the following:
Up to the last point, this would roughly correspond to the current state of #6688, except that This has the following advantages:
Possible disadvantages:
Any thoughts or suggestions on the above? |
I have now updated #6688 according to the above suggestion. The scaled function versions are The The |
I'd rather have |
This is unfortunately not for me to decide. I will postpone any further changes of the code until the function signature has been decided upon. |
Yes, that seems better. If we eventually get faster keywords, we can deprecate there for the keyword version.
|
This is obviously not a high priority issue, but I would still like to make some progress towards finalizing the code. However, at this point I cannot make any further progress until the Julia developers have agreed on how the functions are supposed to be called. To summarize, the three main options seem to be besselj(nu, z, scaled::Bool = false)
besselj(nu, z; scaled::Bool = false)
besseljx(nu, z) where the first (positional argument) option seems to preferred due to
Option two (keyword argument)
The third option is preferred by @stevengj, and might be admissible if the function names were sufficiently standard (@JeffBezanson), which they unfortunately aren't. Which one shall it be? |
@jdrugo thank you for your patience working through this issue. It looks like @stevengj and @StefanKarpinski are both in agreement for option 3 as you've listed it up there. Until we get faster keyword arguments, I think we're just going to have to live with the suffixes on function names. |
@staticfloat OK, I have updated #6688 to use suffixes on function names. Again, I did not export |
Fix #6665: adding exp-scaled Bessel functions
Fix JuliaLang/julia#6665: adding exp-scaled Bessel functions
Fix JuliaLang/julia#6665: adding exp-scaled Bessel functions
Would the Julia development team consider supporting the option to return exponentially scaled versions of the Bessel function? This option already exists in the used Amos library through setting the KODE argument, but is currently not used in Julia.
Supporting this option would allow evaluating the Bessel function family for larger arguments, for which the standard return values would be out of bounds. This is, for example, useful for computing various properties of the von Mises distribution (see JuliaStats/Distributions.jl#223 ).
I could imagine it being either implemented as a flag to the Bessel functions, for example as
as in R, or by a set of separate methods
besseliscaled besselhscaled ...
I could provide the required code if you are happy with this request.
The text was updated successfully, but these errors were encountered: