Hyperbolic functions are defined using hyperbolas instead of circles and are equivalent to ordinary trigonometric functions. It returns the ratio parameter in the hyperbolic sine function from the supplied angle in radians. But do the opposite, or in other words. If we want to calculate an angle from a hyperbolic sine, we need an inverse hyperbolic trigonometric operation like the hyperbolic inverse sine operation.
This lesson will demonstrate how to use the hyperbolic inverse sine (asinh) function in C to calculate angles using the hyperbolic sine value in radians. The hyperbolic arcsine operation follows the following formula -
$$\mathrm{sinh^{-1}x\:=\:In(x\: \:\sqrt{x^2\: \:1})}, where\:In\:is\ :Natural logarithm\:(log_e \: k)$$
According to the hyperbolic sine value, the angle can be calculated using the asinh() function. This function comes with the C standard library. Before using this function we must import the cmath library. This method returns the angle in radians and takes the sine value as argument. The following uses simple syntax -
#include < cmath > asinh( <hyperbolic sine value> )
#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; }
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 in this case receives the hyperbolic sine value and returns the angle in radian format. We convert this output from radians to degrees using the formula below.
$$\mathrm{\theta_{deg}\:=\:\theta_{rad}\:\times\frac{180}{\pi}}$$
To perform inverse hyperbolic operations using sine values, we use the asinh() function from the cmath package. After receiving a hyperbolic sine value as input, the function outputs the desired angle in radians. In older versions of C and C, the return type is double; later versions of C also use overloaded forms of float and long-double. When an integer value is passed as an argument, the asinh() function is called after converting the input argument to type double.
The above is the detailed content of C++ program to find the value of the inverse hyperbolic sine function taking a given value as argument. For more information, please follow other related articles on the PHP Chinese website!