# Transform a distribution¶

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

[7]:

from __future__ import print_function
import openturns as ot

[8]:

# create some distribution
distribution1 = ot.Uniform(0.0, 1.0)
distribution2 = ot.Uniform(0.0, 2.0)
distribution3 = ot.WeibullMin(2.0, 1.5)

[9]:

# sum of distributions
distribution = distribution1 + distribution2
print(distribution)
distribution.drawPDF()

RandomMixture(Trapezoidal(a = 0, b = 1, c = 2, d = 3))

[9]:

[10]:

# flip a distribution
distribution = 3.0 - distribution3
print(distribution)
distribution.drawPDF()

RandomMixture(3 - WeibullMin(alpha = 2, beta = 1.5, gamma = 0))

[10]:

[16]:

# product of distributions
distribution = distribution1 * distribution2
print(distribution)
distribution.drawPDF()

ProductDistribution(Uniform(a = 0, b = 1) * Uniform(a = 0, b = 2))

[16]: