名稱空間
變體
操作

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

來自 cppreference.com
< 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。