Note
Go to the end to download the full example code.
Create a random vectorΒΆ
The RandomVector object represents the concept of random variable.
In this example we are going to exhibit some of its main methods.
import openturns as ot
ot.Log.Show(ot.Log.NONE)
Create a random vector
dist3d = ot.Normal(3)
X = ot.RandomVector(dist3d)
Get the dimension
X.getDimension()
3
Get the mean
X.getMean()
Get the covariance
X.getCovariance()
Draw a sample
X.getSample(5)
Extract a single component
X1 = X.getMarginal(1)
X1.getSample(5)
Extract several components
X02 = X.getMarginal([0, 2])
X02.getSample(5)