summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorBhavuk kalra <bhavukkalra1786@gmail.com>2022-06-13 21:38:27 +0530
committerGitHub <noreply@github.com>2022-06-13 09:08:27 -0700
commitc74cdc87822f62156db3e10e3bb566d54fa41745 (patch)
tree2eeb52725c4806e1ca591efa1c36cc78a73dc495 /numpy
parentc8dd91b633798a4082f255784dec483b08351f58 (diff)
downloadnumpy-c74cdc87822f62156db3e10e3bb566d54fa41745.tar.gz
DOC: update logarithm docs as per theory. (#21587)
Made some changes addressing the discussions in Issue #21235 . What this PR updates Range of log functions in the Docs Adds Additional Notes on the theoretical range outcomes. -pi
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/code_generators/ufunc_docstrings.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py
index 24b707a12..7c020fa2e 100644
--- a/numpy/core/code_generators/ufunc_docstrings.py
+++ b/numpy/core/code_generators/ufunc_docstrings.py
@@ -2011,7 +2011,7 @@ add_newdoc('numpy.core.umath', 'log',
-----
Logarithm is a multivalued function: for each `x` there is an infinite
number of `z` such that `exp(z) = x`. The convention is to return the
- `z` whose imaginary part lies in `[-pi, pi]`.
+ `z` whose imaginary part lies in `(-pi, pi]`.
For real-valued input data types, `log` always returns real output. For
each value that cannot be expressed as a real number or infinity, it
@@ -2021,6 +2021,10 @@ add_newdoc('numpy.core.umath', 'log',
has a branch cut `[-inf, 0]` and is continuous from above on it. `log`
handles the floating-point negative zero as an infinitesimal negative
number, conforming to the C99 standard.
+
+ In the cases where the input has a negative real part and a very small
+ negative complex part (approaching 0), the result is so close to `-pi`
+ that it evaluates to exactly `-pi`.
References
----------
@@ -2061,7 +2065,7 @@ add_newdoc('numpy.core.umath', 'log10',
-----
Logarithm is a multivalued function: for each `x` there is an infinite
number of `z` such that `10**z = x`. The convention is to return the
- `z` whose imaginary part lies in `[-pi, pi]`.
+ `z` whose imaginary part lies in `(-pi, pi]`.
For real-valued input data types, `log10` always returns real output.
For each value that cannot be expressed as a real number or infinity,
@@ -2072,6 +2076,10 @@ add_newdoc('numpy.core.umath', 'log10',
`log10` handles the floating-point negative zero as an infinitesimal
negative number, conforming to the C99 standard.
+ In the cases where the input has a negative real part and a very small
+ negative complex part (approaching 0), the result is so close to `-pi`
+ that it evaluates to exactly `-pi`.
+
References
----------
.. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions",
@@ -2112,7 +2120,7 @@ add_newdoc('numpy.core.umath', 'log2',
Logarithm is a multivalued function: for each `x` there is an infinite
number of `z` such that `2**z = x`. The convention is to return the `z`
- whose imaginary part lies in `[-pi, pi]`.
+ whose imaginary part lies in `(-pi, pi]`.
For real-valued input data types, `log2` always returns real output.
For each value that cannot be expressed as a real number or infinity,
@@ -2123,6 +2131,10 @@ add_newdoc('numpy.core.umath', 'log2',
handles the floating-point negative zero as an infinitesimal negative
number, conforming to the C99 standard.
+ In the cases where the input has a negative real part and a very small
+ negative complex part (approaching 0), the result is so close to `-pi`
+ that it evaluates to exactly `-pi`.
+
Examples
--------
>>> x = np.array([0, 1, 2, 2**4])