sin() function for complex number in C++ with Examples
The sin() function for complex numbers is defined in the <complex> header file. This function is the complex version of the sin() function. This function is used to calculate the complex sine of the complex number z. This function returns the sine of the complex number z.
Syntax
sin (z);
Parameters
- z: This method takes a mandatory parameter z which represents the complex number.
Return value
- This function returns the sin() of the complex number z.
Example 1
C++
#include <complex>
#include <iostream>
using namespace std;
int main()
{
complex< double > complexnumber(0.0, 1.0);
cout << "The sin of Complex Numbers: " << complexnumber << " is "
<< sin (complexnumber) << endl;
return 0;
}
|
Output
The sin of Complex Numbers: (0,1) is (0,1.1752)
Time Complexity: O(1)
Auxiliary Space: O(1)
Example 2
C++
#include <complex>
#include <iostream>
using namespace std;
int main()
{
complex< double > complexnumber(1.0, 0.0);
cout << "The sin of Complex Number: " << complexnumber << " is "
<< sin (complexnumber) << endl;
return 0;
}
|
Output
The sin of Complex Number: (1,0) is (0.841471,0)
Time Complexity: O(1)
Auxiliary Space: O(1)
Last Updated :
28 Jun, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...