COS Function

Calculates the cosine of the input variable.

enabled.

Usage

    result = COS(x)

Input Parameters

x—The angle for which the cosine is desired, specified in radians.

Returned Value

result—The trigonometric cosine of x.

Keywords

None.

Discussion

If x is a double-precision floating-point or complex data type, the result is of the same type. All others yield a single-precision floating-point result.

COS handles complex numbers in the following manner:

    cos(x) = complex(cos(i)cosh(r), –sin(r)sinh(–i))

where r and i are the real and imaginary parts of x. If x is an array, the result of COS has the same dimensions (size and shape) as x, with each element containing the cosine of the corresponding element of x.

Example

x = [-60, -30, 0, 30, 60]
PRINT, COS(x * !Dtor)
; PV-WAVE prints: 0.500000 0.866025 1.00000 0.866025   0.500000

See Also

ACOS, ASIN, ATAN, COSH, COSINES, SIN, TAN

For a list of other transcendental functions, see Transcendental Mathematical Functions.