# 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]:

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]:

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]: