Create a truncated distributionΒΆ

In this basic example we are going to truncate a distribution.

In [11]:
from __future__ import print_function
import openturns as ot

# the original distribution
distribution = ot.Gumbel(2.2, 0.6)
distribution.drawPDF()
Out[11]:
../../_images/examples_probabilistic_modeling_truncated_distribution_2_0.svg
In [12]:
# truncate on the left
truncated = ot.TruncatedDistribution(distribution, 0.2, ot.TruncatedDistribution.LOWER)
truncated.drawPDF()
Out[12]:
../../_images/examples_probabilistic_modeling_truncated_distribution_3_0.svg
In [13]:
# truncate on the right
truncated = ot.TruncatedDistribution(distribution, 1.5, ot.TruncatedDistribution.UPPER)
truncated.drawPDF()
Out[13]:
../../_images/examples_probabilistic_modeling_truncated_distribution_4_0.svg
In [14]:
# truncated on both bounds
truncated = ot.TruncatedDistribution(distribution, 0.2, 1.5)
truncated.drawPDF()
Out[14]:
../../_images/examples_probabilistic_modeling_truncated_distribution_5_0.svg