名稱空間
變體
操作

std::sph_bessel, std::sph_besself, std::sph_bessell

來自 cppreference.com
< cpp‎ | 數值‎ | 特殊函式
 
 
 
 
定義於標頭檔案 <cmath>
(1)
float       sph_bessel ( unsigned int n, float x );

double      sph_bessel ( unsigned int n, double x );

long double sph_bessel ( unsigned int n, long double x );
(C++17 起)
(直至 C++23)
/*floating-point-type*/ sph_bessel( unsigned int n,
                                      /*floating-point-type*/ x );
(C++23 起)
float       sph_besself( unsigned int n, float x );
(2) (C++17 起)
long double sph_bessell( unsigned int n, long double x );
(3) (C++17 起)
定義於標頭檔案 <cmath>
template< class Integer >
double      sph_bessel ( unsigned int n, Integer x );
(A) (C++17 起)
1-3) 計算 nx第一類球貝塞爾函式 庫為所有 cv 非限定浮點型別提供了 std::sph_bessel 的過載,作為引數 x 的型別。(C++23 起)
A) 為所有整數型別提供了額外的過載,它們被視為 double

目錄

[編輯] 引數

n - 函式的階數
x - 函式的自變數

[編輯] 返回值

若無錯誤發生,返回 nx 的第一類球貝塞爾函式的值,即 jn(x) = (π/2x)1/2
Jn+1/2(x)
,其中 Jn(x)std::cyl_bessel_j(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) 提供。它們只需足以確保對於整數型別的引數 numstd::sph_bessel(int_num, num)std::sph_bessel(int_num, static_cast<double>(num)) 具有相同的效果。

[編輯] 示例

#include <cmath>
#include <iostream>
 
int main()
{
    // spot check for n == 1
    double x = 1.2345;
    std::cout << "j_1(" << x << ") = " << std::sph_bessel(1, x) << '\n';
 
    // exact solution for j_1
    std::cout << "sin(x)/x² - cos(x)/x = "
              << std::sin(x) / (x * x) - std::cos(x) / x << '\n';
}

輸出

j_1(1.2345) = 0.352106
sin(x)/x² - cos(x)/x = 0.352106

[編輯] 亦見

柱貝塞爾函式(第一類)
(函式) [編輯]
球諾依曼函式
(函式) [編輯]

[編輯] 外部連結

Weisstein, Eric W. "Spherical Bessel Function of the First Kind." From MathWorld — A Wolfram Web Resource.