acosh
Use the acosh() function to calculate the inverse hyperbolic cosine of a numeric value.
Syntax
acosh(<number>)Parameters
number
integer, float
Yes
The numeric value to evaluate. The value must be greater than or equal to 1.
Returns
Type: float
Description: The acosh() function returns the inverse hyperbolic cosine of the input value. If the input is null or less than 1, the function returns null.
Usage notes
Input type: XQL doesn't support NaN or infinite values as input and these value types also can not be returned.
Valid Input Range: The input
numbermust be greater than or equal to 1 (x ≥ 1). Mathematically, the inverse hyperbolic cosine is only defined for values in this range.Out of Range Behavior: If the input is less than 1, the function returns
null.Null Handling: If the input expression is
null, the function returnsnull.Common Use Cases: This function is typically used within the
alterstage to create new fields containing the calculated results. It is useful in mathematical modeling, signal processing, and scientific computations.Identity Value:
acosh(1)always returns0.0, sincecosh(0) = 1.
Examples
Example 1: Calculate inverse hyperbolic cosine of literal values
Goal: Calculate the inverse hyperbolic cosine for specific numeric literals to verify known mathematical results.
XQL code:
Explanation: You use acosh() on three different literal values. The function calculates the inverse hyperbolic cosine for each. acosh(1) returns 0.0 because cosh(0) = 1. acosh(2) returns approximately 1.317, and acosh(10) returns approximately 2.993.
Output:
0.0
1.31696
2.99322
Example 2: Calculate inverse hyperbolic cosine from a field value
Goal: Calculate the inverse hyperbolic cosine of values stored in a specific field, ensuring they are within the valid mathematical range.
XQL code:
Explanation: This query first filters the dataset to ensure numeric_value contains only values greater than or equal to 1, avoiding mathematically invalid inputs. It then computes the inverse hyperbolic cosine for each value using acosh() in the alter stage and stores the result in acosh_result. For example, the inverse hyperbolic cosine of 1.0 evaluates to 0.0.
Output:
101
1.0
0.0
102
1.54308
1.0
103
3.76219
2.0
Example 3: Apply inverse hyperbolic cosine to a calculated expression
Goal: Compute the inverse hyperbolic cosine of a derived value by first transforming a field to ensure it falls within the valid input range.
XQL code:
Explanation: Since acosh() requires input values of 1 or greater, this query first creates adjusted_value by adding 1 to the absolute value of duration_seconds, guaranteeing the result is always ≥ 1. The acosh() function is then applied to this adjusted value.
Output:
101
1.5
2.5
1.56680
102
0.8
1.8
1.19205
103
10.2
11.2
3.10746
Related articles
Datasets:
sample_xql_raw,xdr_dataXQL recipes: XQL Recipes
Was this helpful?
