.. 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_distributions_plot_composite_distribution.py: Create a composite distribution =============================== In this example we are going to create a distribution defined as the push-forward distribution of a scalar distribution by a transformation. If we note :math:`\mathcal{L}_0` a scalar distribution, :math:`f: \mathbb{R} \rightarrow \mathbb{R}` a mapping, then it is possible to create the push-forward distribution :math:`\mathcal{L}` defined by .. math:: \mathcal{L} = f(\mathcal{L}_0) .. code-block:: default from __future__ import print_function import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) create an 1-d distribution .. code-block:: default antecedent = ot.Normal() Create an 1-d transformation .. code-block:: default f = ot.SymbolicFunction(['x'], ['sin(x)+cos(x)']) Create the composite distribution .. code-block:: default distribution = ot.CompositeDistribution(f, antecedent) graph = distribution.drawPDF() view = viewer.View(graph) .. image:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_composite_distribution_001.png :alt: plot composite distribution :class: sphx-glr-single-img Using the simplified construction .. code-block:: default distribution = antecedent.exp() graph = distribution.drawPDF() view = viewer.View(graph) .. image:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_composite_distribution_002.png :alt: plot composite distribution :class: sphx-glr-single-img Using chained operators .. code-block:: default distribution = antecedent.abs().sqrt() graph = distribution.drawPDF() view = viewer.View(graph) plt.show() .. image:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_composite_distribution_003.png :alt: plot composite distribution :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.218 seconds) .. _sphx_glr_download_auto_probabilistic_modeling_distributions_plot_composite_distribution.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_distribution.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_composite_distribution.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_