std::ellint_1, std::ellint_1f, std::ellint_1l
定義於標頭檔案 <cmath> |
||
(1) | ||
float ellint_1 ( float k, float phi ); double ellint_1 ( double k, double phi ); |
(C++17 起) (直至 C++23) |
|
/* floating-point-type */ ellint_1( /* floating-point-type */ k, /* floating-point-type */ phi ); |
(C++23 起) | |
float ellint_1f( float k, float phi ); |
(2) | (C++17 起) |
long double ellint_1l( long double k, long double phi ); |
(3) | (C++17 起) |
定義於標頭檔案 <cmath> |
||
template< class Arithmetic1, class Arithmetic2 > /* common-floating-point-type */ |
(A) | (C++17 起) |
std::ellint_1
的過載,作為引數 k 和 phi 的型別。(C++23 起)目錄 |
[編輯] 引數
k | - | 橢圓模或離心率(浮點或整數值) |
phi | - | 雅可比幅角(浮點或整數值,以弧度測量) |
[編輯] 返回值
如果未發生錯誤,則返回 k 和 phi 的第一類不完全橢圓積分的值,即 ∫phi0
dθ |
√1-k2 sin2 θ |
[編輯] 錯誤處理
錯誤可能按 math_errhandling 中指定的方式報告
- 如果引數是 NaN,則返回 NaN 且不報告域錯誤。
- 如果 |k|>1,可能會發生域錯誤。
[編輯] 注意
不支援 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) 的形式提供。它們只需要足以確保對於其第一個引數 num1 和第二個引數 num2:
|
(直至 C++23) |
如果 num1 和 num2 具有算術型別,則 std::ellint_1(num1, num2) 具有與 std::ellint_1(static_cast</* common-floating-point-type */>(num1), 如果不存在具有最高等級和次等級的浮點型別,則過載決議不會從提供的過載中產生可用的候選函式。 |
(C++23 起) |
[編輯] 示例
#include <cmath> #include <iostream> #include <numbers> int main() { const double hpi = std::numbers::pi / 2.0; std::cout << "F(0,π/2) = " << std::ellint_1(0, hpi) << '\n' << "F(0,-π/2) = " << std::ellint_1(0, -hpi) << '\n' << "π/2 = " << hpi << '\n' << "F(0.7,0) = " << std::ellint_1(0.7, 0) << '\n'; }
輸出
F(0,π/2) = 1.5708 F(0,-π/2) = -1.5708 π/2 = 1.5708 F(0.7,0) = 0
[編輯] 參閱
(C++17)(C++17)(C++17) |
(完全)第一類橢圓積分 (函式) |
[編輯] 外部連結
Weisstein, Eric W. "Elliptic Integral of the First Kind." 來自 MathWorld — A Wolfram Web Resource。 |