polar function template — Converts to polar coordinates
template<typename T>
complex<T> polar(const T& r, const T& theta)
The polar
function returns
a complex object that represents the value given in polar
coordinates, in which r
is the
magnitude and theta
is the angle
(in radians). The resulting value has the following real and
imaginary parts:
real = r * cos(theta) imag = r * sin(theta)