cosd

Compute the cosine of x expressed in degrees.

Base.Math.cosdFunction
cosd(x)

Compute cosine of x, where x is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source

Methods

julia> methods(cosd, (Any,), [Base, Base.Math, Base.MathConstants, Base.MPFR])# 3 methods for generic function "cosd" from Base.Math:
 [1] cosd(x::BigFloat)
     @ Base.MPFR mpfr.jl:880
 [2] cosd(x::Real)
     @ special/trig.jl:1214
 [3] cosd(x)
     @ special/trig.jl:1268

Examples

Real Numbers

julia> cosd(0)
1.0

julia> cosd(-0.0)
1.0

julia> cosd(60)
0.5

julia> cosd(90)
0.0

julia> cosd(180)
-1.0

Complex

julia> cosd(0+0im)
1.0 - 0.0im

Tips

See Also

cos

Extended Inputs

Tech Notes

  • Implemented in terms of cos: cosd(deg) = cos(deg2rad(deg))

Version History

Introduced in Julia v1.0 (2018)