命名空间
变体
操作

std::ellint_1, std::ellint_1f, std::ellint_1l

来自 cppreference.cn
< cpp‎ | 数值‎ | 特殊函数
 
 
 
 
定义于头文件 <cmath>
(1)
float       ellint_1 ( float k, float phi );

double      ellint_1 ( double k, double phi );

long double ellint_1 ( long double k, long 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 */

    ellint_1( Arithmetic1 k, Arithmetic2 phi );
(A) (C++17 起)
1-3) 计算 kphi第一类不完全椭圆积分 库为所有 cv-unqualified 浮点类型提供了 std::ellint_1 的重载,作为参数 kphi 的类型。(C++23 起)
A) 为所有其他算术类型组合提供了附加重载。

目录

[编辑] 参数

k - 椭圆模或离心率(浮点或整数值)
phi - 雅可比幅角(浮点或整数值,以弧度测量)

[编辑] 返回值

如果未发生错误,则返回 kphi 的第一类不完全椭圆积分的值,即 phi
0
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

  • 如果 num1num2 的类型为 long double,则 std::ellint_1(num1, num2) 具有与 std::ellint_1(static_cast<long double>(num1),
                  static_cast<long double>(num2))
    相同的效果。
  • 否则,如果 num1 和/或 num2 的类型为 double 或整数类型,则 std::ellint_1(num1, num2) 具有与 std::ellint_1(static_cast<double>(num1),
                  static_cast<double>(num2))
    相同的效果。
  • 否则,如果 num1num2 的类型为 float,则 std::ellint_1(num1, num2) 具有与 std::ellint_1(static_cast<float>(num1),
                  static_cast<float>(num2))
    相同的效果。
(直至 C++23)

如果 num1num2 具有算术类型,则 std::ellint_1(num1, num2) 具有与 std::ellint_1(static_cast</* common-floating-point-type */>(num1),
              static_cast</* common-floating-point-type */>(num2))
相同的效果,其中 /* common-floating-point-type */ 是在 num1num2 的类型中,具有最高浮点转换等级和最高浮点转换次等级的浮点类型;整数类型的参数被认为具有与 double 相同的浮点转换等级。

如果不存在具有最高等级和次等级的浮点类型,则重载决议不会从提供的重载中产生可用的候选函数。

(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

[编辑] 参阅

(完全)第一类椭圆积分
(函数) [编辑]

[编辑] 外部链接

Weisstein, Eric W. "Elliptic Integral of the First Kind." 来自 MathWorld — A Wolfram Web Resource。