.. 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_parametric_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_parametric_function.py: Create a parametric function ============================ .. GENERATED FROM PYTHON SOURCE LINES 6-16 In this example we are going to create a parametric function: .. math:: d_{L,I}(E, F): \mathbb{R}^2 \rightarrow \mathbb{R} function from an existing "full" function: .. math:: d(E, F, L, I): \mathbb{R}^4 \rightarrow \mathbb{R} .. GENERATED FROM PYTHON SOURCE LINES 18-26 .. 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 27-28 Create the function with all parameters d(E, F, L, I) .. GENERATED FROM PYTHON SOURCE LINES 28-36 .. code-block:: default def d_func(X): E, F, L, I = X d = -F * L**3 / (3.0 * E * I) return [d] beam = ot.PythonFunction(4, 1, d_func) .. GENERATED FROM PYTHON SOURCE LINES 37-38 Evaluate d .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: default x = [50.0, 1.0, 10.0, 5.0] beam(x) .. raw:: html

[-1.33333]



.. GENERATED FROM PYTHON SOURCE LINES 42-43 Create the indices of the frozen parameters (L,I) from the full parameter list .. GENERATED FROM PYTHON SOURCE LINES 43-45 .. code-block:: default indices = [2, 3] .. GENERATED FROM PYTHON SOURCE LINES 46-47 Create the values of the frozen parameters (L,I) .. GENERATED FROM PYTHON SOURCE LINES 47-49 .. code-block:: default referencePoint = [10.0, 5.0] .. GENERATED FROM PYTHON SOURCE LINES 50-51 Create the parametric function .. GENERATED FROM PYTHON SOURCE LINES 51-53 .. code-block:: default beam_LI = ot.ParametricFunction(beam, indices, referencePoint) .. GENERATED FROM PYTHON SOURCE LINES 54-55 Evaluate d on (E,F) with fixed parameters (L,I) .. GENERATED FROM PYTHON SOURCE LINES 55-56 .. code-block:: default beam_LI([50.0, 1.0]) .. raw:: html

[-1.33333]



.. 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_parametric_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_parametric_function.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_parametric_function.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_