diff options
author | Melissa Weber Mendonça <melissawm@gmail.com> | 2022-06-27 06:45:03 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 06:45:03 -0300 |
commit | f3935c9dc9a661bf818a09e46da6497220bd7dca (patch) | |
tree | 91967a6e7e419f08593cfcc1b927a588672f72af /numpy/random | |
parent | e67fe9f1a86013dbfd4a5ad2bd69aa6e7f60e1fb (diff) | |
parent | 4f479744bb9f5150d1406fdb0203c5d8714e7283 (diff) | |
download | numpy-f3935c9dc9a661bf818a09e46da6497220bd7dca.tar.gz |
Merge pull request #21855 from WarrenWeckesser/doc-normal-notation
DOC: Replace the mathematical notation N(...) with text.
Diffstat (limited to 'numpy/random')
-rw-r--r-- | numpy/random/_generator.pyx | 9 | ||||
-rw-r--r-- | numpy/random/mtrand.pyx | 17 |
2 files changed, 17 insertions, 9 deletions
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index 0019c4bcd..8092c8e7a 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -1001,7 +1001,8 @@ cdef class Generator: Notes ----- - For random samples from :math:`N(\\mu, \\sigma^2)`, use one of:: + For random samples from the normal distribution with mean ``mu`` and + standard deviation ``sigma``, use one of:: mu + sigma * rng.standard_normal(size=...) rng.normal(mu, sigma, size=...) @@ -1022,7 +1023,8 @@ cdef class Generator: >>> s.shape (3, 4, 2) - Two-by-four array of samples from :math:`N(3, 6.25)`: + Two-by-four array of samples from the normal distribution with + mean 3 and standard deviation 2.5: >>> 3 + 2.5 * rng.standard_normal(size=(2, 4)) array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random @@ -1126,7 +1128,8 @@ cdef class Generator: ... linewidth=2, color='r') >>> plt.show() - Two-by-four array of samples from N(3, 6.25): + Two-by-four array of samples from the normal distribution with + mean 3 and standard deviation 2.5: >>> np.random.default_rng().normal(3, 2.5, size=(2, 4)) array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx index 408d5a332..19d23f6a8 100644 --- a/numpy/random/mtrand.pyx +++ b/numpy/random/mtrand.pyx @@ -1224,16 +1224,18 @@ cdef class RandomState: Notes ----- - For random samples from :math:`N(\\mu, \\sigma^2)`, use: + For random samples from the normal distribution with mean ``mu`` and + standard deviation ``sigma``, use:: - ``sigma * np.random.randn(...) + mu`` + sigma * np.random.randn(...) + mu Examples -------- >>> np.random.randn() 2.1923875335537315 # random - Two-by-four array of samples from N(3, 6.25): + Two-by-four array of samples from the normal distribution with + mean 3 and standard deviation 2.5: >>> 3 + 2.5 * np.random.randn(2, 4) array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random @@ -1373,7 +1375,8 @@ cdef class RandomState: Notes ----- - For random samples from :math:`N(\\mu, \\sigma^2)`, use one of:: + For random samples from the normal distribution with mean ``mu`` and + standard deviation ``sigma``, use one of:: mu + sigma * np.random.standard_normal(size=...) np.random.normal(mu, sigma, size=...) @@ -1393,7 +1396,8 @@ cdef class RandomState: >>> s.shape (3, 4, 2) - Two-by-four array of samples from :math:`N(3, 6.25)`: + Two-by-four array of samples from the normal distribution with + mean 3 and standard deviation 2.5: >>> 3 + 2.5 * np.random.standard_normal(size=(2, 4)) array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random @@ -1500,7 +1504,8 @@ cdef class RandomState: ... linewidth=2, color='r') >>> plt.show() - Two-by-four array of samples from N(3, 6.25): + Two-by-four array of samples from the normal distribution with + mean 3 and standard deviation 2.5: >>> np.random.normal(3, 2.5, size=(2, 4)) array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random |