名稱空間
變體
操作

catanf, catan, catanl

來自 cppreference.com
< c‎ | numeric‎ | complex
定義在標頭檔案 <complex.h>
float complex       catanf( float complex z );
(1) (C99 起)
double complex      catan( double complex z );
(2) (C99 起)
long double complex catanl( long double complex z );
(3) (C99 起)
定義於標頭檔案 <tgmath.h>
#define atan( z )
(4) (C99 起)
1-3) 計算 z 的複數反正切,其分支截斷在虛軸上位於區間 [−i,+i] 之外。
4) 型別泛型宏:若 z 的型別為 long double complex,則呼叫 catanl。若 z 的型別為 double complex,則呼叫 catan。若 z 的型別為 float complex,則呼叫 catanf。若 z 為實數或整數,則宏呼叫相應的實數函式(atanfatanatanl)。若 z 為虛數,則宏呼叫函式 atanh 的相應實數版本,實現公式 atan(iy) = i atanh(y),且宏的返回型別為虛數。

目錄

[編輯] 引數

z - 複數引數

[編輯] 返回值

若無錯誤發生,則返回 z 的複數反正切,其範圍在沿虛軸無界的條形區域內,沿實軸在區間 [−π/2; +π/2] 內。

錯誤和特殊情況的處理方式,如同操作由 -I * catanh(I*z) 實現。

[編輯] 注意

反切(或反正切)是多值函式,需要在複平面上進行分支截斷。分支截斷通常位於虛軸上的線段 (-∞i,-i)(+i,+∞i) 處。

反正切主值的數學定義是 atan z = -
1
2
i [ln(1 - iz) - ln (1 + iz]

[編輯] 示例

#include <stdio.h>
#include <float.h>
#include <complex.h>
 
int main(void)
{
    double complex z = catan(2*I);
    printf("catan(+0+2i) = %f%+fi\n", creal(z), cimag(z));
 
    double complex z2 = catan(-conj(2*I)); // or CMPLX(-0.0, 2)
    printf("catan(-0+2i) (the other side of the cut) = %f%+fi\n", creal(z2), cimag(z2));
 
    double complex z3 = 2*catan(2*I*DBL_MAX); // or CMPLX(0, INFINITY)
    printf("2*catan(+0+i*Inf) = %f%+fi\n", creal(z3), cimag(z3));
}

輸出

catan(+0+2i) = 1.570796+0.549306i
catan(-0+2i) (the other side of the cut) = -1.570796+0.549306i
2*catan(+0+i*Inf) = 3.141593+0.000000i

[編輯] 參考

  • C11 標準 (ISO/IEC 9899:2011)
  • 7.3.5.3 catan 函式 (p: 191)
  • 7.25 型別通用數學 <tgmath.h> (p: 373-375)
  • G.7 型別通用數學 <tgmath.h> (p: 545)
  • C99 標準 (ISO/IEC 9899:1999)
  • 7.3.5.3 catan 函式 (p: 173)
  • 7.22 型別通用數學 <tgmath.h> (p: 335-337)
  • G.7 型別通用數學 <tgmath.h> (p: 480)

[編輯] 參閱

(C99)(C99)(C99)
計算復反正弦
(函式) [編輯]
(C99)(C99)(C99)
計算復反餘弦
(函式) [編輯]
(C99)(C99)(C99)
計算復正切
(函式) [編輯]
(C99)(C99)
計算反正切 (arctan(x))
(函式) [編輯]
C++ 文件 用於 atan