Composite random vectorΒΆ

In this example we are going to create a random variable \underline{Y} which realizations are the images of the realizations of another random vector \underline{X} by a function.

\underline{Y} = f(\underline{X})

import openturns as ot

ot.Log.Show(ot.Log.NONE)

Create a random vector based on a distribution

dist2d = ot.Normal(2)
X = ot.RandomVector(dist2d)

Create the function

f = ot.SymbolicFunction(["x1", "x2"], ["x1 + x2", "x1*x2"])
f
[x1,x2]->[x1 + x2,x1*x2]


Create the composite random vector

Y = ot.CompositeRandomVector(f, X)
Y.getSample(5)
y0y1
0-2.3466341.367485
1-1.2798330.3801989
21.09672-0.04583323
32.2984121.153096
40.71123750.06075101