ctanf, ctan, ctanl
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <complex.h> で定義
|
||
float complex ctanf( float complex z ); |
(1) | (C99以上) |
double complex ctan( double complex z ); |
(2) | (C99以上) |
long double complex ctanl( long double complex z ); |
(3) | (C99以上) |
| ヘッダ <tgmath.h> で定義
|
||
#define tan( z ) |
(4) | (C99以上) |
1-3)
z の複素正接を計算します。4) 型総称マクロ。
z が long double complex 型の場合は ctanl が呼ばれ、 z が double complex 型の場合は ctan が呼ばれ、 z が float complex 型の場合は ctanf が呼ばれます。 z が実数または整数の場合、このマクロは対応する実数の関数 (tanf, tan, tanl) を呼びます。 z が虚数の場合、このマクロは tanh の対応する実数版を呼んで公式 tan(iy) = i tanh(y) を実装し、戻り値型は虚数になります。引数
| z | - | 複素数の引数 |
戻り値
エラーが発生しなければ、 z の複素正接が返されます。
エラーおよび特殊なケースは、この演算が -I * ctanh(I*z) によって実装されているかのように処理されます。
ノート
正接は複素平面上の解析関数であり、分岐切断を持ちません。 正接は実部に関して πi の周期で周期的であり、実数線に沿って座標 (π(1/2 + n), 0) に位数 1 の極を持ちます。 しかし一般的な浮動小数点表現では π/2 を正確に表すことはできず、そのため極エラーが発生するような引数の値はありません。
正接の数学的な定義は
tan z =| i(e-iz -eiz ) |
| e-iz +eiz |
です。
例
Run this code
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
double complex z = ctan(1); // behaves like real tangent along the real line
printf("tan(1+0i) = %f%+fi ( tan(1)=%f)\n", creal(z), cimag(z), tan(1));
double complex z2 = ctan(I); // behaves like tanh along the imaginary line
printf("tan(0+1i) = %f%+fi (tanh(1)=%f)\n", creal(z2), cimag(z2), tanh(1));
}
出力:
tan(1+0i) = 1.557408+0.000000i ( tan(1)=1.557408)
tan(0+1i) = 0.000000+0.761594i (tanh(1)=0.761594)
参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.3.5.6 The ctan functions (p: 192)
- 7.25 Type-generic complex <tgmath.h> (p: 373-375)
- G.7 Type-generic math <tgmath.h> (p: 545)
- C99 standard (ISO/IEC 9899:1999):
- 7.3.5.6 The ctan functions (p: 174)
- 7.22 Type-generic complex <tgcomplex.h> (p: 335-337)
- G.7 Type-generic math <tgmath.h> (p: 480)
関連項目
(C99)(C99)(C99) |
複素数双曲線正接を計算します (関数) |
(C99)(C99)(C99) |
複素正弦を計算します (関数) |
(C99)(C99)(C99) |
複素余弦を計算します (関数) |
(C99)(C99)(C99) |
複素数の逆正接を計算します (関数) |
(C99)(C99) |
正接 (tan(x)) を計算します (関数) |
tan の C++リファレンス
| |