csc
csc(x)
Compute the cosecant of x, where x is in radians
Examples
-
Compute the cosecant of a single value:
julia> csc(1.0) 1.1883951057781212This example calculates the cosecant of 1.0 radians.
-
Compute the cosecant of an array of values:
julia> angles = [0.0, π/6, π/4, π/3, π/2]; julia> csc.(angles) 5-element Array{Float64,1}: Inf 2.0 1.4142135623730951 1.7320508075688772 1.0It computes the cosecant of each element in the
anglesarray. - Compute the cosecant of a negative value:
julia> csc(-2.0) -1.0997501702946164This example calculates the cosecant of -2.0 radians.
Common mistake example:
julia> csc([0, π/2, π])
ERROR: MethodError: no method matching csc(::Array{Float64,1})
In this example, an array of angles is passed to the csc function. However, the csc function does not support arrays as input. It can only compute the cosecant of individual values. To calculate the cosecant of multiple angles, you can use broadcasting (.) as shown in example 2.
See Also
acos, acosd, acosh, acot, acotd, acoth, acsc, acscd, acsch, asec, asecd, asech, asin, asind, asinh, atan, atan2, atand, atanh, cos, cosc, cosd, cosh, cospi, cot, cotd, coth, csc, cscd, csch, deg2rad, rad2deg, sin, sinc, sind, sinh, sinpi, tan, tand, tanh,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.