Transform a distributionΒΆ

In this basic example we are going to use distribution algebra.

In [7]:
from __future__ import print_function
import openturns as ot
In [8]:
# create some distribution
distribution1 = ot.Uniform(0.0, 1.0)
distribution2 = ot.Uniform(0.0, 2.0)
distribution3 = ot.Weibull(2.0, 1.5)
In [9]:
# sum of distributions
distribution = distribution1 + distribution2
print(distribution)
distribution.drawPDF()
RandomMixture(Trapezoidal(a = 0, b = 1, c = 2, d = 3))
Out[9]:
../../_images/examples_probabilistic_modeling_distribution_transformation_4_1.svg
In [10]:
# flip a distribution
distribution = 3.0 - distribution3
print(distribution)
distribution.drawPDF()
RandomMixture(3 - Weibull(alpha = 2, beta = 1.5, gamma = 0))
Out[10]:
../../_images/examples_probabilistic_modeling_distribution_transformation_5_1.svg
In [16]:
# product of distributions
distribution = distribution1 * distribution2
print(distribution)
distribution.drawPDF()
ProductDistribution(Uniform(a = 0, b = 1) * Uniform(a = 0, b = 2))
Out[16]:
../../_images/examples_probabilistic_modeling_distribution_transformation_6_1.svg