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

Go to the source code of this file.

Functions

complex ctanh (complex z)
 Hyperbolic tangent of a complex number. More...
 

Function Documentation

◆ ctanh()

complex ctanh ( complex  z)

Hyperbolic tangent of a complex number.

a+bi
               sinh(2.0 * a)
real  = ---------------------------—
         cosh(2.0 * a) + cos(2.0 * b)
  sin(2.0 * b)
imag = ---------------------------— cosh(2.0 * a) + cos(2.0 * b)

Definition at line 53 of file ctanh.c.

References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().

Referenced by ComplexNumber::HypTangent().

54 {
55  complex w;
56  double a, b;
57  double d;
58 
59  a = creal(z);
60  b = cimag(z);
61  d = cosh(2.0 * a) + cos(2.0 * b);
62  w = cpack((sinh(2.0 * a) / d), (sin(2.0 * b) / d));
63 
64  return w;
65 }
double sin(double x)
Sine function.
Definition: sin.c:86
double cosh(double x)
Hyperbolic cosine function.
Definition: cosh.c:83
Definition: mathi.h:48
complex cpack(double x, double y)
Pack two real numbers into a complex number.
Definition: prim.c:68
double cimag(complex z)
Imaginary part of complex number.
Definition: prim.c:46
double cos(double x)
Cosine function.
Definition: cos.c:87
double sinh(double x)
Hyperbolic sine function.
Definition: sinh.c:77
double creal(complex z)
Real part of complex number.
Definition: prim.c:38
Here is the call graph for this function:
Here is the caller graph for this function: