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
import openturns.viewer as viewer
from matplotlib import pylab as plt
import math as m
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
02.5817111.467319
10.6627470.09873994
21.662492-0.1625065
32.275467-0.07481222
4-1.5182010.5676912


Total running time of the script: ( 0 minutes 0.002 seconds)

Gallery generated by Sphinx-Gallery