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.

Return type:

Formula

Returns:

A Formula object representing the computed cosine.

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

``value`` — accepted types

  • DECIMAL

  • DECIMAL_ARRAY

  • INTEGER

  • INTEGER_ARRAY

Return types

  • DECIMAL

  • DECIMAL_ARRAY