.. 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 Click :ref:`here ` 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 6-11 In this example we are going to create a random variable :math:`\underline{Y}` which realizations are the images of the realizations of another random vector :math:`\underline{X}` by a function. .. math:: \underline{Y} = f(\underline{X}) .. GENERATED FROM PYTHON SOURCE LINES 13-19 .. code-block:: default 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) .. GENERATED FROM PYTHON SOURCE LINES 20-21 Create a random vector based on a distribution .. GENERATED FROM PYTHON SOURCE LINES 21-24 .. code-block:: default dist2d = ot.Normal(2) X = ot.RandomVector(dist2d) .. GENERATED FROM PYTHON SOURCE LINES 25-26 Create the function .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: default f = ot.SymbolicFunction(['x1', 'x2'], ['x1 + x2', 'x1*x2']) f .. raw:: html

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



.. GENERATED FROM PYTHON SOURCE LINES 30-31 Create the composite random vector .. GENERATED FROM PYTHON SOURCE LINES 31-33 .. code-block:: default Y = ot.CompositeRandomVector(f, X) .. GENERATED FROM PYTHON SOURCE LINES 34-35 .. code-block:: default Y.getSample(5) .. raw:: html
y0y1
02.5817111.467319
10.6627470.09873994
21.662492-0.1625065
32.275467-0.07481222
4-1.5182010.5676912


.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.002 seconds) .. _sphx_glr_download_auto_probabilistic_modeling_random_vectors_plot_composite_random_vector.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. 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-jupyter :download:`Download Jupyter notebook: plot_composite_random_vector.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_