.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_functional_modeling/field_functions/plot_value_function.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_functional_modeling_field_functions_plot_value_function.py: Value function ============== .. GENERATED FROM PYTHON SOURCE LINES 7-33 A value function :math:`f_{value}: \mathcal{D} \times \mathbb{R}^d \rightarrow \mathcal{D} \times \mathbb{R}^q` is a particular field function that lets invariant the mesh of a field and defined by a function :math:`g : \mathbb{R}^d \rightarrow \mathbb{R}^q` such that: .. math:: \begin{aligned} f_{value}(\underline{t}, \underline{x})=(\underline{t}, g(\underline{x}))\end{aligned} Let's note that the input dimension of :math:`f_{value}` still designs the dimension of :math:`\underline{x}` : :math:`d`. Its output dimension is equal to :math:`q`. The creation of the *ValueFunction* object requires the function :math:`g` and the integer :math:`n`: the dimension of the vertices of the mesh :math:`\mathcal{M}`. This data is required for tests on the compatibility of dimension when a composite process is created using the spatial function. The use case illustrates the creation of a spatial (field) function from the function :math:`g: \mathbb{R}^2 \rightarrow \mathbb{R}^2` such as : .. math:: \begin{aligned} g(\underline{x})=(x_1^2, x_1+x_2) \end{aligned} .. GENERATED FROM PYTHON SOURCE LINES 35-39 .. code-block:: Python import openturns as ot ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 40-41 Create a mesh .. GENERATED FROM PYTHON SOURCE LINES 41-44 .. code-block:: Python N = 100 mesh = ot.RegularGrid(0.0, 1.0, N) .. GENERATED FROM PYTHON SOURCE LINES 45-46 Create the function that acts the values of the mesh .. GENERATED FROM PYTHON SOURCE LINES 46-48 .. code-block:: Python g = ot.SymbolicFunction(["x1", "x2"], ["x1^2", "x1+x2"]) .. GENERATED FROM PYTHON SOURCE LINES 49-50 Create the field function .. GENERATED FROM PYTHON SOURCE LINES 50-52 .. code-block:: Python f = ot.ValueFunction(g, mesh) .. GENERATED FROM PYTHON SOURCE LINES 53-54 Evaluate f .. GENERATED FROM PYTHON SOURCE LINES 54-61 .. code-block:: Python inF = ot.Normal(2).getSample(N) outF = f(inF) # print input/output at first mesh nodes xy = inF xy.stack(outF) xy[:5] .. raw:: html
X0X1y0y1
00.34577630.24181140.11956130.5875878
1-0.41522591.5664190.17241261.151193
2-0.92603810.27915660.8575466-0.6468815
31.393587-1.6978781.942086-0.3042903
40.42284930.6019590.17880151.024808


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