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

Go to the source code of this file.

Functions

complex ccbrt (complex z)
 Cube root of complex number. More...
 

Function Documentation

◆ ccbrt()

complex ccbrt ( complex  z)

Cube root of complex number.

cbrt z = exp(1/3 * log(z))

More info is available at Wikipedia:
https://wikipedia.org/wiki/Cube_root

Definition at line 41 of file ccbrt.c.

References cexp(), clog(), cmul(), and cpack().

Referenced by ComplexNumber::CubeRoot().

42 {
43  complex onethird = cpack(1.0 / 3.0, 0.0);
44  complex a = cmul(onethird, clog(z));
45  complex w = cexp(a);
46  return w;
47 }
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 cexp(complex z)
Returns e to the power of a complex number.
Definition: cexp.c:42
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: