.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_numerical_methods/optimization/plot_minmax_by_random_design.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_numerical_methods_optimization_plot_minmax_by_random_design.py: Mix/max search and sensitivity from design ========================================== .. GENERATED FROM PYTHON SOURCE LINES 7-9 In this example, we are going to evaluate the minimum and maximum values of the output variable of interest from a sample and to evaluate the gradient of the limit-state function defining the output variable of interest at a particular point. .. GENERATED FROM PYTHON SOURCE LINES 12-16 .. code-block:: Python import openturns as ot ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 17-18 Create the marginal distributions of the parameters. .. GENERATED FROM PYTHON SOURCE LINES 18-25 .. code-block:: Python dist_E = ot.Beta(0.93, 2.27, 2.8e7, 4.8e7) dist_F = ot.LogNormalMuSigma(30000, 9000, 15000).getDistribution() dist_L = ot.Uniform(250, 260) dist_I = ot.Beta(2.5, 1.5, 3.1e2, 4.5e2) marginals = [dist_E, dist_F, dist_L, dist_I] distribution = ot.JointDistribution(marginals) .. GENERATED FROM PYTHON SOURCE LINES 26-27 Sample the inputs. .. GENERATED FROM PYTHON SOURCE LINES 27-29 .. code-block:: Python sampleX = distribution.getSample(100) .. GENERATED FROM PYTHON SOURCE LINES 30-31 Create the model. .. GENERATED FROM PYTHON SOURCE LINES 31-33 .. code-block:: Python model = ot.SymbolicFunction(["E", "F", "L", "I"], ["F*L^3/(3*E*I)"]) .. GENERATED FROM PYTHON SOURCE LINES 34-35 Evaluate the outputs. .. GENERATED FROM PYTHON SOURCE LINES 35-37 .. code-block:: Python sampleY = model(sampleX) .. GENERATED FROM PYTHON SOURCE LINES 38-39 Get minimum and maximum values of both inputs and output variables. .. GENERATED FROM PYTHON SOURCE LINES 39-46 .. code-block:: Python minY = sampleY.getMin() minX = sampleX[sampleY.find(minY)] print("min: y=", minY, " with x=", minX) maxY = sampleY.getMax() maxX = sampleX[sampleY.find(maxY)] print("max: y=", maxY, " with x=", maxX) .. rst-class:: sphx-glr-script-out .. code-block:: none min: y= [5.92053] with x= [3.98598e+07,18081.6,257.081,433.943] max: y= [29.0238] with x= [2.83606e+07,54027.9,258.113,376.234] .. GENERATED FROM PYTHON SOURCE LINES 47-48 Get sensitivity at minimum input values. .. GENERATED FROM PYTHON SOURCE LINES 48-49 .. code-block:: Python model.gradient(minX) .. raw:: html

[[ -1.48534e-07 ]
[ 0.000327433 ]
[ 0.0690893 ]
[ -0.0136435 ]]



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