Question: What are Different Hyperbolic Functions in Standard C Library?
Answer: We have following hyperbolic functions defined and prototyped in ‘math.h’ header.
double sinh(double angle); double cosh(double angle); double tanh(double angle);
These functions return the hyperbolic sine, hyperbolic cosine and hyperbolic tangent of their arguments respectively. Each function takes angle, in radians, as its argument. Let’s learn to use ‘sinh()’ in a C program below,
/* fp_sinhyperbolic_fun.c -- 'sinh()' returns hyperbolic sine of */ /* angle in radians */ #include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { double angle, result; printf("User, write in angle ,in radians, whose hyperbolic sine " "to be computed...\n"); scanf("%lf", &angle); /* calling 'sinh()' to compute hyperbolic sine of angle */ result = sinh(angle); printf("hyperbolic sine of \"angle: %lf\" is:%lf\n", angle, result); return 0; }
The sinh() function returns the hyperbolic sine of angle, say x, which is defined mathematically as:
advertisement
advertisement
sinh(x) = (exp(x) - exp(-x)) / 2
Output of the above program follows:
User, write in angle ,in radians, whose hyperbolic sine to be computed... +0.0 hyperbolic sine of "angle: 0.000000" is:0.000000 User, write in angle ,in radians, whose hyperbolic sine to be computed... -0.0 hyperbolic sine of "angle: -0.000000" is:-0.000000 User, write in angle ,in radians, whose hyperbolic sine to be computed... 10 hyperbolic sine of "angle: 10.000000" is:11013.232875 User, write in angle ,in radians, whose hyperbolic sine to be computed... 1000000000000000 hyperbolic sine of "angle: 1000000000000000.000000" is:inf
Observe the last case where output turned out as ‘inf’, short for infinity, for very large angle. Try using other functions to see their outputs.
Sanfoundry Global Education & Learning Series – 1000 C Tutorials.
If you wish to look at all C Tutorials, go to C Tutorials.
advertisement
Related Posts:
- Practice BCA MCQs
- Watch Advanced C Programming Videos
- Check C Books
- Apply for C Internship
- Apply for Computer Science Internship