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

from __future__ import print_function
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
0-0.2864335-0.4336809
11.617266-0.03661119
20.8772776-0.9895433
33.9494243.633858
4-3.5299363.078517


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

Gallery generated by Sphinx-Gallery