summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorMartin Thoma <info@martin-thoma.de>2014-08-23 12:22:43 -0400
committerRalf Gommers <ralf.gommers@googlemail.com>2015-01-07 19:05:40 +0100
commit8b5698515815e634d2c7971d0da9b8871a461db3 (patch)
tree1fac518ba312639da914519cb98b689c814b20b9 /numpy
parentf4be1039d6fe3e4fdc157a22e8c071ac10651997 (diff)
downloadnumpy-8b5698515815e634d2c7971d0da9b8871a461db3.tar.gz
DOC: style fixes for random.multivariate_normal docstring.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/mtrand/mtrand.pyx20
1 files changed, 12 insertions, 8 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index 766f89bc1..51aa8dfe8 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -4269,12 +4269,16 @@ cdef class RandomState:
This geometrical property can be seen in two dimensions by plotting
generated data-points:
- >>> mean = [0,0]
- >>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis
+ >>> mean = [0, 0]
+ >>> cov = [[1, 0], [0, 100]] # diagonal covariance
+
+ Diagonal covariance means that points are oriented along x or y-axis:
>>> import matplotlib.pyplot as plt
- >>> x,y = np.random.multivariate_normal(mean,cov,5000).T
- >>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()
+ >>> x, y = np.random.multivariate_normal(mean, cov, 5000).T
+ >>> plt.plot(x, y, 'x')
+ >>> plt.axis('equal')
+ >>> plt.show()
Note that the covariance matrix must be positive semidefinite (a.k.a.
nonnegative-definite). Otherwise, the behavior of this method is
@@ -4290,16 +4294,16 @@ cdef class RandomState:
Examples
--------
- >>> mean = (1,2)
- >>> cov = [[1,0],[1,0]]
- >>> x = np.random.multivariate_normal(mean,cov,(3,3))
+ >>> mean = (1, 2)
+ >>> cov = [[1, 0], [1, 0]]
+ >>> x = np.random.multivariate_normal(mean, cov, (3, 3))
>>> x.shape
(3, 3, 2)
The following is probably true, given that 0.6 is roughly twice the
standard deviation:
- >>> print list( (x[0,0,:] - mean) < 0.6 )
+ >>> list((x[0,0,:] - mean) < 0.6)
[True, True]
"""