acos¶
- acos(x: array, /) array¶
Calculates an implementation-dependent approximation of the principal value of the inverse cosine for each element
x_iof the input arrayx.Each element-wise result is expressed in radians.
Note
The principal value of the arc cosine of a complex number \(z\) is
\[\operatorname{acos}(z) = \frac{1}{2}\pi + j\ \ln(zj + \sqrt{1-z^2})\]For any \(z\),
\[\operatorname{acos}(z) = \pi - \operatorname{acos}(-z)\]Note
For complex floating-point operands,
acos(conj(x))must equalconj(acos(x)).Note
The inverse cosine (or arc cosine) is a multi-valued function and requires a branch cut on the complex plane. By convention, a branch cut is placed at the line segments \((-\infty, -1)\) and \((1, \infty)\) of the real axis.
Accordingly, for complex arguments, the function returns the inverse cosine in the range of a strip unbounded along the imaginary axis and in the interval \([0, \pi]\) along the real axis.
Note: branch cuts follow C99 and have provisional status (see Branch Cuts).
- Parameters:
x (array) – input array. Should have a floating-point data type.
- Returns:
out (array) – an array containing the inverse cosine of each element in
x. The returned array must have a floating-point data type determined by Type Promotion Rules.
Notes
Special cases
For real-valued floating-point operands,
If
x_iisNaN, the result isNaN.If
x_iis greater than1, the result isNaN.If
x_iis less than-1, the result isNaN.If
x_iis1, the result is+0.
For complex floating-point operands, let
a = real(x_i),b = imag(x_i), andIf
ais either+0or-0andbis+0, the result isπ/2 - 0j.If
ais either+0or-0andbisNaN, the result isπ/2 + NaN j.If
ais a finite number andbis+infinity, the result isπ/2 - infinity j.If
ais a nonzero finite number andbisNaN, the result isNaN + NaN j.If
ais-infinityandbis a positive (i.e., greater than0) finite number, the result isπ - infinity j.If
ais+infinityandbis a positive (i.e., greater than0) finite number, the result is+0 - infinity j.If
ais-infinityandbis+infinity, the result is3π/4 - infinity j.If
ais+infinityandbis+infinity, the result isπ/4 - infinity j.If
ais either+infinityor-infinityandbisNaN, the result isNaN ± infinity j(sign of the imaginary component is unspecified).If
aisNaNandbis a finite number, the result isNaN + NaN j.If
aisNaNandbis+infinity, the result isNaN - infinity j.If
aisNaNandbisNaN, the result isNaN + NaN j.
Changed in version 2022.12: Added complex data type support.