Bugfix/fix asymptotic bessel
Makes the following corrections to multiprecision bessel function implementation:
- Include second series scaling with exp(-z) in asymptotic calculation of I
- Correct normalization of besinorm
- Make precision-dependent condition for selecting Taylor series or asymptotic approximation for I and K
The first change is the only one to affect the rest of the IW2D-scripts in their current form, as the normalized K and I are not used, and precision is hard coded. The first change is particularly important for small Re(z). All changes are based on the work of Amos: AMOS, D. E, Computation of Bessel functions of complex argument. SAND83-0086, Sandia National Laboratories, Albuquerque, N.M. (May 1983).
Merge request reports
Activity
requested review from @nimounet
assigned to @esvik
assigned to @nimounet
Here are a sample of files showing the output of the bessel function before and after the fix. Each plot is at an fixed angle in the complex plane. The switch from Taylor expansion to asymptotic happens at |z|=60. Most important to note regarding this merge request is the pi=0.50 / pi=0.49 cases, where the large error before the fix has been fixed after.
Edited by Eskil VikHere are the results of running roundchamber.cc before and after the fix, for one finite dielectric layer. This case has been implemented as a test case. Note that the figure showing relative diffrence is only plotted from the region where there actually is a diffrence. For most frequencies, the results before and after the fix are identical.
Edited by Eskil Vik- Resolved by Nicolas Mounet
- Resolved by Nicolas Mounet
- Resolved by Nicolas Mounet
mentioned in issue #2
mentioned in commit dbd892f6