• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <cmath>

    std::sph_bessel

    namespace std {
      double
        sph_bessel(unsigned int n,
                   double x);              // (1) C++17
      floating-point-type
        sph_bessel(unsigned int n,
                   floating-point-type x); // (1) C++23
    
      Promoted
        sph_bessel(unsigned int n,
                   Arithmetic x);          // (2) C++17
    
      float
        sph_besself(unsigned int n,
                    float x);              // (3) C++17
    
      long double
        sph_bessell(unsigned int n,
                    long double x);        // (4) C++17
    }
    

    概要

    第1種球ベッセル関数 (spherical Bessel functions of the first kind) を求める。

    戻り値

    引数 n, x の第1種球ベッセル関数 $$ j_n(x) = \sqrt{\frac{\pi}{2x}} J_{n + 1/2}(x) \quad \text{for } x \ge 0 $$ を返す。 $J$ は第1種ベッセル関数 (cyl_bessel_j)。

    備考

    #include <cmath>
    #include <iostream>
    
    constexpr double pi = 3.141592653589793;
    
    void p(unsigned n) {
      for (double r : {0., 0.25, 0.5})
        std::cout << "sph_bessel(" << n << ", " << r << " pi) = " << std::sph_bessel(n, r * pi) << "\n";
      std::cout << "\n";
    }
    
    int main() {
      p(0); // sph_bessel(0, x) = sin(x) / x
      p(1); // sph_bessel(1, x) = sin(x) / x^2 - cos(x) / x
      p(2); // sph_bessel(2, x) = (3 / x^3 - 1 / x) * sin(x) - (3 / x^2) * cos(x)
    }
    

    出力例

    sph_bessel(0, 0 pi) = 1
    sph_bessel(0, 0.25 pi) = 0.900316
    sph_bessel(0, 0.5 pi) = 0.63662
    
    sph_bessel(1, 0 pi) = 0
    sph_bessel(1, 0.25 pi) = 0.246002
    sph_bessel(1, 0.5 pi) = 0.405285
    
    sph_bessel(2, 0 pi) = 0
    sph_bessel(2, 0.25 pi) = 0.0393422
    sph_bessel(2, 0.5 pi) = 0.137417
    
    

    バージョン

    言語

    • C++17

    処理系

    実装例

    漸化式

    $$ j_n(x) = \frac{2n-1}{x} j_{n-1}(x) - j_{n-2}(x); j_0(x) = \frac{\sin x}{x}, j_1(x) = \frac{\sin x}{x^2} - \frac{\cos x}{x} $$

    関連項目

    参照