asin
Compute the inverse sine of parameter in radians.
Base.asin
— Methodasin(x)
Compute the inverse sine of x
, where the output is in radians.
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) @ Base.Math math.jl:1512 [2] asin(::Missing) @ Base.Math math.jl:1533 [3] asin(x::BigFloat) @ Base.MPFR mpfr.jl:860 [4] asin(a::Float16) @ Base.Math math.jl:1511 [5] asin(x::T) where T<:Union{Float32, Float64} @ Base.Math special/trig.jl:428 [6] asin(x::Real) @ Base.Math math.jl:1528 [7] asin(z::Complex) @ complex.jl:938
Examples
julia> using UnicodePlots
julia> 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)
true
Complex
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.0634370688955608im
TODO: Complex3DPlot
Tips
- Call
asind
for 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(J::UniformScaling) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.2/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/uniformscaling.jl:173 [2] asin(D::Diagonal) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.2/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/diagonal.jl:802 [3] asin(A::Hermitian{var"#s5027", S} where {var"#s5027"<:Complex, S<:(AbstractMatrix{<:var"#s5027"})}) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.2/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/symmetric.jl:743 [4] asin(A::Union{Hermitian{var"#s5028", S}, Symmetric{var"#s5028", S}} where {var"#s5028"<:Real, S}) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.2/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/symmetric.jl:734 [5] asin(A::AbstractMatrix) @ LinearAlgebra /opt/hostedtoolcache/julia/1.11.2/x64/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:1242
Base.asin
— Methodasin(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-16im
Tech Notes
asin(::Number)
: by pure juliaasin(::BigFloat)
: by MPFR
Version History
Introduced in 2018 (1.0)
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