Uncertainty propagation using MonteCarloMeasurements gives weird results

Hi there! :wave:

I think the result is correct. As pointed out by @bertschi , the resulting distribution is highly skewed, here’s a histogram (note the logarithmic y-axis)

You can endow the particles with a nominal value like this, here I used the mean

D0 = with_nominal((2.5e-12±0)u"m^2/s", (2.5e-12)u"m^2/s")
Ea = with_nominal((227±62)u"kJ/mol", 227u"kJ/mol")
D = D0*exp(-Ea/(8.3145u"J/mol/K"*1100u"K"))

Then you can extract the nominal value of the result like this

nominal(D)
julia> nominal(D)
4.1578487110411763e-23 m² s⁻¹

and you see that it matches what you compute without uncertainty. With such a nonlinear function resulting in such a skewed distribution, propagating the mean of the expectation does not give you the expectation of the mean (see, e.g., Jensen’s inequality).

probably not, it gives you the propagated mean of the input (like nominal above), which is not the correct mean of the output :wink:

Here’s a histogram of the output with only 10% of the uncertainty of above, in this plot it’s easier to see the much less extreme distribution

2 Likes