asin
Compute the principal value of the arc sine of x, return in radians.
Base.asin — Method
asin(x::T) where {T <: Number} -> float(T)Compute the inverse sine of x, where the output is in radians.
Return a T(NaN) if isnan(x).
See also asind for output in degrees.
Examples
julia> asin.((0, 1/2, 1))
(0.0, 0.5235987755982989, 1.5707963267948966)
julia> asind.((0, 1/2, 1))
(0.0, 30.000000000000004, 90.0)Methods
julia> methods(asin, (Any,), [Base, Base.Math, Base.MathConstants, Base.MPFR])# 7 methods for generic function "asin" from Base: [1] asin(a::ComplexF16) @ math.jl:1527 [2] asin(::Missing) @ math.jl:1548 [3] asin(x::BigFloat) @ mpfr.jl:946 [4] asin(a::Float16) @ math.jl:1526 [5] asin(z::Complex) @ complex.jl:938 [6] asin(x::T) where T<:Union{Float32, Float64} @ special/trig.jl:430 [7] asin(x::Real) @ math.jl:1543
Examples
julia> using UnicodePlotsjulia> lineplot(-1, 1, asin)┌────────────────────────────────────────┐ 2 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ asin(x) │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡜│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠃⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠔⠋⠁⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⣀⠤⠖⠋⠁⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⢀⣀⠤⠖⠊⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ f(x) │⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢤⣤⠤⡷⠯⠥⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡠⠤⠒⠋⠁⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⠀⠀⢀⣀⠔⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠀⢠⠔⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⡔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ -2 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └────────────────────────────────────────┘ ⠀-1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀1⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀x⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Real Numbers
julia> asin.([-1.0, -0.5, 0.0, 0.5, 1.0])
5-element Vector{Float64}:
-1.5707963267948966
-0.5235987755982989
0.0
0.5235987755982989
1.5707963267948966
julia> asin(-1.0) ≈ -asin(1.0)
true
julia> asin(0.5)*6 ≈ asin(1.0)*2 ≈ π
true
julia> asin(big"1")*2 == BigFloat(pi)
trueComplex
julia> asin(0-0im)
0.0 + 0.0im
julia> asin.(complex(-4:4))
9-element Vector{ComplexF64}:
-1.5707963267948966 + 2.0634370688955608im
-1.5707963267948966 + 1.762747174039086im
-1.5707963267948966 + 1.3169578969248166im
-1.5707963267948966 + 0.0im
0.0 + 0.0im
1.5707963267948966 + 0.0im
1.5707963267948966 + 1.3169578969248166im
1.5707963267948966 + 1.762747174039086im
1.5707963267948966 + 2.0634370688955608imTODO: Complex3DPlot
Tips
- Call
asindfor output in degrees.
See Also
Extended Inputs
Matrix
With Array like input:
julia> methods(asin, (Any,), [LinearAlgebra])# 5 methods for generic function "asin" from Base: [1] asin(D::Diagonal) @ /opt/hostedtoolcache/julia/1.12.2/x64/share/julia/stdlib/v1.12/LinearAlgebra/src/diagonal.jl:879 [2] asin(J::UniformScaling) @ /opt/hostedtoolcache/julia/1.12.2/x64/share/julia/stdlib/v1.12/LinearAlgebra/src/uniformscaling.jl:176 [3] asin(A::Hermitian{var"#s4811", S} where {var"#s4811"<:Complex, S<:(AbstractMatrix{<:var"#s4811"})}) @ /opt/hostedtoolcache/julia/1.12.2/x64/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetric.jl:929 [4] asin(A::Union{Hermitian{T, S} where S, SymTridiagonal{T, V} where V<:AbstractVector{T}, Symmetric{T, S} where S} where T<:Real) @ /opt/hostedtoolcache/julia/1.12.2/x64/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetric.jl:921 [5] asin(A::AbstractMatrix) @ /opt/hostedtoolcache/julia/1.12.2/x64/share/julia/stdlib/v1.12/LinearAlgebra/src/dense.jl:1380
Base.asin — Method
asin(A::AbstractMatrix)Compute the inverse matrix sine of a square matrix A.
If A is symmetric or Hermitian, its eigendecomposition (eigen) is used to compute the inverse sine. Otherwise, the inverse sine is determined by using log and sqrt. For the theory and logarithmic formulas used to compute this function, see [AH16_2].
Examples
julia> asin(sin([0.5 0.1; -0.2 0.3]))
2×2 Matrix{ComplexF64}:
0.5-4.16334e-17im 0.1-5.55112e-17im
-0.2+9.71445e-17im 0.3-1.249e-16imTech Notes
asin(::Number): by pure juliaasin(::BigFloat): by MPFR
Version History
Introduced in Julia v1.0 (2018)
External Links
- AH16_2Mary Aprahamian and Nicholas J. Higham, "Matrix Inverse Trigonometric and Inverse Hyperbolic Functions: Theory and Algorithms", MIMS EPrint: 2016.4. https://doi.org/10.1137/16M1057577