- C 標準庫
- C 庫 - 首頁
- C 庫 - <assert.h>
- C 庫 - <complex.h>
- C 庫 - <ctype.h>
- C 庫 - <errno.h>
- C 庫 - <fenv.h>
- C 庫 - <float.h>
- C 庫 - <inttypes.h>
- C 庫 - <iso646.h>
- C 庫 - <limits.h>
- C 庫 - <locale.h>
- C 庫 - <math.h>
- C 庫 - <setjmp.h>
- C 庫 - <signal.h>
- C 庫 - <stdalign.h>
- C 庫 - <stdarg.h>
- C 庫 - <stdbool.h>
- C 庫 - <stddef.h>
- C 庫 - <stdio.h>
- C 庫 - <stdlib.h>
- C 庫 - <string.h>
- C 庫 - <tgmath.h>
- C 庫 - <time.h>
- C 庫 - <wctype.h>
- C 標準庫資源
- C 庫 - 快速指南
- C 庫 - 有用資源
- C 庫 - 討論
- C 程式設計資源
- C 程式設計 - 教程
- C - 有用資源
C 庫 - ccosh() 函式
C 的complex 庫 ccosh() 函式用於計算 z(複數)的雙曲餘弦。雙曲餘弦函式具有與普通餘弦函式類似的性質,但它與雙曲線而不是圓形有關。
The hyperbolic cos(cosh) z(complex number) is defined as: cosh(z)= ez + e-z/2
此函式取決於 z(複數)的型別。如果 z 是“float”型別,我們使用ccoshf()計算cosh,對於長雙精度型別,使用ccoshl(),對於雙精度型別,使用ccosh()。
語法
以下是 ccosh() 函式的 C 庫語法 -
double complex ccosh( double complex z );
引數
此函式接受單個引數 -
-
Z - 它表示我們要計算 cosh 的複數。
返回值
此函式返回 z(複數)的復雙曲餘弦。
示例 1
以下是演示如何在複數上使用 ccosh() 的基本 C 程式。
#include <stdio.h>
#include <complex.h>
int main() {
double complex z = 2.0 + 3.0 * I;
// Calculate the cosh
double complex res = ccosh(z);
printf("Complex cosh: %.2f%+.2fi\n", creal(res), cimag(res));
return 0;
}
輸出
以下是輸出 -
Complex cosh: -3.72+0.51i
示例 2
讓我們看另一個例子,使用 ccosh() 函式計算實數線的雙曲餘弦。
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
// real line
double complex z = ccosh(1);
printf("cosh(1+0i) = %f+%fi (cosh(1)=%f)\n", creal(z), cimag(z), cosh(1));
}
輸出
以下是輸出 -
cosh(1+0i) = 1.543081+0.000000i (cosh(1)=1.543081)
示例 3
下面的程式使用 ccosh() 函式計算虛數線的雙曲餘弦。
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
// imaginary line
double complex z = ccosh(I);
printf("cosh(0+1i) = %f+%fi ( cos(1)=%f)\n", creal(z), cimag(z), cos(1));
}
輸出
以下是輸出 -
cosh(0+1i) = 0.540302+0.000000i ( cos(1)=0.841471)
c_library_complex_h.htm
廣告