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

new recurrence relations for rational approximations based on inverse… #64

Merged
merged 1 commit into from
May 9, 2023

Conversation

MikaelSlevinsky
Copy link
Collaborator

… factorial series

  • add a warning to all rational algorithms if kmax is attained

  • change tolerance to 8eps because 8 is a power of two.

A simple benchmark: the 3F2 on the readme used to take 18 microseconds in double precision and 14 milliseconds in BigFloat:

julia> using HypergeometricFunctions, BenchmarkTools
[ Info: Precompiling HypergeometricFunctions [34004b35-14d8-5ef3-9330-4cdb6864b03a]

julia> α = (1, 2+im, 2.5)
(1, 2 + 1im, 2.5)

julia> β = (3.5, 4)
(3.5, 4)

julia> z = exp(im*π/3)
0.5000000000000001 + 0.8660254037844386im

julia> @btime pFq($α, $β, $z)
  17.868 μs (14 allocations: 2.23 KiB)
0.8434434031615785 + 0.34175507615462697im

julia> z = exp(im*big(π)/3)
0.5000000000000000000000000000000000000000000000000000000000000000000000000000086 + 0.8660254037844386467637231707529361834714026269051903140279034897259665084543988im

julia> @btime pFq($α, $β, $z)
  14.245 ms (583770 allocations: 31.17 MiB)
0.8434434031615690763389963048175253868863156451003855955719081209861492349279575 + 0.3417550761546319732614495656712509723030350666571102474299311122586948108418733im

After merging this pull request, it will take only 4.2 microseconds in double precision and 5.2 milliseconds in BigFloat and is a couple digits more accurate:

julia> using HypergeometricFunctions, BenchmarkTools
[ Info: Precompiling HypergeometricFunctions [34004b35-14d8-5ef3-9330-4cdb6864b03a]

julia> α = (1, 2+im, 2.5)
(1, 2 + 1im, 2.5)

julia> β = (3.5, 4)
(3.5, 4)

julia> z = exp(im*π/3)
0.5000000000000001 + 0.8660254037844386im

julia> @btime pFq($α, $β, $z)
  4.266 μs (5 allocations: 832 bytes)
0.843443403161569 + 0.3417550761546328im

julia> z = exp(im*big(π)/3)
0.5000000000000000000000000000000000000000000000000000000000000000000000000000086 + 0.8660254037844386467637231707529361834714026269051903140279034897259665084543988im

julia> @btime pFq($α, $β, $z)
  5.231 ms (184913 allocations: 9.87 MiB)
0.8434434031615690763389963048175253868863156451003855955719081209861492349265671 + 0.3417550761546319732614495656712509723030350666571102474299311122586948108410529im

… factorial series

- add a warning to all rational algorithms if kmax is attained

- change tolerance to 8eps because 8 is a power of two
@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

Patch coverage: 69.06% and project coverage change: -2.25 ⚠️

Comparison is base (7e82207) 73.35% compared to head (c5c7ef2) 71.10%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #64      +/-   ##
==========================================
- Coverage   73.35%   71.10%   -2.25%     
==========================================
  Files           7        7              
  Lines        1246     1194      -52     
==========================================
- Hits          914      849      -65     
- Misses        332      345      +13     
Impacted Files Coverage Δ
src/drummond.jl 72.10% <36.84%> (+0.37%) ⬆️
src/specialfunctions.jl 54.72% <38.70%> (-1.53%) ⬇️
src/weniger.jl 96.94% <100.00%> (-0.67%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@MikaelSlevinsky MikaelSlevinsky merged commit ad1bbff into master May 9, 2023
@MikaelSlevinsky MikaelSlevinsky deleted the feat-updated-weniger-recurrence branch May 9, 2023 19:43
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.

1 participant