Integration of Bessel functions in C++/Fortran [closed]

一世执手 提交于 2019-12-13 09:37:15

问题


How can I integrate an equation including bessel functions numerically from "0" to "infinity" in Fortran or/and C? I did in matlab, but it's not true for larger inputs and after a specific values , the bessel functions give completely wrong results(there is a restriction in Matlab)


回答1:


You can pretty much google and find lots of Bessel functions implemented in C already.

http://www.atnf.csiro.au/computing/software/gipsy/sub/bessel.c

http://jean-pierre.moreau.pagesperso-orange.fr/c_bessel.html

https://msdn.microsoft.com/en-us/library/h7zkk1bz.aspx

In the end, these use the built in types and will be limited to the ranges they can represent (just as MATLAB is). At best, expect 15 digits of precision using double precision floating point representation. So, for large numbers, they will appear to be rounded. eg. 1237846464123450000000000.00000

And, of course, others on Stack Overflow have looked into it.

C++ Bessel function for complex numbers




回答2:


There's a large number of analytic results for various integrals of the Bessel functions (see DLMF, Sect. 10.22), including definite integrals over precisely this range. You'd be much better off, and almost certainly faster and more accurate, trying hard to recast your expression into something that's integrable and using an exact result.



来源:https://stackoverflow.com/questions/29145922/integration-of-bessel-functions-in-c-fortran

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!