asin
result = asin(x)
Input: x · Output: result
What it is
Inverse trigonometric functions, single-argument only (the two-argument form is atan2, below). x is a scalar, Vec, or Mat/Signal; asin/acos expect values in [-1, 1] and return radians in [-π/2, π/2]/[0, π] (an out-of-domain element gives NaN), while atan accepts any real value and returns radians in (-π/2, π/2). Return shape always matches x.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = asin(x) | x scalar, Vec, Mat, or Signalnot documented yet | result — | Returns exactly the same type and shape as x, one angle per element. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
x = 0.5
print("tan={tan(x)} asin={asin(x)} acos={acos(x)} atan={atan(x)}")
print("sinh={sinh(x)} cosh={cosh(x)} tanh={tanh(x)}")
print("ln(e^2)={ln(exp(2))} log(e^2)={log(exp(2))} log2(8)={log2(8)}")
z = 3 + 4j
print("arg={arg(z)} phase={phase(z)} re={re(z)} imag={imag(z)} im={im(z)} conj={conj(z)}")
print(ceil(2.1)) # 3
tan=0.546302 asin=0.523599 acos=1.047198 atan=0.463648 sinh=0.521095 cosh=1.127626 tanh=0.462117 ln(e^2)=2 log(e^2)=2 log2(8)=3 arg=0.927295 phase=0.927295 re=3 imag=4 im=4 conj=3 - 4j 3
from core-math
How it works
sin/cos/tan/asin/acos/atan/sinh/cosh are complex-aware, on the same route as tanh/exp/log/sqrt (map1_complex): real input still takes the real function (a real value outside a real domain, e.g. asin(2), stays NaN rather than silently promoting to complex -- same convention as sqrt(-1)), and an explicit Value::Complex/ CVec/CMat argument takes the complex branch. See Complex64::{sin,cos,tan,asin,acos,atan,sinh,cosh} in qu-core for the identities. sin/cos/sinh/cosh are entire (no poles anywhere in the plane); tan's poles are exactly the real-axis ones real tan already has (see Complex64::tan's doc comment for the proof); asin/acos have branch points at z = +-1. None of these error at a pole/branch point -- Complex64::div already yields non-finite components there, matching the float semantics the rest of the runtime uses (sqrt(-1) doesn't error either).
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.