增强zeta功能

时间:2013-07-21 11:10:13

标签: function math boost

我尝试使用boost库中的zeta函数:

double dz1 = boost::math::zeta<double> (1.0);

当我运行程序时,我得到了:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::domain_error> >'
what():  Error in function boost::math::zeta<e>: Evaluation of zeta function at pole 1
Aborted (core dumped)'

有人知道发生了什么事吗?

1 个答案:

答案 0 :(得分:3)

黎曼zeta函数是一个无限的总和:

enter image description here

只有当参数的实部更多时才收敛,然后1.如果它等于1,则系列发散并且总和给出无穷大。

因此,当您使用1.0调用该函数时,库会引发错误。

有用的链接:

http://en.wikipedia.org/wiki/Riemann_zeta_function

http://www.boost.org/doc/libs/1_38_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/zetas/zeta.html