amath  1.8.5
Simple command line calculator
cacos.c File Reference
#include "prim.h"
Include dependency graph for cacos.c:

Go to the source code of this file.

Functions

complex cacos (complex z)
 Inverse cosine of complex number. More...
 

Function Documentation

◆ cacos()

complex cacos ( complex  z)

Inverse cosine of complex number.

Inverse cosine expressed using complex logarithms:

arccos z = -i * log(z + i * sqrt(1 - z * z))

More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms

Definition at line 42 of file cacos.c.

References cadd(), clog(), cmul(), cpack(), csqrt(), and csub().

Referenced by ComplexNumber::ArcCosine().

43 {
44  complex a = cpack(1.0, 0.0);
45  complex i = cpack(0.0, 1.0);
46  complex j = cpack(0.0, -1.0);
47  complex p = csub(a, cmul(z, z));
48  complex q = clog(cadd(z, cmul(i, csqrt(p))));
49  complex w = cmul(j, q);
50  return w;
51 }
complex csub(complex y, complex z)
Subtraction of two complex numbers.
Definition: prim.c:130
Definition: mathi.h:48
complex cmul(complex y, complex z)
Multiplication of two complex numbers.
Definition: prim.c:140
complex cpack(double x, double y)
Pack two real numbers into a complex number.
Definition: prim.c:68
complex csqrt(complex z)
Square root of complex number.
Definition: csqrt.c:42
complex cadd(complex y, complex z)
Addition of two complex numbers.
Definition: prim.c:120
complex clog(complex z)
Natural logarithm of a complex number.
Definition: clog.c:42
Here is the call graph for this function:
Here is the caller graph for this function: