.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_probabilistic_modeling/random_vectors/plot_composite_random_vector.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_probabilistic_modeling_random_vectors_plot_composite_random_vector.py: Composite random vector ======================= .. GENERATED FROM PYTHON SOURCE LINES 7-13 In this example we are going to create a random variable :math:`\vect{Y}` which realizations are the images of the realizations of another random vector :math:`\vect{X}` by a function. .. math:: \vect{Y} = f(\vect{X}) .. GENERATED FROM PYTHON SOURCE LINES 15-18 .. code-block:: Python import openturns as ot .. GENERATED FROM PYTHON SOURCE LINES 19-20 Create a random vector based on a distribution .. GENERATED FROM PYTHON SOURCE LINES 20-23 .. code-block:: Python dist2d = ot.Normal(2) X = ot.RandomVector(dist2d) .. GENERATED FROM PYTHON SOURCE LINES 24-25 Create the function .. GENERATED FROM PYTHON SOURCE LINES 25-28 .. code-block:: Python f = ot.SymbolicFunction(["x1", "x2"], ["x1 + x2", "x1*x2"]) f .. raw:: html
[x1,x2]->[x1 + x2,x1*x2]


.. GENERATED FROM PYTHON SOURCE LINES 29-30 Create the composite random vector .. GENERATED FROM PYTHON SOURCE LINES 30-32 .. code-block:: Python Y = ot.CompositeRandomVector(f, X) .. GENERATED FROM PYTHON SOURCE LINES 33-34 .. code-block:: Python Y.getSample(5) .. raw:: html
y0y1
0-0.6579715-0.7700886
10.7672126-0.5283197
2-1.831343-0.7635766
31.082242-0.5102336
41.6038240.6429862


.. _sphx_glr_download_auto_probabilistic_modeling_random_vectors_plot_composite_random_vector.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_composite_random_vector.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_composite_random_vector.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_composite_random_vector.zip `