- 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庫 - cacosh() 函式
C語言複數庫的cacosh()函式用於計算複數反雙曲餘弦,即z的反雙曲餘弦,其分支切割在實軸上小於1的值處。這意味著該函式在除實軸z<1外的所有地方都是連續且單值的。
The inverse hyperbolic cosine (acosh) z is defined as: acosh(z)=ln(z + √(z2 - 1))
此函式取決於z的型別。如果z是“float”型別,我們使用cacoshf()計算acosh;對於long double型別,使用cacoshl();對於double型別,使用cacosh()。
語法
以下是cacosh()函式的C庫語法:
double complex cacosh( double complex z );
引數
此函式接受一個引數:
-
Z − 它表示我們要計算acosh的複數。
返回值
此函式返回z的複數反雙曲餘弦,在實軸上的區間為[0; ∞),在虛軸上的區間為[−iπ; iπ]。
示例1
以下是一個基本的C程式,演示了在複數上使用cacosh()的方法。
#include <stdio.h>
#include <complex.h>
int main() {
double complex z = 2.0 + 3.0 * I;
// Calculate the hyperbolic cosine
double complex res = cacosh(z);
printf("Inverse hyperbolic cosine: %.2f%+.2fi\n", creal(res), cimag(res));
return 0;
}
輸出
以下是輸出:
Inverse hyperbolic cosine: 1.98+1.00i
示例2
讓我們看另一個例子,使用cacosh()函式計算實軸上的反雙曲餘弦。
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
// inverse cosine of real axis
double complex z = 1;
double complex res = cacosh(z);
printf("acosh(1+0i) = %f+%fi \n", creal(res), cimag(res));
}
輸出
以下是輸出:
acosh(1+0i) = 0.000000+0.000000i
示例3
下面的C程式在計算複數的共軛後,計算複數反雙曲餘弦。
#include <stdio.h>
#include <complex.h>
#include <math.h>
int main() {
double complex z = 1.0 + 2.0 * I;
// Calculate the conjugate of z
double complex conjugate = conj(z);
// Compute the acosh of the conjugate
double complex result = acosh(conjugate);
// Display the result
printf("Conjugate of z: %.2f + %.2fi\n", creal(conjugate), cimag(conjugate));
printf("acosh(conjugate): %.2f + %.2fi\n", creal(result), cimag(result));
return 0;
}
輸出
以下是輸出:
Conjugate of z: 1.00 + -2.00i acosh(conjugate): 0.00 + 0.00i
c_library_complex_h.htm
廣告