polar

constexpr double polar(const double r, const double theta) noexcept

Returns a complex number given a magnitude \(r\) and a phase angle \(\theta\).

Parameters

const double r

A real number.

const double theta

A real number.

Returns

type Complex

A complex number.

A complex number may be obtained from a magnitude \(r\) and a phase angle \(\theta\) by evaluating the following:

\[z = r\cos\theta + ir\sin\theta\]

Example

double r = 4;
double theta = 0.5;
std::cout << polar(r, theta) << "\n";

Output:

3.51033 + 1.9177j

References