TANH function
The TANH function in Excel is used to calculate the hyperbolic tangent of a given number. The hyperbolic tangent is a mathematical function that is related to the hyperbolic sine and hyperbolic cosine functions. It is often used in advanced mathematics, physics, engineering, and in certain machine learning algorithms, especially in neural networks.
The formula for the hyperbolic tangent is:
Where:
- is the hyperbolic sine of
- is the hyperbolic cosine of
The result of the TANH function will always be between -1 and 1 for any real input value.
Syntax
=TANH(number)
Parameters
- number (required): The number (or cell reference) for which you want to calculate the hyperbolic tangent. This number can be any real number, and Excel will compute the hyperbolic tangent for that number.
Key Points
- Range of Output: The result of the
TANHfunction will always be between -1 and 1. For very large positive or negative numbers, the result will approach 1 and -1, respectively. - Behavior at Extremes:
- As the input number increases towards positive infinity, the output approaches 1.
- As the input number decreases towards negative infinity, the output approaches -1.
- Use in Machine Learning: In machine learning, the
TANHfunction is commonly used as an activation function in neural networks. It maps input values to a range between -1 and 1, which can help with centering data around zero.
Examples
- Basic Example: To calculate the hyperbolic tangent of 1:
=TANH(1)Result: The hyperbolic tangent of 1 is approximately 0.7616.
- Negative Input: To calculate the hyperbolic tangent of -1:
=TANH(-1)Result: The hyperbolic tangent of -1 is approximately -0.7616.
- Large Positive Input: To calculate the hyperbolic tangent of 10:
=TANH(10)Result: The result will be approximately 1, as the hyperbolic tangent of large positive numbers approaches 1.
- Large Negative Input: To calculate the hyperbolic tangent of -10:
=TANH(-10)Result: The result will be approximately -1, as the hyperbolic tangent of large negative numbers approaches -1.
- Using a Cell Reference: If cell A1 contains the value 0.5, the formula:
=TANH(A1)Will return the hyperbolic tangent of the value in cell A1.
Notes
- Extremely Large Inputs: For very large inputs, Excel might round the result to 1 or -1. For practical purposes, it’s important to understand that the function is asymptotic and approaches these values.
- Behavior Near Zero: The hyperbolic tangent of 0 is 0. The function has a smooth curve, and its slope is steepest near 0, where it behaves similarly to the tangent function but for real numbers.
Related Functions
SINH: Calculates the hyperbolic sine of a number.COSH: Calculates the hyperbolic cosine of a number.TAN: The regular tangent function (trigonometric function) for angles in radians.ASINH: Returns the inverse of the hyperbolic sine (area hyperbolic sine) of a number.ACOSH: Returns the inverse of the hyperbolic cosine (area hyperbolic cosine) of a number.ATANH: Returns the inverse hyperbolic tangent of a number.
The TANH function is often used in scientific and engineering applications, particularly in situations where hyperbolic functions are needed for modeling certain physical phenomena or for data transformation in machine learning.