Skip to content

Commit

Permalink
DOC: emath: add scalar output examples to documentation (#23611)
Browse files Browse the repository at this point in the history
* DOC: emath: add scalar output examples to documentation

Co-authored-by: Sarah Wang <sarahwang688@fb.com>
  • Loading branch information
Sarah-Yifei-Wang and Sarah Wang committed Dec 31, 2023
1 parent f1fac82 commit 36eefea
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions numpy/lib/_scimath_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,21 @@ def power(x, p):
--------
>>> np.set_printoptions(precision=4)
>>> np.emath.power(2, 2)
4
>>> np.emath.power([2, 4], 2)
array([ 4, 16])
>>> np.emath.power([2, 4], -2)
array([0.25 , 0.0625])
>>> np.emath.power([-2, 4], 2)
array([ 4.-0.j, 16.+0.j])
>>> np.emath.power([2, 4], [2, 4])
array([ 4, 256])
"""
x = _fix_real_lt_zero(x)
p = _fix_int_lt_zero(p)
Expand Down Expand Up @@ -611,6 +619,9 @@ def arctanh(x):
--------
>>> np.set_printoptions(precision=4)
>>> np.emath.arctanh(0.5)
0.5493061443340549
>>> from numpy.testing import suppress_warnings
>>> with suppress_warnings() as sup:
... sup.filter(RuntimeWarning)
Expand Down

0 comments on commit 36eefea

Please sign in to comment.