# ACOS Function

For input values between -1 and 1 inclusive, this function returns the angle in radians whose cosine value is the input. This function is the inverse of the cosine function. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.

Note

While this function returns values outside of the range -1 <= x <= 1, those values are not considered valid.

Arc secant:

The arc secant function is computed as follows:

Input Range

Output computation

x<=-1

acos(1/x)

x>=1

acos(1/x)

-1<x<1

Not valid

Wrangle vs. SQL: This function is part of Wrangle, a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.

## Basic Usage

Numeric literal example:

acos(0.5)

Output: Returns the computation of the arc cosine of 0.5. Output value is in radians.

Column reference example:

acos(X)

Output: Returns the arc cosine of the values in X column.

## Syntax and Arguments

acos(numeric_value)

Argument

Required?

Data Type

Description

numeric_value

Y

string, decimal, or integer

Name of column, Decimal or Integer literal, or function returning those types to apply to the function

### numeric_value

Name of the column, Integer or Decimal literal, or function returning that data type to apply to the function.

• Missing input values generate missing results.

• Literal numeric values should not be quoted. Quoted values are treated as strings.

• Multiple columns and wildcards are not supported.

Usage Notes:

Required?

Data Type

Example Value

Yes

String (column reference) or Integer or Decimal literal

0.5

## Examples

Astuce

### Example - Trigonometry Arc functions

This example illustrates how to apply the inverse trigonometric (Arc) functions to your transformations.

Functions:

Item

Description

ASIN Function

For input values between -1 and 1 inclusive, this function returns the angle in radians whose sine value is the input. This function is the inverse of the sine function. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.

ACOS Function

For input values between -1 and 1 inclusive, this function returns the angle in radians whose cosine value is the input. This function is the inverse of the cosine function. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.

ATAN Function

For input values between -1 and 1 inclusive, this function returns the angle in radians whose tangent value is the input. This function is the inverse of the tangent function. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.

Also:

Item

Description

ROUND Function

Rounds input value to the nearest integer. Input can be an Integer, a Decimal, a column reference, or an expression. Optional second argument can be used to specify the number of digits to which to round.

DEGREES Function

Computes the degrees of an input value measuring the radians of an angle. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.

Note

These functions are valid over specific ranges.

The following functions are computed using the above functions.

• Arccotangent. Computed using ATAN function. See below.

• Arcsecant. Computed using ACOS function. See below.

• Arccosecant. Computed using ASIN function. See below.

Source:

In the following sample, input values are in radians. In this example, all values are rounded to two decimals for clarity.

Y

-1.00

-0.75

-0.50

0.00

0.50

0.75

1.00

Transformation:

Arcsine:

Valid over the range (-1 <= Y <= 1)

 Transformation Name New formula Single row formula round(degrees(asin(Y)), 2) 'asinY'

Arccosine:

Valid over the range (-1 <= Y <= 1)

 Transformation Name New formula Single row formula round(degrees(acos(Y)), 2) 'acosY'

Arctangent:

Valid over the range (-1 <= Y <= 1)

 Transformation Name New formula Single row formula round(degrees(atan(Y)), 2) 'atanY'

Arccosecant:

This function is valid over a set of ranged inputs, so you can use a conditional column for the computation.

 Transformation Name Conditional column if...then...else (Y <= -1) || (Y >= 1) round(degrees(asin(divide(1, Y))), 2) 'acscY'

Arcsecant:

Same set of ranged inputs apply to this function.

 Transformation Name Conditional column if...then...else (Y <= -1) || (Y >= 1) round(degrees(acos(divide(1, Y))), 2) 'asecY'

Arccotangent:

For this function, the two different ranges of inputs have different computations, so an else condition is added to the transformation.

 Transformation Name Conditional column if...then...else Y > 0 round(degrees(atan(divide(1, Y))), 2) round(degrees(atan(divide(1, Y)) + pi()), 2) 'acotY'

Results:

Y

acotY

asecY

acscY

atanY

acosY

asinY

-1.00

-41.86

180.00

-90.00

-45.00

180.00

-90.00

-0.75

-49.99

null

null

-37.00

139.00

-49.00

-0.50

-60.29

null

null

-27.00

120.00

-30.00

0.00

null

null

null

0.00

90.00

0.00

0.50

63.44

null

null

27.00

60.00

30.00

0.75

53.13

null

null

37.00

41.00

49.00

1.00

45.00

0.00

90.00

45.00

0.00

90.00