amath  1.6.2
Simple command line calculator
ccbrt.c File Reference
#include "prim.h"
#include "math.h"
#include "complex.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

complex ccbrt ( complex  z)

Cube root of complex number.

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

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

Definition at line 40 of file ccbrt.c.

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

Referenced by ComplexNumber::CubeRoot().

41 {
42  complex onethird = cpack(1.0 / 3.0, 0.0);
43  complex a = cmul(onethird, clog(z));
44  complex w = cexp(a);
45  return w;
46 }
complex cexp(complex z)
Returns e to the power of a complex number.
Definition: cexp.c:46
complex cmul(complex a, complex z)
Multiplication of two complex numbers.
Definition: prim.c:150
complex clog(complex z)
Natural logarithm of a complex number.
Definition: clog.c:46
complex cpack(double x, double y)
Pack two real numbers into a complex number.
Definition: prim.c:71

Here is the call graph for this function:

Here is the caller graph for this function: