summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-09-27 07:13:00 -0600
committerGitHub <noreply@github.com>2021-09-27 07:13:00 -0600
commit7af1783837f54eadd19bd9c3337ad4625f3a78fe (patch)
tree0ec34f3057362d300a07607933868207d03ac10e /numpy
parent621d86da82490602bcd780de8d6a913e621f4eb1 (diff)
parent12230243c2889c277b8325b6b0a83ed8f762e9d2 (diff)
downloadnumpy-7af1783837f54eadd19bd9c3337ad4625f3a78fe.tar.gz
Merge pull request #19963 from tupui/doc_emath_scimath
DOC: rename `np.lib.scimath` to `np.emath`
Diffstat (limited to 'numpy')
-rw-r--r--numpy/lib/scimath.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/numpy/lib/scimath.py b/numpy/lib/scimath.py
index ed9ffd295..308f1328b 100644
--- a/numpy/lib/scimath.py
+++ b/numpy/lib/scimath.py
@@ -7,8 +7,7 @@ For example, for functions like `log` with branch cuts, the versions in this
module provide the mathematically valid answers in the complex plane::
>>> import math
- >>> from numpy.lib import scimath
- >>> scimath.log(-math.exp(1)) == (1+1j*math.pi)
+ >>> np.emath.log(-math.exp(1)) == (1+1j*math.pi)
True
Similarly, `sqrt`, other base logarithms, `power` and trig functions are
@@ -223,16 +222,16 @@ def sqrt(x):
--------
For real, non-negative inputs this works just like `numpy.sqrt`:
- >>> np.lib.scimath.sqrt(1)
+ >>> np.emath.sqrt(1)
1.0
- >>> np.lib.scimath.sqrt([1, 4])
+ >>> np.emath.sqrt([1, 4])
array([1., 2.])
But it automatically handles negative inputs:
- >>> np.lib.scimath.sqrt(-1)
+ >>> np.emath.sqrt(-1)
1j
- >>> np.lib.scimath.sqrt([-1,4])
+ >>> np.emath.sqrt([-1,4])
array([0.+1.j, 2.+0.j])
"""
@@ -367,9 +366,9 @@ def logn(n, x):
--------
>>> np.set_printoptions(precision=4)
- >>> np.lib.scimath.logn(2, [4, 8])
+ >>> np.emath.logn(2, [4, 8])
array([2., 3.])
- >>> np.lib.scimath.logn(2, [-4, -8, 8])
+ >>> np.emath.logn(2, [-4, -8, 8])
array([2.+4.5324j, 3.+4.5324j, 3.+0.j ])
"""
@@ -462,11 +461,11 @@ def power(x, p):
--------
>>> np.set_printoptions(precision=4)
- >>> np.lib.scimath.power([2, 4], 2)
+ >>> np.emath.power([2, 4], 2)
array([ 4, 16])
- >>> np.lib.scimath.power([2, 4], -2)
+ >>> np.emath.power([2, 4], -2)
array([0.25 , 0.0625])
- >>> np.lib.scimath.power([-2, 4], 2)
+ >>> np.emath.power([-2, 4], 2)
array([ 4.-0.j, 16.+0.j])
"""