The complex class defines a set of mathematical, trigonometric, magnitude, and conversion functions as friend functions of complex objects. They are:
- exp (exponent)
- log (natural logarithm)
- pow (power)
- sqrt (square root)
- cos (cosine)
- cosh (hyperbolic cosine)
- sin (sine)
- sinh (hyperbolic sine)
- abs (absolute value or magnitude)
- norm (square of magnitude)
- arg (polar angle)
- conj (conjugate)
- polar (polar to complex)
- real (real part)
- imag (imaginary part)
Because these functions are friend functions rather than member functions, you cannot use the dot or arrow operators. For example:
complex a,b,*c;
a=exp(b); // correct - exp() is a friend function of complex
a=b.exp(); // error - exp() is not a member function of complex
a=c->exp(); // error - exp() is not a member function of
complex