COS

COS(value)[source]

Computes the cosine of a given number or numeric array.

This function calculates the trigonometric cosine of a given number or array of numbers, where the input is interpreted in radians. If an array of numbers is provided, the cosine is calculated for each element individually. If the input is blank or in an error state, the formula will evaluate to an error.

Parameters:

value (int | float | Operand) –

The numeric input, in radians, whose cosine is to be computed.

Supported types:

  • INTEGER

  • DECIMAL

  • INTEGER_ARRAY

  • DECIMAL_ARRAY

Return type:

Formula

Returns:

A Formula object representing the computed cosine.

Supported types:

  • DECIMAL

  • DECIMAL_ARRAY

Raises:

ValueError – If value is not a numeric type or a numeric array.

Examples

Basic usage with a scalar:

COS(0)
# Returns 1.0

Usage with a model object:

COS(my_numeric_field)
# Returns a formula representing the cosine of `my_numeric_field` (in radians)

Usage with an array:

COS([0, 1.5707963, 3.1415927])
# Returns [1.0, 0.0, -1.0] approximately