ccosf, ccos, ccosl
From cppreference.com
| ヘッダー <complex.h> で定義 |
||
| (1) | (C99以降) | |
| (2) | (C99以降) | |
| (3) | (C99以降) | |
| ヘッダー <tgmath.h> で定義 |
||
| #define cos( z ) |
(4) | (C99以降) |
1-3)
z の複素余弦を計算します。4) 型汎用マクロ:
z の型が long double complex の場合、ccosl が呼び出されます。z の型が double complex の場合、ccos が呼び出されます。z の型が float complex の場合、ccosf が呼び出されます。z が実数または整数である場合、マクロは対応する実数関数(cosf、cos、cosl)を呼び出します。z が虚数である場合、マクロは関数 cosh の対応する実数バージョンを呼び出し、公式 cos(iy) = cosh(y) を実装し、戻り値の型は実数になります。目次 |
[edit] パラメータ
| z | - | 複素数引数 |
[edit] 戻り値
エラーが発生しない場合、z の複素余弦が返されます。
エラーおよび特殊ケースは、操作が ccosh(I*z) によって実装されているかのように処理されます。
[edit] 注釈
余弦は複素平面全体で整関数であり、分岐カットを持ちません。
余弦の数学的定義は cos z =| eiz +e-iz |
| 2 |
[edit] 例
このコードを実行
#include <stdio.h> #include <math.h> #include <complex.h> int main(void) { double complex z = ccos(1); // behaves like real cosine along the real line printf("cos(1+0i) = %f%+fi ( cos(1)=%f)\n", creal(z), cimag(z), cos(1)); double complex z2 = ccos(I); // behaves like real cosh along the imaginary line printf("cos(0+1i) = %f%+fi (cosh(1)=%f)\n", creal(z2), cimag(z2), cosh(1)); }
出力
cos(1+0i) = 0.540302-0.000000i ( cos(1)=0.540302) cos(0+1i) = 1.543081-0.000000i (cosh(1)=1.543081)
[edit] 参照
- C11標準 (ISO/IEC 9899:2011)
- 7.3.5.4 The ccos functions (p: 191)
- 7.25 型総称数学関数 <tgmath.h> (p: 373-375)
- G.7 Type-generic math <tgmath.h> (p: 545)
- C99標準 (ISO/IEC 9899:1999)
- 7.3.5.4 The ccos functions (p: 173)
- 7.22 型総称数学関数 <tgmath.h> (p: 335-337)
- G.7 Type-generic math <tgmath.h> (p: 480)
[edit] 関連項目
| (C99)(C99)(C99) |
複素サインを計算する (関数) |
| (C99)(C99)(C99) |
複素タンジェントを計算する (関数) |
| (C99)(C99)(C99) |
複素アークコサインを計算する (関数) |
| (C99)(C99) |
コサインを計算する (cos(x)) (関数) |
| C++ ドキュメント for cos
| |