Jump to content

C Programming/complex.h: Difference between revisions

From Wikibooks, open books for an open world
[unreviewed revision][unreviewed revision]
Content deleted Content added
m robot Adding: pt:Complex.h
Line 33: Line 33:
|<code>double complex ccosh(double complex);</code> || Complex [[hyperbolic cosine]]
|<code>double complex ccosh(double complex);</code> || Complex [[hyperbolic cosine]]
|-
|-
|<code>double complex cexp(double complex);</code> || Complex [[exponential]]
|<code>double complex cexp(double complex);</code> || Complex [[Exponential function|exponential]]
|-
|-
|<code>double {{spaces|7}} cimag(double complex);</code> || [[Imaginary part]] of complex number
|<code>double {{spaces|7}} cimag(double complex);</code> || [[Imaginary part]] of complex number

Revision as of 18:49, 12 August 2010

Template:C Standard library

complex.h is a header file in the standard library of the C programming language that defines functionality for complex arithmetic.[1] These functions use the built-in type complex which was introduced with the C99 revision of C.

This header should not be confused with the C++ standard library header <complex>, which implements complex numbers in a completely different way (as a template class, complex<T>).

Functions

Each function declared in complex.h has three versions, each of which works with a different floating-point type (double, float and long double). Only the double version of each function is listed here; to use the float (or long double) version, append an f (or an l, respectively) to the function's name.

Note that all angles are in radians.

double         cabs(double complex); Complex magnitude
double complex cacos(double complex); Complex inverse cosine
double complex cacosh(double complex); Complex inverse hyperbolic cosine
double         carg(double complex); Complex argument
double complex casin(double complex); Complex inverse sine
double complex casinh(double complex); Complex inverse hyperbolic sine
double complex catan(double complex); Complex inverse tangent
double complex catanh(double complex); Complex inverse hyperbolic tangent
double complex ccos(double complex); Complex cosine
double complex ccosh(double complex); Complex hyperbolic cosine
double complex cexp(double complex); Complex exponential
double         cimag(double complex); Imaginary part of complex number
double complex clog(double complex); Complex logarithm
double complex conj(double complex); Complex conjugate
double complex cpow(double complex, double complex); Complex power
double complex cproj(double complex); Complex projectionTemplate:Ref label
double         creal(double complex); Real part of complex number
double complex csin(double complex); Complex sine
double complex csinh(double complex); Complex hyperbolic sine
double complex csqrt(double complex); Complex square root
double complex ctan(double complex); Complex tangent
double complex ctanh(double complex); Complex hyperbolic tangent
Template:Note label cproj(z) projects the complex number z onto the Riemann sphere; the result is z itself, except complex infinities are mapped to positive infinity on the real axis.[2]

References

  1. complex.h: complex arithmetic – Base Definitions Reference, The Single UNIX® Specification, Issue 7 from The Open Group
  2. cproj: complex projection function – System Interfaces Reference, The Single UNIX® Specification, Issue 7 from The Open Group