Namespaces
Variants

std:: sph_neumann, std:: sph_neumannf, std:: sph_neumannl

From cppreference.net
定义于头文件 <cmath>
(1)
float sph_neumann ( unsigned n, float x ) ;

double sph_neumann ( unsigned n, double x ) ;

long double sph_neumann ( unsigned n, long double x ) ;
(C++17 起)
(C++23 前)
/* 浮点类型 */ sph_neumann ( unsigned n,
/* 浮点类型 */ x ) ;
(C++23 起)
float sph_neumannf ( unsigned n, float x ) ;
(2) (C++17 起)
long double sph_neumannl ( unsigned n, long double x ) ;
(3) (C++17 起)
定义于头文件 <cmath>
template < class Integer >
double sph_neumann ( unsigned n, Integer x ) ;
(A) (C++17 起)
1-3) 计算第二类球贝塞尔函数(亦称球诺依曼函数),参数为 n x 标准库为所有 cv 未限定浮点类型提供了 std::sph_neumann 的重载版本,作为参数 x 的类型。 (C++23 起)
A) 为所有整数类型提供了额外的重载,这些类型将被视为 double

目录

参数

n - 函数的阶数
x - 函数的参数

返回值

若无错误发生,则返回第二类球贝塞尔函数(球诺依曼函数)的值,参数为 n x ,即 n n (x) = (π/2x) 1/2
N n+1/2 (x)
,其中 N n (x) std:: cyl_neumann ( n, x ) x≥0

错误处理

错误报告方式遵循 math_errhandling 规范

  • 若参数为 NaN,则返回 NaN 且不报告定义域错误
  • n≥128 ,行为由实现定义

注释

不支持 C++17 但支持 ISO 29124:2010 的实现,若实现将 __STDCPP_MATH_SPEC_FUNCS__ 定义为至少 201003L 的值,且用户在包含任何标准库头文件之前定义了 __STDCPP_WANT_MATH_SPEC_FUNCS__ ,则会提供此函数。

不支持 ISO 29124:2010 但支持 TR 19768:2007 (TR1) 的实现,会在头文件 tr1/cmath 和命名空间 std::tr1 中提供此函数。

该函数的实现也可在 boost.math 中找到。

额外的重载并不需要完全按照 (A) 的形式提供。只需确保对于整数类型的实参 num std :: sph_neumann ( int_num, num ) 能够产生与 std :: sph_neumann ( int_num, static_cast < double > ( num ) ) 相同的效果即可。

示例

#include <cmath>
#include <iostream>
int main()
{
    // 对 n == 1 的抽样检验
    double x = 1.2345;
    std::cout << "n_1(" << x << ") = " << std::sph_neumann(1, x) << '\n';
    // n_1 的精确解
    std::cout << "-cos(x)/x² - sin(x)/x = "
              << -std::cos(x) / (x * x) - std::sin(x) / x << '\n';
}

输出:

n_1(1.2345) = -0.981201
-cos(x)/x² - sin(x)/x = -0.981201

参见

柱面诺依曼函数
(函数)
(C++17) (C++17) (C++17)
球面贝塞尔函数(第一类)
(函数)

外部链接

Weisstein, Eric W. "Spherical Bessel Function of the Second Kind." 出自 MathWorld —— 一个 Wolfram 网络资源。