polar() function for complex number in C++
The polar() function for complex number is defined in the complex header file.The polar function is used to find the complex number from phase angle and magnitude.
Syntax:
polar(mag, angle)
Parameter:
- mag: It represents the magnitude of the complex number.
- angle: It represents the phase angle.
Returns: This function returns a complex number which is obtain by phase angle and magnitude.
Below program illustrate the above function:-
Program 1:
// C++ program to demonstrate // example of polar() function. #include <bits/stdc++.h> using namespace std; // driver function int main () { cout << "The complex number whose magnitude is 4.0" ; cout << " and phase angle 1.5" ; // use of polar() function cout << " is " << polar (4.0, 1.5) << endl; return 0; } |
chevron_right
filter_none
Output:
The complex number whose magnitude is 4.0 and phase angle 1.5 is (0.282949,3.98998)
Program 2:
// C++ program to demonstrate // example of polar() function. #include <bits/stdc++.h> using namespace std; // driver function int main () { cout << "The complex number whose magnitude is 2.0" ; cout << " and phase angle 0.5" ; // use of polar() function cout << " is " << polar (2.0, 0.5) << endl; return 0; } |
chevron_right
filter_none
Output:
The complex number whose magnitude is 2.0 and phase angle 0.5 is (1.75517,0.958851)
Recommended Posts:
- exp() function for complex number in C++
- pow() function for complex number in C++
- log() function for complex number in C++
- abs() function for complex number in c++
- arg() function for Complex Number in C++
- tan() function for complex number in C++
- cos() function for complex number in C++
- asin() function for complex number in C++
- asinh() function for complex number in C++
- cosh() function for complex number in C++
- sin() function for complex number in C++ with Examples
- acosh() function for complex number in C++
- atanh() function for complex number in C++
- sinh() function for Complex Number in C++
- tanh() function for Complex Number in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.