function template
<complex>
std::polartemplate<class T> complex<T> polar (const T& rho, const T& theta = 0);
Complex from polar components
Returns a complex object (in cartesian format) corresponding to the complex number defined by its polar components rho and theta, where rho is the magnitude (modulus) and theta is the phase angle. The values in the return value are the same as if:1
2
real = rho * cos(theta);
imag = rho * sin(theta);
1
2
3
4
5
6
7
8
9
10
11
12
// polar example
#include <iostream> // std::cout
#include <complex> // std::complex, std::polar
int main ()
{
std::cout << "The complex whose magnitude is " << 2.0;
std::cout << " and phase angle is " << 0.5;
std::cout << " is " << std::polar (2.0, 0.5) << '\n';
return 0;
}
The complex whose magnitude is 2 and phase angle is 0.5 is (1.75517,0.958851)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4