diff options
author | David Cournapeau <cournape@gmail.com> | 2008-08-20 15:48:17 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-08-20 15:48:17 +0000 |
commit | 14dd0de454d1a40ed70495c4ed3ead1962c8cd37 (patch) | |
tree | cd8e33d8d6c151acca2add5cfb8a1421c9ce7667 /numpy/lib/scimath.py | |
parent | 3ee040052bd55f4ce46bc25b1dca5cd96e7cee9a (diff) | |
download | numpy-14dd0de454d1a40ed70495c4ed3ead1962c8cd37.tar.gz |
Add a note on scimath.sqrt for the definition of square root as the principal square root.
Diffstat (limited to 'numpy/lib/scimath.py')
-rw-r--r-- | numpy/lib/scimath.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/lib/scimath.py b/numpy/lib/scimath.py index d601cbd14..ed04d1ce5 100644 --- a/numpy/lib/scimath.py +++ b/numpy/lib/scimath.py @@ -192,6 +192,22 @@ def sqrt(x): >>> np.lib.scimath.sqrt([-1,4]) array([ 0.+1.j, 2.+0.j]) + + Notes + ----- + + As the numpy.sqrt, this returns the principal square root of x, which is + what most people mean when they use square root; the principal square root + of x is not any number z such as z^2 = x. + + For positive numbers, the principal square root is defined as the positive + number z such as z^2 = x. + + The principal square root of -1 is i, the principal square root of any + negative number -x is defined a i * sqrt(x). For any non zero complex + number, it is defined by using the following branch cut: x = r e^(i t) with + r > 0 and -pi < t <= pi. The principal square root is then + sqrt(r) e^(i t/2). """ x = _fix_real_lt_zero(x) return nx.sqrt(x) |