Skip to content

Commit 7af1783

Browse files
authored
Merge pull request numpy#19963 from tupui/doc_emath_scimath
DOC: rename `np.lib.scimath` to `np.emath`
2 parents 621d86d + 1223024 commit 7af1783

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

numpy/lib/scimath.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
module provide the mathematically valid answers in the complex plane::
88
99
>>> import math
10-
>>> from numpy.lib import scimath
11-
>>> scimath.log(-math.exp(1)) == (1+1j*math.pi)
10+
>>> np.emath.log(-math.exp(1)) == (1+1j*math.pi)
1211
True
1312
1413
Similarly, `sqrt`, other base logarithms, `power` and trig functions are
@@ -223,16 +222,16 @@ def sqrt(x):
223222
--------
224223
For real, non-negative inputs this works just like `numpy.sqrt`:
225224
226-
>>> np.lib.scimath.sqrt(1)
225+
>>> np.emath.sqrt(1)
227226
1.0
228-
>>> np.lib.scimath.sqrt([1, 4])
227+
>>> np.emath.sqrt([1, 4])
229228
array([1., 2.])
230229
231230
But it automatically handles negative inputs:
232231
233-
>>> np.lib.scimath.sqrt(-1)
232+
>>> np.emath.sqrt(-1)
234233
1j
235-
>>> np.lib.scimath.sqrt([-1,4])
234+
>>> np.emath.sqrt([-1,4])
236235
array([0.+1.j, 2.+0.j])
237236
238237
"""
@@ -367,9 +366,9 @@ def logn(n, x):
367366
--------
368367
>>> np.set_printoptions(precision=4)
369368
370-
>>> np.lib.scimath.logn(2, [4, 8])
369+
>>> np.emath.logn(2, [4, 8])
371370
array([2., 3.])
372-
>>> np.lib.scimath.logn(2, [-4, -8, 8])
371+
>>> np.emath.logn(2, [-4, -8, 8])
373372
array([2.+4.5324j, 3.+4.5324j, 3.+0.j ])
374373
375374
"""
@@ -462,11 +461,11 @@ def power(x, p):
462461
--------
463462
>>> np.set_printoptions(precision=4)
464463
465-
>>> np.lib.scimath.power([2, 4], 2)
464+
>>> np.emath.power([2, 4], 2)
466465
array([ 4, 16])
467-
>>> np.lib.scimath.power([2, 4], -2)
466+
>>> np.emath.power([2, 4], -2)
468467
array([0.25 , 0.0625])
469-
>>> np.lib.scimath.power([-2, 4], 2)
468+
>>> np.emath.power([-2, 4], 2)
470469
array([ 4.-0.j, 16.+0.j])
471470
472471
"""

0 commit comments

Comments
 (0)