.. 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 Click :ref:`here ` 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 6-32 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 34-41 .. 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 42-43 Create a mesh .. GENERATED FROM PYTHON SOURCE LINES 43-46 .. code-block:: default N = 100 mesh = ot.RegularGrid(0.0, 1.0, N) .. GENERATED FROM PYTHON SOURCE LINES 47-48 Create the function that acts the values of the mesh .. GENERATED FROM PYTHON SOURCE LINES 48-50 .. code-block:: default g = ot.SymbolicFunction(['x1', 'x2'], ['x1^2', 'x1+x2']) .. GENERATED FROM PYTHON SOURCE LINES 51-52 Create the field function .. GENERATED FROM PYTHON SOURCE LINES 52-54 .. code-block:: default f = ot.ValueFunction(g, mesh) .. GENERATED FROM PYTHON SOURCE LINES 55-56 Evaluate f .. GENERATED FROM PYTHON SOURCE LINES 56-63 .. code-block:: default 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.3255111.3342730.10595741.659784
1-1.7222110.19122892.96601-1.530982
20.6154579-0.063081960.37878840.5523759
31.20791.2796871.4590212.487586
4-2.5553950.88022156.530041-1.675173


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