With the help of np.multivariate_normal() method, we can get the array of multivariate normal values by using np.multivariate_normal() method.
Syntax :
np.multivariate_normal(mean, matrix, size)
Return : Return the array of multivariate normal values.
Example #1 :
In this example we can see that by using np.multivariate_normal() method, we are able to get the array of multivariate normal values by using this method.
# import numpy import numpy as np mean = [1, 2] matrix = [[5, 0], [0, 5]] # using np.multinomial() method gfg = np.random.multivariate_normal(mean, matrix, 10) print(gfg) |
Output :
[[ 6.24847794 6.57894103]
[ 1.24114594 3.22013831]
[ 3.0660329 2.1442572 ]
[ 0.3239289 2.79949784]
[-1.42964186 1.11846394]
[-0.08521476 0.74518872]
[ 1.42307847 3.27995017]
[ 3.08412374 0.45869097]
[ 2.2158498 2.97014443]
[ 1.77583875 0.57446964]]
Example #2 :
# import numpy import numpy as np mean = [0, 0, 0] matrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] # using np.multinomial() method gfg = np.random.multivariate_normal(mean, matrix, 5) print(gfg) |
Output :
[[-2.21792571 -1.04526811 -0.4586839 ]
[ 0.15760965 0.83934119 -0.52943583]
[-0.9978205 0.79594411 -0.00937 ]
[-0.16882821 0.1727549 0.14002367]
[-1.34406079 1.03498375 0.17620708]]
Recommended Posts:
- Python | Numpy numpy.resize()
- Python | Numpy numpy.transpose()
- Python | Numpy numpy.ndarray.__lt__()
- Python | Numpy numpy.ndarray.__gt__()
- Python | Numpy numpy.ndarray.__le__()
- Python | Numpy numpy.ndarray.__ge__()
- Python | Numpy numpy.ndarray.__eq__()
- Python | Numpy numpy.ndarray.__ne__()
- Python | Numpy numpy.ndarray.__neg__()
- Python | Numpy numpy.ndarray.__pos__()
- Python | Numpy numpy.ndarray.__truediv__()
- Python | Numpy numpy.ndarray.__mul__()
- Python | Numpy numpy.ndarray.__sub__()
- Python | Numpy numpy.ndarray.__add__()
- Python | Numpy numpy.ndarray.__floordiv__()
- Python | Numpy numpy.ndarray.__mod__()
- Python | Numpy numpy.ndarray.__invert__()
- Python | Numpy numpy.ndarray.__divmod__()
- Python | Numpy numpy.ndarray.__pow__()
- Python | Numpy numpy.ndarray.__rshift__()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

