cosh
Compute the hyperbolic cosine of x
.
Base.cosh
— Functioncosh(x)
Compute hyperbolic cosine of x
.
cosh(A::AbstractMatrix)
Compute the matrix hyperbolic cosine of a square matrix A
.
Methods
julia> methods(cosh, (Any,), [Base, Base.Math, Base.MathConstants, Base.MPFR])
# 7 methods for generic function "cosh" from Base: [1] cosh(a::Float16) @ Base.Math math.jl:1511 [2] cosh(a::ComplexF16) @ Base.Math math.jl:1512 [3] cosh(::Missing) @ Base.Math math.jl:1533 [4] cosh(x::BigFloat) @ Base.MPFR mpfr.jl:733 [5] cosh(x::T) where T<:Union{Float32, Float64} @ Base.Math special/hyperbolic.jl:103 [6] cosh(x::Real) @ Base.Math math.jl:1528 [7] cosh(z::Complex) @ complex.jl:986
Examples
julia> using UnicodePlots
julia> lineplot(-3, 3, cosh, ylim=(-10, 10))
┌────────────────────────────────────────┐ 10 │⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜│ cosh(x) │⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡜⠀│ │⠀⠀⠑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⠀⠀│ │⠀⠀⠀⠈⠦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡤⠃⠀⠀⠀│ │⠀⠀⠀⠀⠀⠉⠦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠋⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠈⠒⠦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠚⠁⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠒⠒⠤⠤⠤⠤⠤⡧⠤⠤⠤⠤⠖⠒⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ f(x) │⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⡧⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ -10 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └────────────────────────────────────────┘ ⠀-3⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀3⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀x⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Real Numbers
julia> cosh(0)
1.0
julia> cosh(1.0)
1.5430806348152437
Complex
julia> cosh(0+0im)
1.0 - 0.0im
Tips
See Also
Extended Inputs
Matrix
With Array
like input:
julia> methods(cosh, (Any,), [LinearAlgebra])
# 5 methods for generic function "cosh" from Base: [1] cosh(J::UniformScaling) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.5/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/uniformscaling.jl:173 [2] cosh(A::Hermitian{var"#s5028", S} where {var"#s5028"<:Complex, S<:(AbstractMatrix{<:var"#s5028"})}) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.5/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/symmetric.jl:714 [3] cosh(D::Diagonal) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.5/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/diagonal.jl:802 [4] cosh(A::Union{Hermitian{var"#s5029", S}, Symmetric{var"#s5029", S}} where {var"#s5029"<:Real, S}) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.5/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/symmetric.jl:710 [5] cosh(A::AbstractMatrix) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.5/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:1148
Tech Notes
cosh(::Real)
: by pure juliacosh(::BigFloat)
: by MPFR
Version History
Introduced in Julia v1.0 (2018)