
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ Program to Find the Hyperbolic Arcsine of a Given Value
Hyperbolic functions, which are defined using the hyperbola rather than the circle, are comparable to normal trigonometric functions. It returns the ratio parameter in the hyperbolic sine function from the supplied radian angle. But to do the opposite, or to put it another way. If we want to calculate the angle from the hyperbolic-sine value, we require inverse hyperbolic trigonometric operations like the hyperbolic arcsine operation.
This lesson will demonstrate how to use the hyperbolic inverse-sine (asinh) function in C++ to calculate the angle using the hyperbolic sine value, in radians. The hyperbolic inverse-sine operation follows the following formula ?
$$\mathrm{sinh^{-1}x\:=\:In(x\:+\:\sqrt{x^2\:+\:1})},where \:In\: is\: natural\: logarithm\:(log_e \: k)$$
The asinh() function
From the hyperbolic sine value, the angle can be calculated using asinh() function. This function comes with the C++ standard library. We must import the cmath library before using this function. This method returns the angle in radians and takes a sine value as an argument. The following uses the simple syntax ?
Syntax
#include < cmath > asinh( <hyperbolic sine value> )
Algorithm
- Take hyperbolic sine value x as input
- Use asinh( x ) to calculate the sinh?1(x)
- Return result.
Example
#include <iostream> #include <cmath> using namespace std; float solve( float x ) { float answer; answer = asinh( x ); return answer; } int main() { float angle, ang_deg; angle = solve( 2.3013 ); ang_deg = angle * 180 / 3.14159; cout << "The angle (in radian) for given hyperbolic sine value 2.3013 is: " << angle << " = " << ang_deg << " (in degrees)" << endl; angle = solve( 11.5487 ); ang_deg = angle * 180 / 3.14159; cout << "The angle (in radian) for given hyperbolic sine value 11.5487 is: " << angle << " = " << ang_deg << " (in degrees)" << endl; angle = solve( 0.86867 ); ang_deg = angle * 180 / 3.14159; cout << "The angle (in radian) for given hyperbolic sine value 0.86867 is: " << angle << " = " << ang_deg << " (in degrees)" << endl; angle = solve( -0.86867 ); ang_deg = angle * 180 / 3.14159; cout << "The angle (in radian) for given hyperbolic sine value - 0.86867 is: " << angle << " = " << ang_deg << " (in degrees)" << endl; }
Output
The angle (in radian) for given hyperbolic sine value 2.3013 is: 1.5708 = 90.0001 (in degrees) The angle (in radian) for given hyperbolic sine value 11.5487 is: 3.14159 = 180 (in degrees) The angle (in radian) for given hyperbolic sine value 0.86867 is: 0.785397 = 45 (in degrees) The angle (in radian) for given hyperbolic sine value - 0.86867 is: -0.785397 = -45 (in degrees)
The asinh() method, which receives the hyperbolic sine value in this case, returns the angle in radian format. We converted this output from radians to degrees using the formula below.
$$\mathrm{\theta_{deg}\:=\:\theta_{rad}\:\times\frac{180}{\pi}}$$
Conclusion
To conduct the inverse hyperbolic operation using the sine value, we utilize the asinh() function from the cmath package. After receiving the value of the hyperbolic sine as input, this function outputs the desired angle in radians. In older versions of C and C++, the return type was double; later versions of C++ additionally used the overloaded form for float and long-double. The asinh() function will be invoked after casting the input parameter into the double type when an integer value is passed as an argument.