#define acos( z )
(4) (since C99)1-3) Computes the complex arc cosine of z
with branch cuts outside the interval [â1,+1] along the real axis.
Type-generic macro: If
z
has type
long double complex,
cacosl
is called. if
z
has type
double complex,
cacos
is called, if
z
has type
float complex,
cacosf
is called. If
z
is real or integer, then the macro invokes the corresponding real function (
acosf,
acos,
acosl). If
z
is imaginary, then the macro invokes the corresponding complex number version.
[edit] Parameters [edit] Return valueIf no errors occur, complex arc cosine of z
is returned, in the range a strip unbounded along the imaginary axis and in the interval [0; Ï] along the real axis.
Errors are reported consistent with math_errhandling.
If the implementation supports IEEE floating-point arithmetic,
z
is ±0+0i
, the result is Ï/2-0i
z
is ±0+NaNi
, the result is Ï/2+NaNi
z
is x+âi
(for any finite x), the result is Ï/2-âi
z
is x+NaNi
(for any nonzero finite x), the result is NaN+NaNi
and FE_INVALID may be raised.z
is -â+yi
(for any positive finite y), the result is Ï-âi
z
is +â+yi
(for any positive finite y), the result is +0-âi
z
is -â+âi
, the result is 3Ï/4-âi
z
is +â+âi
, the result is Ï/4-âi
z
is 屉+NaNi
, the result is NaN屉i
(the sign of the imaginary part is unspecified)z
is NaN+yi
(for any finite y), the result is NaN+NaNi
and FE_INVALID may be raisedz
is NaN+âi
, the result is NaN-âi
z
is NaN+NaNi
, the result is NaN+NaNi
Inverse cosine (or arc cosine) is a multivalued function and requires a branch cut on the complex plane. The branch cut is conventially placed at the line segments (-â,-1) and (1,â) of the real axis.
The mathematical definition of the principal value of arc cosine is
acos z = Ï + iln(iz + â1-z2For any z, acos(z) = Ï - acos(-z)
[edit] Example#include <stdio.h> #include <math.h> #include <complex.h> int main(void) { double complex z = cacos(-2); printf("cacos(-2+0i) = %f%+fi\n", creal(z), cimag(z)); double complex z2 = cacos(conj(-2)); // or CMPLX(-2, -0.0) printf("cacos(-2-0i) (the other side of the cut) = %f%+fi\n", creal(z2), cimag(z2)); // for any z, acos(z) = pi - acos(-z) double pi = acos(-1); double complex z3 = ccos(pi-z2); printf("ccos(pi - cacos(-2-0i) = %f%+fi\n", creal(z3), cimag(z3)); }
Output:
cacos(-2+0i) = 3.141593-1.316958i cacos(-2-0i) (the other side of the cut) = 3.141593+1.316958i ccos(pi - cacos(-2-0i) = 2.000000+0.000000i[edit] References
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4