Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/145.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 大变量高阶贝塞尔函数计算_C++_Matlab_Gsl_Bessel Functions - Fatal编程技术网

C++ 大变量高阶贝塞尔函数计算

C++ 大变量高阶贝塞尔函数计算,c++,matlab,gsl,bessel-functions,C++,Matlab,Gsl,Bessel Functions,我的工作涉及在大变量值下计算高阶贝塞尔函数。在MATLAB中,这是毫无问题的。然而,为了扩大问题,我已经调整了用MPI编写C++代码。当然,生成贝塞尔函数的步骤是通过调用一些库来完成的。为了把这个问题具体化,让我考虑这个非常具体的错误。 在matlab中,假设我希望计算$J_46341(86840.0)$,并且 matlab给了我:besselj(4634186840)=0.00130989622292 但是,下面是一个简单的测试示例 gsl_sf_bessel_Jn_e返回“错误:NaN” 我

我的工作涉及在大变量值下计算高阶贝塞尔函数。在MATLAB中,这是毫无问题的。然而,为了扩大问题,我已经调整了用MPI编写C++代码。当然,生成贝塞尔函数的步骤是通过调用一些库来完成的。为了把这个问题具体化,让我考虑这个非常具体的错误。 在matlab中,假设我希望计算$J_46341(86840.0)$,并且

matlab给了我:besselj(4634186840)=0.00130989622292

但是,下面是一个简单的测试示例

gsl_sf_bessel_Jn_e返回“错误:NaN”

我已经检查了46340订单,matlab和gsl都返回相同的答案0.00292895,在可接受的精度范围内。GSL中的一个步骤会导致NaN错误,而matlab仍然保留了一个很好的精确数值答案

我确实尝试使用递归关系来生成高阶值,从一个不太小的阶数,比如从20000阶或更高阶数,但是,这只会延迟NaN错误,而不会完全解决问题

将注意力转移到其他可用的软件库上,我尝试了NAG,但令我彻底失望的是


nag_bessel_j_alpha(s18ekc)的abs约束(nl)问题已解决。感谢你们的社区工作,你们的知识和贡献真的让我惊讶

请看这里,

MATLAB、R、Python和JuliaLang/openspecfun均基于Donald E.Amos博士(sandia国家实验室)的原始fortran源代码,引用论文:

D. E. Amos, "A subroutine package for Bessel functions of a complex
argument and nonnegative order", Sandia National Laboratory Report,
SAND85-1018, May, 1985.
D. E. Amos, "A portable package for Bessel functions of a complex
argument and nonnegative order", Trans. Math. Software, 1986.
现在被称为Amos算法644,由ACM收集

http://dl.acm.org/citation.cfm?id=212078
http://dl.acm.org/citation.cfm?id=1268783
http://dl.acm.org/citation.cfm?id=98299
但是,netlib上托管的源代码并非没有bug,可能不是最新的

http://netlib.sandia.gov/master/index.html
http://netlib.sandia.gov/amos/
虽然openspecfun采用的版本运行稳定

https://github.com/JuliaLang/openspecfun

为什么不自己计算这个函数呢?使用贝塞尔函数的递归关系对我来说没有任何帮助。事实上,与使用GSL库例程相比,随着订单的增加,它的分解速度要快得多。@macduf您肯定不是指手工操作。