Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

coth

Use the coth() function to calculate the hyperbolic cotangent of a numeric value. The hyperbolic cotangent is the reciprocal of the hyperbolic tangent function.

Syntax

coth(<number>)

Parameters

Name
Type
Required
Description

number

integer, float

Yes

The numeric value for which to calculate the hyperbolic cotangent. The value must not be zero.

Returns

Type: float

Description: The coth() function returns the hyperbolic cotangent of the input value, which is equivalent to cosh(x) / sinh(x) or 1 / tanh(x). If the input is null, 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 coth() function accepts any real number except zero, where the hyperbolic cotangent is undefined.

  • Undefined at Zero: coth(0) is undefined and returns infinity, NaN, or null.

  • Null Handling: If the input expression is null, the function returns null.

  • Asymptotic Behavior: As x approaches positive infinity, coth(x) approaches 1.0. As x approaches negative infinity, coth(x) approaches -1.0.

  • Symmetry: The function is odd, meaning coth(-x) = -coth(x).

  • Common Use Cases: This function is typically used within the alter stage for mathematical modeling, heat transfer calculations, and scientific computations.

Examples

Example 1: Calculate hyperbolic cotangent of literal values

Goal: Calculate the hyperbolic cotangent for specific numeric literals to verify known mathematical results.

XQL code:

Explanation: You use coth() on three different literal values. coth(1) returns approximately 1.3130, coth(2) returns approximately 1.0373, and coth(-1) returns approximately -1.3130, demonstrating the odd symmetry of the function.

Output:

RESULT1
RESULT2
RESULT3

1.31304

1.03731

-1.31304

Example 2: Calculate hyperbolic cotangent from a field value

Goal: Calculate the hyperbolic cotangent of values stored in a dataset field, filtering out zero values.

XQL code:

Explanation: This query filters out zero values (where hyperbolic cotangent is undefined), then computes the hyperbolic cotangent for each remaining value in the numeric_value field.

Output:

EVENT_ID
NUMERIC_VALUE
COTH_RESULT

101

0.5

2.16396

102

1.0

1.31304

103

3.0

1.00497

Example 3: Verify coth as reciprocal of tanh

Goal: Demonstrate that coth(x) equals 1 / tanh(x) by computing both and comparing.

XQL code:

Explanation: This query computes both coth(numeric_value) and 1 / tanh(numeric_value) to verify they produce the same result, confirming the mathematical identity coth(x) = 1 / tanh(x).

Output:

EVENT_ID
NUMERIC_VALUE
COTH_VAL
RECIPROCAL_TANH

101

0.5

2.16396

2.16396

102

1.0

1.31304

1.31304

103

3.0

1.00497

1.00497

Last updated

Was this helpful?