JuliaMath / JuliaMath/Bessels.jl
Scope of Bessels.jl and inclusion of other special functions (e.g. gamma, airy, scorer)
- Dominant language
- Julia
- Stars
- 90
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
**EDIT: This issue started with discussion on the `gamma` implementation but has moved to discussing the scope of this package and inclusion of other special functions or splitting into smaller packages. Please leave comments on what functions you would like to be included here or if you would like smaller packages.**
SPLIT FROM https://github.com/heltonmc/Bessels.jl/pull/26#issuecomment-1200481143
A small note: I was perusing your `gamma` implementation and I think there are a couple small improvements that could be made, assuming they don't cost precision somehow. For one, if I change the `v = x^(0.5*x - 0.25)` to `v = exp((0.5*x-0.25)*log(x))` in `large_gamma`, I see a big speedup. And it doesn't seem like the `log` would make an issue, because you'll never hit that branch when `x` is zero.
Second, if there's a reason not to do that, then an intermediate method like this seems to be faster when `x > 11.5` but it isn't too too large:
```julia
function smallish_gamma(x)
_x = min(x, x-ceil(x-11.5))
_g = small_gamma(_x)
while _x < x # use the fact that gamma(x+1) == x*gamma(x)
_g *= _x
_x += one(_x)
end
_g
end
```
You could then branch on `x < 30.0` or something instead and at least hit the `large_gamma` branch less often.
I haven't checked very hard to see if these tricks introduce new issues, but I wouldn't think that they do.
_Originally posted by @cgeoga in https://github.com/heltonmc/Bessels.jl/issues/26#issuecomment-1200481143_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the implementations of large_gamma and small_gamma, then review the discussion about gamma, airy, scorer, and the package scope. A contribution would first need a decided scope, with precision and performance implications checked before any implementation work is considered complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100