Calculates the hyperbolic tangent of a field.
Note
Math functions on ARM architecture may return different results in very high-precision calculationsc compared to Intel/AMD architectures.
Hide omitted argument names for this function
Omitted Argument NamesThe argument name for
field
can be omitted; the following forms of this function are equivalent:logscale Syntaxmath:tanh("value")
and:
logscale Syntaxmath:tanh(field="value")
These examples show basic structure only.
math:tanh()
Examples
Click
next to an example below to get the full details.Calculate Hyperbolic Tangent Values
Calculate hyperbolic tangent using the
math:tanh()
function
Query
myvalue := 120
| math:tanh(myvalue, as=tanh_value)
Introduction
In this example, the math:tanh()
function is used
to calculate the hyperbolic tangent of an assigned value of
120
.
Step-by-Step
Starting with the source repository events.
- logscale
myvalue := 120
Assigns the value
120
to a field named myvalue. This creates a new field with a constant value that will be used for the hyperbolic tangent calculation. - logscale
| math:tanh(myvalue, as=tanh_value)
Calculates the hyperbolic tangent of the value in the myvalue field and returns the result in a new field named tanh_value. The result will be between
-1
and1
, with larger input values producing results closer to-1
or1
.Since
120
is a large positive number, the result will be very close to1
due to the asymptotic nature of the hyperbolic tangent function.Mathematically,
tanh(x) = sinh(x)/cosh(x) = (eˣ - e⁻ˣ)/(eˣ + e⁻ˣ)
, wheree
is Euler's number. Event Result set.
Summary and Results
The query calculates the hyperbolic tangent of a fixed value of
120
. Unlike regular tangent, hyperbolic tangent is
not periodic and approaches -1
or
1
asymptotically as the input increases or decreases.
This query is useful for neural network activation functions, signal processing, data normalization, machine learning applications, and control systems.
Sample output from the incoming example data:
tanh_value |
---|
1.000 |
The result is 1.000
because the input value (120) is
large enough that tanh(120)
is effectively at its
asymptotic limit of 1
.
Note that any input value above approximately 5
will
result in a value greater than 0.999
, demonstrating
how quickly the hyperbolic tangent function approaches its asymptotic
limits.
If, for example, the calculation had been performed on the input values
4
, -1
and 5
,
then these values are in the range where the hyperbolic tangent function
shows its characteristic S-shaped curve behavior, before approaching its
asymptotic limit. Sample output would be:
tanh_value1 | tanh_value2 | tanh_value3 |
---|---|---|
0.999 | -0.762 | 1.000 |