.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_functional_modeling/vectorial_functions/plot_aggregated_function.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_functional_modeling_vectorial_functions_plot_aggregated_function.py: Create an aggregated function ============================= .. GENERATED FROM PYTHON SOURCE LINES 6-11 In this example we are going to build a function that stacks all the outputs from several functions .. math:: f = (f_1, \dots, f_n) .. GENERATED FROM PYTHON SOURCE LINES 13-20 .. 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) .. GENERATED FROM PYTHON SOURCE LINES 21-22 assume a list of functions to aggregate .. GENERATED FROM PYTHON SOURCE LINES 22-28 .. code-block:: default functions = list() functions.append(ot.SymbolicFunction(['x1', 'x2', 'x3'], ['x1^2 + x2', 'x1 + x2 + x3'])) functions.append(ot.SymbolicFunction(['x1', 'x2', 'x3'], ['x1 + 2 * x2 + x3', 'x1 + x2 - x3'])) .. GENERATED FROM PYTHON SOURCE LINES 29-30 create the aggregated function .. GENERATED FROM PYTHON SOURCE LINES 30-32 .. code-block:: default function = ot.AggregatedFunction(functions) .. GENERATED FROM PYTHON SOURCE LINES 33-34 evaluate the function .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: default x = [1.0, 2.0, 3.0] y = function(x) print('x=', x, 'y=', y) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none x= [1.0, 2.0, 3.0] y= [3,6,8,0] .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.004 seconds) .. _sphx_glr_download_auto_functional_modeling_vectorial_functions_plot_aggregated_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_aggregated_function.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_aggregated_function.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_