
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
Sin( ) function for complex number in C++
We are given with the task to find the working of sin() function for complex number. The sin( ) function for complex numbers are present in the complex header file which means for calculating the value of sin() we need to add the complex header file in the code. In mathematics this function is used to calculate the value of sin having complex numbers.
Syntax
Syntax for sin() function is −
sin(z);
Parameter
parameter z can be any complex number and this parameter is defined in the definition of sin() function which makes this parameter mandatory.
Return type
This function returns the complex value of sin( ) as it contains complex number.
Input − Sin(0,1)
Output − (0,1.1752)
Input − Sin(4,6)
Output − (-152.65, -131.848)
Example
#include<iostream.h> #include<complex.h> Using namespace std; int main( ){ Complex<double> x(2,1); Cout<< “ The sin of “ << x << “ = “ << sin(x) << endl; return 0; }
Output
If we run the above code it will generate the following output
The sin of (2,1) = (1.403,-0.4890)
Example
#include<iostream.h> #include<complex.h> Using namespace std; int main( ){ Complex<double> x(3, 9); Cout<< “ The sin of “ << x << “ = “ << sin(x) << endl; Return 0; }
Output
If we run the above code it will generate the following output
The sin of (3, 9) = (571.75,-4010.996)
- Related Articles
- arg() function for Complex Number in C++
- abs() function for complex number in c++ ?
- acosh() function for complex number in C++
- acos() function for complex number in C++?
- asin() function for complex number in C++?
- atan() function for complex number in C++?
- tanh( ) function for complex Number in C++
- log() function for complex number in C++
- log10() function for complex number in C++
- tan() function for complex number in C++
- Cos() function for complex number in C++
- pow() function for complex number in C++
- polar() function for complex number in C++
- exp() function for complex number in C++
- sqrt ( ) function for complex number in C++
