Extending the numerical range of a Distribution

HI to all Open TURNS users!

I am having troubles generating draws from a truncated distribution in Open-TURNS. Here is an example to illustrate the problem:

ot.TruncatedDistribution( ot.Exponential(),33., 34.)

TypeError: InvalidArgumentException : Error: the truncation interval does not contain a non-empty part of the support of the distribution
The numerical range of the exponential distribution has been set to [0; 32], which explains the error message.

However, this is a shame, because the exponential distribution with rate \lambda (inverse scale), restricted to [a; b], can actually easily be simulated as:

a - \frac{1}{\lambda} \log\left( 1 - u(1-e^{-\lambda(b-a)}) \right),

which is well defined, whatever 0<a<b.

Hence, my question is: can we change to numerical range of a given distribution? the Distribution class has a getRange() method but no setRange()…

Many thanks in advance for your answers,
Best Regards,

We had a recent issue related to truncation in TruncatedDistribution fails to compute quantiles · Issue #1870 · openturns/openturns · GitHub,
but it looks like your case is more specific.

Thanks Julien for your response! Indeed the problem here is the interaction between the truncation bounds AND the range of the distribution, since the truncated distribution doesn’t necessarily have the same numerical range as the original distribution (re the example above). I tried changing the value of “Distribution-DefaultQuantileEpsilon” as indicated in TruncatedDistribution fails to compute quantiles · Issue #1870 · openturns/openturns · GitHub, but this changes nothing to the range of the distribution… is there some other ResourceMap keyword that allows to do that?

That should be it I think; the range is computed from quantiles up to that precision.

Hi Merlin,

You just have to adapt the default value of the Distribution-DefaultCDFEpsilon key in ResourceMap:


This way you get:

import openturns as ot
d = ot.TruncatedDistribution( ot.Exponential(),33., 34.)


The default value is 1e-14, mandatory for some badly behaved distributions but too restrictive in your case. The difficult point is to set a meaningful value that stays meaningful after truncation.



Many thanks Regis! That was exactly what I was looking for… agreed, it is probably impossible to find a single value that fits all applications. So it’s great to be able to tune such parameters by hand when necessary.

You could also have use:

d = ot.TruncatedDistribution(ot.Exponential(1.0, 33.0), 34.0, ot.TruncatedDistribution.UPPER)

The shift argument of the Exponential class is a lower truncation, and created this way this exponential distribution has a range upper bound equal to 65.23 so the additional upper truncation at 34.0 goes smoothly.