summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Koep <niklas.koep@gmail.com>2013-10-15 12:57:43 +0200
committerNiklas Koep <niklas.koep@gmail.com>2013-10-15 12:57:43 +0200
commit0390fe34ade1ce3ebf8b27873e2a160c6bc86da5 (patch)
tree09dbe852f682fc20a7b5bbe27ff71e343e4b5e7d
parent415c62c29a7d074b75c7fb0e05b21c36b5c8e077 (diff)
downloadnumpy-0390fe34ade1ce3ebf8b27873e2a160c6bc86da5.tar.gz
Fix example plot of Laplace distribution
In the PDF used for the example plot of the Laplace distribution only the location parameter loc instead of the absolute difference between random variable and loc was divided by the scale parameter. For the example at hand this makes no difference as loc is 0 and lambda is 1. For different values, however, the plot makes no sense.
-rw-r--r--numpy/random/mtrand/mtrand.pyx4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index c55d178e6..84b52079d 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -2792,13 +2792,13 @@ cdef class RandomState:
>>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, 30, normed=True)
>>> x = np.arange(-8., 8., .01)
- >>> pdf = np.exp(-abs(x-loc/scale))/(2.*scale)
+ >>> pdf = np.exp(-abs(x-loc)/scale)/(2.*scale)
>>> plt.plot(x, pdf)
Plot Gaussian for comparison:
>>> g = (1/(scale * np.sqrt(2 * np.pi)) *
- ... np.exp( - (x - loc)**2 / (2 * scale**2) ))
+ ... np.exp(-(x - loc)**2 / (2 * scale**2)))
>>> plt.plot(x,g)
"""