I have big formula containing random variables. at some part of this formula I have to calculate min(X,Y), where X and Y are distributed normally and independently. Finally, after many summations and multiplications I am getting some distribution for which I am drawing its PDF.
I am interested if there is any openturns way to calculate min(X,Y) and plug it into some big formula.
I went through the documentation and discovered the function which calculates expected value of min(X,Y) but not the whole distribution.
Any kind of help will be appreciated.
It is a little finicky, but it can be done with the MaximumDistribution
class.
Let us create 2 independent normal distributions for X and Y, like you suggest:
import openturns as ot
distX = ot.Normal(5.0, 1.0)
distY = ot.Normal(5.0, 1.0)
We start by computing the distributions of -X and -Y:
opposite = ot.SymbolicFunction('x', '-x')
dist_minusX = ot.CompositeDistribution(opposite, distX)
dist_minusY = ot.CompositeDistribution(opposite, distY)
We then compute the distribution of max(-X, -Y):
dist_max_opposites = ot.MaximumDistribution([dist_minusX, dist_minusY])
Since max(-X, -Y) = - min(X, Y), we can get the distribution of min(X, Y) with:
dist_min = ot.CompositeDistribution(opposite, dist_max_opposites)