.. 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_functional_modeling_vectorial_functions_plot_composed_function.py:
Create a composed function
==========================
In this example we are going to create a composed function :math:`f\circ g`
.. code-block:: default
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)
assume f, g functions
.. code-block:: default
g = ot.SymbolicFunction(['x1', 'x2'],
['x1 + x2','3 * x1 * x2'])
f = ot.SymbolicFunction(['x1', 'x2'], ['2 * x1 - x2'])
create the composed function
.. code-block:: default
function = ot.ComposedFunction(f, g)
evaluate the function
.. code-block:: default
x = [3.0, 4.0]
y = function(x)
print('x=', x, 'y=', y)
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
x= [3.0, 4.0] y= [-22]
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.002 seconds)
.. _sphx_glr_download_auto_functional_modeling_vectorial_functions_plot_composed_function.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_composed_function.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_composed_function.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_