 Download topic as PDF

# Trig and Hyperbolic functions

The following list contains the functions that you can use to calculate trigonometry and hyperbolic values.

For information about using string and numeric fields in functions, and nesting functions, see Overview of SPL2 eval functions.

## acos(x)

This function computes the arc cosine of `x`, in the interval [0,pi] radians.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic examples

The following example calculates the arc cosine of 0.

`... | eval n=acos(0)`

The following example calculates 180 divided by pi and multiplies the result by the arc cosine of 0.

`... | eval degrees=acos(0)*180/pi()`

## acosh(x)

This function computes the arc hyperbolic cosine of `x`, in radians.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

`... | eval n=acosh(2)`

## asin(x)

This function computes the arc sine of `x`, in the interval [-pi/2,+pi/2] radians.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

The following example calculates the arc sine of 1.

`... | eval n=asin(1)`

The following example calculates 180 divided by pi and multiplies that by the arc sine of 1.

`... | eval degrees=asin(1)*180/pi()`

## asinh(x)

This function computes the arc hyperbolic sine of `x`, in radians.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

The following example calculates the arc hyperbolic sine of 1.

`... | eval n=asinh(1)`

## atan(x)

This function computes the arc tangent of `x`, in the interval [-pi/2,+pi/2] radians.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

`... | eval n=atan(0.50)`

## atan2(y, x)

This function computes the arc tangent of `y, x` in the interval [-pi,+pi] radians.

• y is a value that represents the proportion of the y-coordinate.
• x is the value that represents the proportion of the x-coordinate.

To compute the value, the function takes into account the sign of both arguments to determine the quadrant.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

`... | eval n=atan2(0.50, 0.75)`

## atanh(x)

This function computes the arc hyperbolic tangent of `x`, in radians.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

`... | eval n=atanh(0.500)`

## cos(x)

This function computes the cosine of an angle of `x` radians.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

The following example calculates the cosine of -1.

`... | eval n=cos(-1)`

The following example calculates the cosine of pi.

`... | eval n=cos(pi())`

## cosh(x)

This function computes the hyperbolic cosine of `x` radians.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

Calculates the hyperbolic cosine of 1.

`... | eval n=cosh(1)`

## hypot(x,y)

This function computes the hypotenuse of a right-angled triangle whose legs are `x` and `y`.

The function returns the square root of the sum of the squares of X and Y, as described in the Pythagorean theorem.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

Creates a field called `n` and returns `n=5`, which is the hypotenuse of a triangle whose legs are 3 and 4.

`... | eval n=hypot(3,4)`

## sin(x)

This function computes the sine of `x`.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic examples

The following example calculates the sine of 1.

`... | eval n=sin(1)`

The following search calculates the sine of pi divided by 180 and then multiplied by 90.

`... | eval n=sin(90 * pi()/180)`

## sinh(x)

This function computes the hyperbolic sine of `x`.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

`... | eval n=sinh(1)`

## tan(x)

This function computes the tangent of `x`.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

`... | eval n=tan(1)`

## tanh(x)

This function computes the hyperbolic tangent of `x`.

### Usage

You can use this function with the `eval` and ` where` commands, in the WHERE clause of the `from` command, and as part of evaluation expressions with other commands.

### Basic example

`... | eval n=tanh(1)`

Functions
SPL2 eval functions Quick Reference
Overview of SPL2 eval functions