ccosf, ccos, ccosl
提供: cppreference.com
ヘッダ <complex.h> で定義 | ||
(1) | (C99以上) | |
(2) | (C99以上) | |
(3) | (C99以上) | |
ヘッダ <tgmath.h> で定義 | ||
#define cos( z ) | (4) | (C99以上) |
1-3)
z
の複素余弦を計算します。4) 型総称マクロ。
z
が longdoublecomplex 型の場合は ccosl
が呼ばれ、 z
が doublecomplex 型の場合は ccos
が呼ばれ、 z
が floatcomplex 型の場合は ccosf
が呼ばれます。 z
が実数または整数の場合、このマクロは対応する実数の関数 (cosf、 cos、 cosl) を呼びます。 z
が虚数の場合、このマクロは関数 cosh の対応する実数版を呼んで公式 cos(iy) = cosh(y) を実装し、戻り値型は実数になります。目次 |
[編集]引数
z | - | 複素数の引数 |
[編集]戻り値
エラーが発生しなければ、 z
の複素余弦が返されます。
エラーおよび特殊なケースは、この演算が ccosh(I*z) によって実装されているかのように処理されます。
[編集]ノート
余弦は複素平面上の整関数であり、分岐切断を持ちません。
余弦の数学的な定義は cos z =eiz +e-iz |
2 |
[編集]例
Run this code
#include <stdio.h>#include <math.h>#include <complex.h> int main(void){doublecomplex z = ccos(1);// behaves like real cosine along the real lineprintf("cos(1+0i) = %f%+fi ( cos(1)=%f)\n", creal(z), cimag(z), cos(1)); doublecomplex z2 = ccos(I);// behaves like real cosh along the imaginary lineprintf("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)
[編集]参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.3.5.4 The ccos functions (p: 191)
- 7.25 Type-generic math <tgmath.h> (p: 373-375)
- G.7 Type-generic math <tgmath.h> (p: 545)
- C99 standard (ISO/IEC 9899:1999):
- 7.3.5.4 The ccos functions (p: 173)
- 7.22 Type-generic math <tgmath.h> (p: 335-337)
- G.7 Type-generic math <tgmath.h> (p: 480)
[編集]関連項目
(C99)(C99)(C99) | 複素正弦を計算します (関数) |
(C99)(C99)(C99) | 複素正接を計算します (関数) |
(C99)(C99)(C99) | 複素数の逆余弦を計算します (関数) |
(C99)(C99) | 余弦 (cos(x)) を計算します (関数) |
cos の C++リファレンス |