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})

[13]:
from __future__ import print_function
import openturns as ot
import math as m
[14]:
# Create a random vector based on a distribution
dist2d = ot.Normal(2)
X = ot.RandomVector(dist2d)
[15]:
# Create the function
f = ot.SymbolicFunction(['x1', 'x2'], ['x1 + x2', 'x1*x2'])
f
[15]:

[x1,x2]->[x1 + x2,x1*x2]

[21]:
# Create the composite random vector
Y = ot.CompositeRandomVector(f, X)
[22]:
Y.getSample(5)
[22]:
y0y1
00.6340067547705874-1.738141317991343
10.860261107301864-0.4291467493292659
2-2.14556456142202471.0633942511691827
3-0.7883451164543616-0.0922805136143649
41.24039613484487580.3031904202688173