- The C Standard Library
- The C Standard Library
- The C++ Standard Library
- C++ Library - Home
- C++ Library - <fstream>
- C++ Library - <iomanip>
- C++ Library - <ios>
- C++ Library - <iosfwd>
- C++ Library - <iostream>
- C++ Library - <istream>
- C++ Library - <ostream>
- C++ Library - <sstream>
- C++ Library - <streambuf>
- C++ Library - <atomic>
- C++ Library - <complex>
- C++ Library - <exception>
- C++ Library - <functional>
- C++ Library - <limits>
- C++ Library - <locale>
- C++ Library - <memory>
- C++ Library - <new>
- C++ Library - <numeric>
- C++ Library - <regex>
- C++ Library - <stdexcept>
- C++ Library - <string>
- C++ Library - <thread>
- C++ Library - <tuple>
- C++ Library - <typeinfo>
- C++ Library - <utility>
- C++ Library - <valarray>
- The C++ STL Library
- C++ Library - <array>
- C++ Library - <bitset>
- C++ Library - <deque>
- C++ Library - <forward_list>
- C++ Library - <list>
- C++ Library - <map>
- C++ Library - <queue>
- C++ Library - <set>
- C++ Library - <stack>
- C++ Library - <unordered_map>
- C++ Library - <unordered_set>
- C++ Library - <vector>
- C++ Library - <algorithm>
- C++ Library - <iterator>
- C++ Programming Resources
- C++ Programming Tutorial
- C++ Useful Resources
- C++ Discussion
C++ Complex Library - Polar
Description
It is a complex from polar components and rturns 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.
Declaration
Following is the declaration for std::polar.
template<class T> complex<T> polar (const T& rho, const T& theta = 0);
C++11
template<class T> complex<T> polar (const T& rho, const T& theta = 0);
Parameters
rho It is a magnitude (modulus) of the complex number.
theta It is a phase angle (angular component) of the complex number.
T It is a type of the components of the complex type.
Return Value
It returns the complex cartesian equivalent to the polar format formed by rho and theta.
Exceptions
none
Example
In below example for std::polar.
#include <iostream> #include <complex> int main () { std::cout << "The complex whose magnitude is " << 1.0 << '\n'; std::cout << " and phase angle is " << 0.7 << '\n'; std::cout << " is " << std::polar (1.0, 0.7) << '\n'; return 0; }
The sample output should be like this −
The complex whose magnitude is 1 and phase angle is 0.7 is (0.764842,0.644218)
complex.htm
Advertisements