[Numpy-svn] r5665 - trunk/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Wed Aug 20 10:48:29 CDT 2008


Author: cdavid
Date: 2008-08-20 10:48:17 -0500 (Wed, 20 Aug 2008)
New Revision: 5665

Modified:
   trunk/numpy/lib/scimath.py
Log:
Add a note on scimath.sqrt for the definition of square root as the principal square root.

Modified: trunk/numpy/lib/scimath.py
===================================================================
--- trunk/numpy/lib/scimath.py	2008-08-19 06:33:09 UTC (rev 5664)
+++ trunk/numpy/lib/scimath.py	2008-08-20 15:48:17 UTC (rev 5665)
@@ -192,6 +192,22 @@
 
     >>> 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)



More information about the Numpy-svn mailing list