Note
Click here to download the full example code
Mix/max search and sensitivity from designΒΆ
In this example we are going to evaluate the min and max 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.
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)
Create the marginal distributions of the parameters
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.ComposedDistribution(marginals)
Sample inputs
sampleX = distribution.getSample(100)
Create the model
model = ot.SymbolicFunction(['E', 'F', 'L', 'I'], ['F*L^3/(3*E*I)'])
Evaluate outputs
sampleY = model(sampleX)
Get min and max
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)
Out:
min: y= [6.45355] with x= [4.48084e+07,18911,250.617,343.136]
max: y= [26.2891] with x= [3.37304e+07,52784.9,259.758,347.774]
Get sensitivity at min
model.gradient(minX)
[[ -1.44026e-07 ]
[ 0.000341258 ]
[ 0.0772521 ]
[ -0.0188076 ]]
Total running time of the script: ( 0 minutes 0.003 seconds)