csc
Compute the cosecant of x
expressed in radians.
Base.Math.csc
— Functioncsc(x)
Compute the cosecant of x
, where x
is in radians.
csc(A::AbstractMatrix)
Compute the matrix cosecant of a square matrix A
.
Methods
julia> methods(csc, (Any,), [Base, Base.Math, Base.MathConstants, Base.MPFR])
# 2 methods for generic function "csc" from Base.Math: [1] csc(x::BigFloat) @ Base.MPFR mpfr.jl:860 [2] csc(z::Number) @ special/trig.jl:1135
Examples
julia> using UnicodePlots
julia> lineplot(-2π, 2π, csc, xlim=(-7, 7), ylim=(-4, 4))
┌────────────────────────────────────────┐ 4 │⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ csc(x) │⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⡀⠀⠀⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⡇⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⡇⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⢣⠀⠀⠀⠀⠀⣸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⢇⠀⠀⠀⠀⠀⡸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠘⡄⠀⠀⠀⢠⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠸⡄⠀⠀⠀⢠⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠈⠢⠤⠔⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠘⠢⠤⠔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ f(x) │⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⡧⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠒⠢⡄⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠔⠒⠢⡀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠃⠀⠀⠀⠘⡄⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⠃⠀⠀⠀⠘⡄⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡞⠀⠀⠀⠀⠀⢹⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⡎⠀⠀⠀⠀⠀⢱⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⢸⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⢸⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⠁⠀⠀⠀⠀⠀⠀⡇⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠈⡆⠀⠀│ -4 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⡇⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀│ └────────────────────────────────────────┘ ⠀-7⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀7⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀x⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Real Numbers
julia> csc(0)
Inf
julia> csc(-0.0)
-Inf
julia> csc(pi/2)
1.0
julia> csc(pi)
Inf
Complex
julia> csc(0+0im)
NaN + NaN*im
Tips
See Also
Extended Inputs
Matrix
With Array
like input:
julia> methods(csc, (Any,), [LinearAlgebra])
# 3 methods for generic function "csc" from Base.Math: [1] csc(J::UniformScaling) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.5/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/uniformscaling.jl:173 [2] csc(D::Diagonal) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.5/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/diagonal.jl:802 [3] csc(A::AbstractMatrix{T}) where T @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.5/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:1348
Tech Notes
- Implemented in terms of
sin
:csc(x) = inv(sin(x))
Version History
Introduced in Julia v1.0 (2018)