- 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庫 - csinh() 函式
C語言的complex庫中的csinh()函式用於計算z(複數)的雙曲正弦值。雙曲正弦函式的性質與普通正弦函式類似,不同之處在於它與雙曲線而不是圓有關。
The hyperbolic sine (sinh) complex number (z) is defined as: sinh(z)= ez - e-z/2
此函式取決於z(複數)的型別。如果z是“float”型別,我們使用csinhf()計算sinh;對於long double型別,使用csinhl();對於double型別,使用csinh()。
語法
以下是csinh()函式的C庫語法:
double complex csinh( double complex z );
引數
此函式接受單個引數:
-
Z - 表示要計算sinh的複數。
返回值
此函式返回z(複數)的復雙曲正弦值。
示例1
以下是一個基本的C程式,用於演示在複數上使用csinh()。
#include <stdio.h>
#include <complex.h>
int main() {
double complex z = 3.0 + 4.0 * I;
// Calculate the sinh
double complex res = csinh(z);
printf("Complex sinh: %.2f%+.2fi\n", creal(res), cimag(res));
return 0;
}
輸出
以下是輸出:
Complex sinh: -6.55-7.62i
示例2
讓我們看另一個例子,使用csinh()函式計算實數軸上的雙曲正弦值。
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
// real line
double complex z = csinh(1);
printf("sinh(1+0i) = %f+%fi (sinh(1)=%f)\n", creal(z), cimag(z), sinh(1));
}
輸出
以下是輸出:
Square root of -4 is 0.0+2.0i
示例3
下面的程式使用csinh()函式計算虛數軸上的雙曲正弦值。
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
// imaginary line
double complex z2 = csinh(I);
printf("sinh(0+1i) = %f+%fi ( sin(1)=%f)\n", creal(z2), cimag(z2), sin(1));
}
輸出
以下是輸出:
sinh(0+1i) = 0.000000+0.841471i ( sin(1)=0.841471)
c_library_complex_h.htm
廣告