C Standard Library 简明教程
C Library - <complex.h>
complex.h 头文件是标准 C 库的一部分,它定义了用于处理复数的各种函数和宏。复数 (Z) 包含实部和虚部。
The complex.h header file is part of the standard C library, defines various functions and macros for working with complex numbers. The complex number (Z) contains of both a real part and an imaginary part.
复数表示为 x + yi,其中 x 是实部,y 是虚部,i 是虚数单位(定义为 -1 的平方根)。
A complex number represented as x + yi, where x is the real part, y is the imaginary part, and i is the imaginary unit (defined as the square root of -1).
C − complex.h Types
在头文件 complex.h 中定义了以下类型:
Following are the types defined in the header complex.h −
Sr.No. |
Types & Description |
1 |
imaginary This is imaginary type macro. |
2 |
complex This is complex type macro. |
Manipulation Functions
以下是一些操作函数:
Following are the Manipulation functions −
Sr.No. |
Function & Description |
1 |
double complex CMPLX(double real, double imag)This function construct a complex number from real and imaginary part. |
2 |
double creal( double complex z )This function computes the real part of a complex number. |
3 |
double cimag( double complex z )This function computes the imaginary part of the complex number. |
4 |
double cabs( double complex z )This function calculate the magnitude of a complex number. |
5 |
double carg( double complex z )This function calculate the phase angle of a complex number. |
6 |
double complex conj( double complex z )This function calculate the complex conjugate. |
7 |
double complex cproj( double complex z )This function calculates the projection on Riemann sphere. |
Power Functions
以下是一些幂函数:
Following are the Power functions −
Sr.No. |
Function & Description |
1 |
double complex cpow( double complex x, double complex y )This function calculates the complex power function. |
2 |
double complex csqrt( double complex z )This function calculates the complex square root. |
Exponential Functions
以下是一些指数函数:
Following are the Exponential functions −
Sr.No. |
Function & Description |
1 |
double complex cexp( double complex z )This function calculates the complex base-e exponential. |
2 |
double complex clog( double complex z )This function calculates the complex natural logarithm. |
Trigonometric Functions
以下是一些三角函数:
Following are the Trigonometric functions −
Sr.No. |
Function & Description |
1 |
double complex csin( double complex z )This function calculates the complex sine. |
2 |
double complex ccos( double complex z )This function calculates the complex cosine. |
3 |
double complex ctan( double complex z )This function calculates the complex complex tangent. |
4 |
double complex casin( double complex z )This function calculates the complex arc sine. |
5 |
double complex cacos( double complex z )This function calculates the complex arc cosine. |
6 |
double complex catan( double complex z )This function calculates the complex arc tangent. |
Hyperbolic Functions
下面是双曲函数 −
Following are the Hyperbolic functions −
Sr.No. |
Function & Description |
1 |
double complex csinh( double complex z )This function calculates the complex hyperbolic sine. |
2 |
double complex ccosh( double complex z )This function calculates the complex hyperbolic cosine. |
3 |
double complex ctanh( double complex z )This function calculates the complex hyperbolic tangent. |
4 |
double complex casinh( double complex z )This function calculates the complex arc hyperbolic sine. |
5 |
double complex cacosh( double complex z )This function calculates the complex arc hyperbolic cosine. |
6 |
double complex catanh( double complex z )This function calculates the complex arc hyperbolic tangent. |