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

履歴 編集

function
<cmath>

std::comp_ellint_3(C++17)

namespace std {
  double
    comp_ellint_3(double k,
                  double nu);              // (1) C++17
  floating-point-type
    comp_ellint_3(floating-point-type k,
                  floating-point-type nu); // (1) C++23

  Promoted
    comp_ellint_3(Arithmetic1 k,
                  Arithmetic2 nu);         // (2) C++17

  float
    comp_ellint_3f(float k,
                   float nu);              // (3) C++17

  long double
    comp_ellint_3l(long double k,
                   long double nu);        // (4) C++17
}

概要

第三種完全楕円積分 (complete elliptic integral of the third kind) を計算する。

  • (1) :
    • C++17 : doubleに対するオーバーロード
    • C++23 : 浮動小数点数型に対するオーバーロード
  • (2) : 算術型に対するオーバーロード (対応する大きい方の精度の浮動小数点数型にキャストして計算される)
  • (3) : float型規定
  • (4) : long double型規定

戻り値

引数 k, nu の第三種完全楕円積分 $$ \Pi(\nu, k) = \Pi(\nu, k, \pi/2) = \int_0^{\pi/2} \frac{\mathrm d\theta}{(1 - \nu \sin^2 \theta) \sqrt{1 - k^2 \sin^2 \theta}} \quad \text{for } |k| \le 1 $$ を返す。

$ \Pi(\nu, k) $ は第三種不完全楕円積分 (ellint_3)。

備考

#include <cmath>
#include <iostream>

void p(double k, double nu) {
  std::cout << "comp_ellint_3(" << k << ", " << nu << ") = ";
  try {
    std::cout << std::comp_ellint_3(k, nu) << "\n";
  } catch(const std::domain_error& e) {
    std::cout << "(domain_error)\n";
  }
}

int main() {
  p(0, -1);   // π / 2 √2
  p(0.5, -1); // 1.17745
  p(1, -1);   // ∞
  p(0, 0);    // π / 2
  p(0.5, 0);  // 1.68575
  p(1, 0);    // ∞
  p(0, 1);    // ∞
  p(0.5, 1);  // ∞
  p(1, 1);    // ∞
}

出力例

comp_ellint_3(0, -1) = 1.11072
comp_ellint_3(0.5, -1) = 1.17745
comp_ellint_3(1, -1) = (domain_error)
comp_ellint_3(0, 0) = 1.5708
comp_ellint_3(0.5, 0) = 1.68575
comp_ellint_3(1, 0) = (domain_error)
comp_ellint_3(0, 1) = inf
comp_ellint_3(0.5, 1) = inf
comp_ellint_3(1, 1) = inf

バージョン

言語

  • C++17

処理系

備考

GCC (libstdc++)

GCC 7.1.0–8.0.0 では

関連項目

  • 第三種不完全楕円積分 ellint_3

参照