Composite random vectorΒΆ

In this basic 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})

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

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

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