namespace std {
float ellint_1f(float k, float phi);
double ellint_1(double k, double phi);
long double ellint_1l(long double k, long double phi);
}
概要
第一種不完全楕円積分 (incomplete elliptic integral of the first kind) を計算する。
戻り値
引数 k
, phi
の第一種不完全楕円積分
$$
F(k, \phi) = \int_0^\phi \frac{\mathrm d\theta}{\sqrt{1 - k^2 \sin^2 \theta}}
\quad \text{for } |k| \le 1
$$
を返す。
備考
$ F(k, \pi/2) = K(k)$ (第一種完全楕円積分 comp_ellint_1
)。
例
#include <cmath>
#include <iostream>
constexpr double pi = 3.141592653589793;
void p(double k) {
for (double q : {0., 0.25, 0.5})
std::cout << "ellint_1(" << k << ", " << q << " pi) = " << std::ellint_1(k, q * pi) << "\n";
std::cout << "\n";
}
int main() {
p(0); // ellint_1(0, phi) = phi
p(0.5);
p(1); // ellint_1(1, phi) = log(tan(phi) + 1 / cos(phi)) for phi ∈ [-π/2, π/2]
}
出力例
ellint_1(0, 0 pi) = 0
ellint_1(0, 0.25 pi) = 0.785398
ellint_1(0, 0.5 pi) = 1.5708
ellint_1(0.5, 0 pi) = 0
ellint_1(0.5, 0.25 pi) = 0.804366
ellint_1(0.5, 0.5 pi) = 1.68575
ellint_1(1, 0 pi) = 0
ellint_1(1, 0.25 pi) = 0.881374
ellint_1(1, 0.5 pi) = nan
バージョン
言語
- C++17
処理系
- Clang: ??
- GCC: 7.1.0
- ICC: ??
- Visual C++: ??
備考
GCC (libstdc++)
GCC 7.1.0–8.0.0 では |k| == 1 && |phi| >= π / 2
の場合 nan
を返す。
関連項目
- 第一種完全楕円積分
comp_ellint_1
参照
- N3060 JTC1.22.29124 Programming Language C++ — Special Math Functions
- WG21 P0226R1 Mathematical Special Functions for C++17, v5
- ISO/IEC 29124:2010 Information technology -- Programming languages, their environments and system software interfaces -- Extensions to the C++ Library to support mathematical special functions