Compute the inverse cosine of x. Return the "principal value" (for a description of this, see `numpy.arccos`) of the inverse cosine of `x`. For real `x` such that `abs(x) <= 1`, this is a real number in the closed interval :math:`[0, \\pi]`. Otherwise, the complex principle va
(x)
| 494 | @set_module('numpy.lib.scimath') |
| 495 | @array_function_dispatch(_unary_dispatcher) |
| 496 | def arccos(x): |
| 497 | """ |
| 498 | Compute the inverse cosine of x. |
| 499 | |
| 500 | Return the "principal value" (for a description of this, see |
| 501 | `numpy.arccos`) of the inverse cosine of `x`. For real `x` such that |
| 502 | `abs(x) <= 1`, this is a real number in the closed interval |
| 503 | :math:`[0, \\pi]`. Otherwise, the complex principle value is returned. |
| 504 | |
| 505 | Parameters |
| 506 | ---------- |
| 507 | x : array_like or scalar |
| 508 | The value(s) whose arccos is (are) required. |
| 509 | |
| 510 | Returns |
| 511 | ------- |
| 512 | out : ndarray or scalar |
| 513 | The inverse cosine(s) of the `x` value(s). If `x` was a scalar, so |
| 514 | is `out`, otherwise an array object is returned. |
| 515 | |
| 516 | See Also |
| 517 | -------- |
| 518 | numpy.arccos |
| 519 | |
| 520 | Notes |
| 521 | ----- |
| 522 | For an arccos() that returns ``NAN`` when real `x` is not in the |
| 523 | interval ``[-1,1]``, use `numpy.arccos`. |
| 524 | |
| 525 | Examples |
| 526 | -------- |
| 527 | >>> import numpy as np |
| 528 | >>> np.set_printoptions(precision=4) |
| 529 | |
| 530 | >>> np.emath.arccos(1) # a scalar is returned |
| 531 | 0.0 |
| 532 | |
| 533 | >>> np.emath.arccos([1,2]) |
| 534 | array([0.-0.j , 0.-1.317j]) |
| 535 | |
| 536 | """ |
| 537 | x = _fix_real_abs_gt_1(x) |
| 538 | return nx.arccos(x) |
| 539 | |
| 540 | |
| 541 | @set_module('numpy.lib.scimath') |
searching dependent graphs…