Open fingolfin opened 3 years ago
Same problem as #228 (and others): there is a suboptimal cutoff between the expansion at zero and the asymptotic expansion at infinity.
Honestly, I think you will end up implementing the Laplace integral for U(z) when z is too small for the reciprocal transform, but not so small that the asymptotic series can be usefully truncated.
This example now works for Bessel K thanks to falling back to numerical integration:
10 1e-26
20 1.137e-26
30 1.136873e-26
40 1.136872868e-26
50 1.136872868128e-26
60 1.136872868128307e-26
70 1.136872868128306888e-26
80 1.136872868128306888444e-26
90 1.136872868128306888443826e-26
100 1.136872868128306888443825590e-26
110 1.136872868128306888443825589950e-26
120 1.136872868128306888443825589950094e-26
130 1.136872868128306888443825589950094325e-26
140 1.136872868128306888443825589950094324651e-26
150 1.13687286812830688844382558995009432465094e-26
160 1.136872868128306888443825589950094324650935557e-26
170 1.136872868128306888443825589950094324650935557413e-26
180 1.136872868128306888443825589950094324650935557413225e-26
190 1.136872868128306888443825589950094324650935557413224860e-26
200 1.136872868128306888443825589950094324650935557413224859798e-26
210 1.136872868128306888443825589950094324650935557413224859797745e-26
220 1.136872868128306888443825589950094324650935557413224859797744589e-26
230 1.136872868128306888443825589950094324650935557413224859797744589545e-26
240 1.136872868128306888443825589950094324650935557413224859797744589544662e-26
250 1.136872868128306888443825589950094324650935557413224859797744589544661843e-26
The general problem is far from solved though (other Bessel functions; nonreal arguments).
On https://github.com/Nemocas/Nemo.jl/issues/954 there is a report for some loss/reset of precision in the
besselk
,bessely
andbesselj
(whilebesseli
seems to be unaffected).In short,
besselk(2.0, 57.9668555791947111700112064539202300037282162)
is evaluated for various precisions; notice the jump from precision 110 to 120:Further examples for
bessely
andbesselj
can be found at the Nemo issue I linked above.