|
7 | 7 | module provide the mathematically valid answers in the complex plane::
|
8 | 8 |
|
9 | 9 | >>> 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) |
12 | 11 | True
|
13 | 12 |
|
14 | 13 | Similarly, `sqrt`, other base logarithms, `power` and trig functions are
|
@@ -223,16 +222,16 @@ def sqrt(x):
|
223 | 222 | --------
|
224 | 223 | For real, non-negative inputs this works just like `numpy.sqrt`:
|
225 | 224 |
|
226 |
| - >>> np.lib.scimath.sqrt(1) |
| 225 | + >>> np.emath.sqrt(1) |
227 | 226 | 1.0
|
228 |
| - >>> np.lib.scimath.sqrt([1, 4]) |
| 227 | + >>> np.emath.sqrt([1, 4]) |
229 | 228 | array([1., 2.])
|
230 | 229 |
|
231 | 230 | But it automatically handles negative inputs:
|
232 | 231 |
|
233 |
| - >>> np.lib.scimath.sqrt(-1) |
| 232 | + >>> np.emath.sqrt(-1) |
234 | 233 | 1j
|
235 |
| - >>> np.lib.scimath.sqrt([-1,4]) |
| 234 | + >>> np.emath.sqrt([-1,4]) |
236 | 235 | array([0.+1.j, 2.+0.j])
|
237 | 236 |
|
238 | 237 | """
|
@@ -367,9 +366,9 @@ def logn(n, x):
|
367 | 366 | --------
|
368 | 367 | >>> np.set_printoptions(precision=4)
|
369 | 368 |
|
370 |
| - >>> np.lib.scimath.logn(2, [4, 8]) |
| 369 | + >>> np.emath.logn(2, [4, 8]) |
371 | 370 | array([2., 3.])
|
372 |
| - >>> np.lib.scimath.logn(2, [-4, -8, 8]) |
| 371 | + >>> np.emath.logn(2, [-4, -8, 8]) |
373 | 372 | array([2.+4.5324j, 3.+4.5324j, 3.+0.j ])
|
374 | 373 |
|
375 | 374 | """
|
@@ -462,11 +461,11 @@ def power(x, p):
|
462 | 461 | --------
|
463 | 462 | >>> np.set_printoptions(precision=4)
|
464 | 463 |
|
465 |
| - >>> np.lib.scimath.power([2, 4], 2) |
| 464 | + >>> np.emath.power([2, 4], 2) |
466 | 465 | array([ 4, 16])
|
467 |
| - >>> np.lib.scimath.power([2, 4], -2) |
| 466 | + >>> np.emath.power([2, 4], -2) |
468 | 467 | array([0.25 , 0.0625])
|
469 |
| - >>> np.lib.scimath.power([-2, 4], 2) |
| 468 | + >>> np.emath.power([-2, 4], 2) |
470 | 469 | array([ 4.-0.j, 16.+0.j])
|
471 | 470 |
|
472 | 471 | """
|
|
0 commit comments