Library Function Math h Tanh()
Tanh() library function in Math
The tanh()
function is a part of the C math library and is used to calculate the hyperbolic tangent of a given number.The tanh()
function takes a single argument of type double
, float
, or long double
and returns the hyperbolic tangent of the number as a value of the same type. Let us understand more about Library Function Math h Tanh().
Library Function Math h Tanh()
The hyperbolic tangent of a number is defined as the ratio of the hyperbolic sine of the number to the hyperbolic cosine of the number. It is represented by the following equation:
tanh(x) = sinh(x) / cosh(x)
Here is the syntax for the tanh()
function in C:
#include <math.h>
double tanh(double x);
float tanhf(float x);
long double tanhl(long double x);
Here is an example of how to use the tan()
function in C:
#include <stdio.h>
#include <math.h> int main(void) { double angle = 1.57; double tangent = tan(angle); printf("The tangent of %f is %f\n", angle, tangent); return 0; }
Output
The tangent of 1.570000 is 1255.765592
Tanh() important details
Here are some of the important facts about tanh() library math function.
The tanh()
function is often used in mathematical and scientific computing, as it has applications in areas such as probability theory, statistical mechanics, and neural networks.
Here are some facts about the tanh()
function in C:
The
tanh()
function is defined as the hyperbolic tangent of a number x, which is represented by the equationtanh(x) = (e^x - e^(-x)) / (e^x + e^(-x))
.The
tanh()
function is defined for all real numbers x.The
tanh()
function has a range of -1 to 1.The
tanh()
function is an odd function, which means thattanh(-x) = -tanh(x)
for all x.The
tanh()
function is a monotonically increasing function.The
tanh()
function is used in various fields, including machine learning and neural networks, where it is used as an activation function.
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment