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 起) |
目录 |
参数
| k | - | 椭圆模量或离心率(浮点数或整数值) |
| phi | - | 雅可比振幅(浮点数或整数值,以弧度为单位) |
返回值
If no errors occur, value of the incomplete elliptic integral of the first kind of k and phi , that is ∫ phi0
| dθ |
|
√
1-k
2
sin 2 θ |
错误处理
错误报告方式可能按照 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)
|
(完全)第一类椭圆积分
(函数) |
外部链接
| 魏斯坦, 埃里克·W。《第一类椭圆积分》。 摘自 MathWorld —— 一个 Wolfram 网络资源。 |