diff options
author | Gagandeep Singh <gdp.1807@gmail.com> | 2021-11-02 11:28:17 +0530 |
---|---|---|
committer | Gagandeep Singh <gdp.1807@gmail.com> | 2021-11-02 11:28:17 +0530 |
commit | c04509e86e97a69a0b5fcbeebdbec66faad3dbe0 (patch) | |
tree | b5940db3ad46e55b88d566ec058007dc3c6b7e72 /numpy/lib/scimath.py | |
parent | 56647dd47345a7fd24b4ee8d9d52025fcdc3b9ae (diff) | |
parent | fae6fa47a3cf9b9c64af2f5bd11a3b644b1763d2 (diff) | |
download | numpy-c04509e86e97a69a0b5fcbeebdbec66faad3dbe0.tar.gz |
resolved conflicts
Diffstat (limited to 'numpy/lib/scimath.py')
-rw-r--r-- | numpy/lib/scimath.py | 21 |
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]) """ |