sinh() function in C++
In this tutorial, we will learn about the sinh() function in C++.
sinh() function in C++
sinh is the hyperbolic sine function. The hyperbolic Sinh(t) is the length of a perpendicular dropped from a point on the right-hand side of a unit ‘equilateral’ hyperbola (the distance of vertex of a hyperbola from origin=1) on the x-axis. The hyperbolic sine of x is as follows :
The syntax for the function is :
sinh(x);
We use the following header file for the function :
#include <math.h>
The parameter x can be of float, double or long double type. We get return value as float, double or long double respectively.
The parameter passed in the function represents the hyperbolic angle in radians.
Here is an example displaying the use of the sinh() function in C++
#include<iostream> #include<math.h> using namespace std; int main() { float x = 4.5, r; //x is in radians r = sinh(x); //float parameter cout << "For x = " << x << " radians, sinh(x) = " << r << endl; double y = 60, d, r2; d = y * 3.14 / 180; //y is in degrees r2 = sinh(d); //double parameter cout << "For y = " << y << " degrees, sinh(y) = " << r2 << endl; return 0; }
Output :
For x = 4.5 radians, sinh(x) = 45.003 For y = 60 degrees, sinh(y) = 1.24852
Explanation :
In this program, first, we give a float value x = 4.5 radians as a parameter to the sinh() function. It gives a floating type output. Then, we give a double value of y = 60 degrees as a parameter. Since the sinh() function takes only values in radians as the parameter, thus, we convert the degrees into radians. After converting the degrees into radians we pass it as a double argument and get a double output.
Hope this was helpful. Enjoy Coding!
Also, learn :
Leave a Reply