Calculates the hyperbolic sine of a number
#include <math.h>
double sinh ( double x );
float sinhf ( float x ); (C99)
long double sinhl ( long double x ); (C99)
The sinh( ) function returns the hyperbolic sine of its argument x. If the result of sinh( ) is too great for the double type, a range error occurs.
Example
// A chain hanging from two points forms a curve called a catenary.
// A catenary is an segment of the graph of the function
// cosh(k*x)/k, for some constant k.
// The length along the catenary over a certain span, bounded by the
// two vertical lines at x=a and x=b, is equal to sinh(k*b)/k - sinh(k*a)/k.
double x, k;
puts("Catenary f(x) = cosh(k*x)/k\n"
"Length along the catenary from a to b: sinh(k*b)/k - sinh(k*a)/k)\n");
puts(" f(-1.0) f(0.0) f(1.0) f(2.0) Length(-1.0 to 2.0)\n"
"-------------------------------------------------------------------");
for ( k = 0.5; k < 5; k *= 2)
{
printf("k = %.1f: ", k);
for ( x = -1.0; x < 2.1; x += 1.0)
printf("%8.2f ", cosh(k*x)/k );
printf(" %12.2f\n", (sinh(2*k) - sinh(-1*k))/ k);
}
This code produces the following output:
Catenary f(x) = cosh(k*x)/k
Length along the catenary from a to b: sinh(k*b)/k - sinh(k*a)/k)
f(-1.0) f(0.0) f(1.0) f(2.0) Length(-1.0 to 2.0)
---------------------------------------------------------------------
k = 0.5: 2.26 2.00 2.26 3.09 3.39
k = 1.0: 1.54 1.00 1.54 3.76 4.80
k = 2.0: 1.88 0.50 1.88 13.65 15.46
k = 4.0: 6.83 0.25 6.83 372.62 379.44
See Also
cosh( ), tanh( ), asinh( ), csinh( ), casinh( )
|