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

Go to the source code of this file.

Functions

complex cacot (complex z)
 Inverse cotangent of complex number. More...
 

Function Documentation

◆ cacot()

complex cacot ( complex  z)

Inverse cotangent of complex number.

Inverse cotangent expressed using complex logarithms:

arccot z = i/2 * (log(1 - i/z) - log(1 + i/z))

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

Definition at line 42 of file cacot.c.

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

Referenced by ComplexNumber::ArcCotangent().

43 {
44  complex one = cpack(1.0, 0.0);
45  complex two = cpack(2.0, 0.0);
46  complex i = cpack(0.0, 1.0);
47  complex iz = cdiv(i, z);
48  complex p = clog(csub(one, iz));
49  complex q = clog(cadd(one, iz));
50  complex w = cmul(cdiv(i, two), csub(p, q));
51  return w;
52 }
complex csub(complex y, complex z)
Subtraction of two complex numbers.
Definition: prim.c:130
complex cdiv(complex y, complex z)
Division of two complex numbers.
Definition: prim.c:159
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 cadd(complex y, complex z)
Addition of two complex numbers.
Definition: prim.c:120
static const double two
Definition: pow.c:67
#define one
Definition: ktan.c:67
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: