# Julia package dealing with propagation of uncertainty

**URL:** <https://discourse.julialang.org/t/julia-package-dealing-with-propagation-of-uncertainty/84472>\
**Category:** Probabilistic Programming\
**Tags:** question, package, diffeq, monte-carlo, measurements\
**Created:** [July 19, 2022, 3:20pm UTC](https://discourse.julialang.org/t/julia-package-dealing-with-propagation-of-uncertainty/84472 "2022-07-19T15:20:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Firstname\_Lastname](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/firstname_lastname/32/34201_2.png) [@Firstname\_Lastname](https://discourse.julialang.org/u/Firstname_Lastname)\
**Post date:** [July 19, 2022, 3:20pm UTC](https://discourse.julialang.org/t/julia-package-dealing-with-propagation-of-uncertainty/84472/1 "2022-07-19T15:20:15Z")

</div>

In a static problem, there is uncertainty in some input, like I = a \pm b. The output [a function of spatial variables, i.e. f(x,y)] is uncertain due to uncertain input. For each input sample, randomly generated, the function f(x,y) can be determined accordingly. The package MonteCarloMeasurements.jl can solve this problem, using MonteCarlo-based approach, to bring the value of f at each (x,y) in the form of uncertainty c \pm d.

Compared with a dynamic problem, the expectation [and other moments] of the response in consideration can be obtained with `MonteCarlo()` option or with `Koopman()` option which is much more efficient. So I wonder whether there is some package for static problem offering something like `Koopman()` option in a dynamic problem?

I am sorry if my question is not clear enough due to my limited knowledge in this field though I tried my best to explain it clearly.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 20, 2022, 12:19pm UTC](https://discourse.julialang.org/t/julia-package-dealing-with-propagation-of-uncertainty/84472/2 "2022-07-20T12:19:42Z")

</div>

> [@Firstname\_Lastname](#):
>
> Compared with a dynamic problem, the expectation [and other moments] of the response in consideration can be obtained with `MonteCarlo()` option or with `Koopman()` option which is much more efficient. So I wonder whether there is some package for static problem offering something like `Koopman()` option in a dynamic problem?

If I understand your question, [https://github.com/SciML/DiffEqUncertainty.jl/pull/55](https://github.com/SciML/DiffEqUncertainty.jl/pull/55) will generalize DiffEqUncertainty in the way you need to be non-diffeq based with general inputs, and that will solve your problem. I plan to finish this by the end of the month.

---

<div class="post-metadata">

**Author:** ![Firstname\_Lastname](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/firstname_lastname/32/34201_2.png) [@Firstname\_Lastname](https://discourse.julialang.org/u/Firstname_Lastname)\
**Post date:** [July 23, 2022, 12:45am UTC](https://discourse.julialang.org/t/julia-package-dealing-with-propagation-of-uncertainty/84472/3 "2022-07-23T00:45:36Z")

</div>

Thank you @ChrisRackauckas, it is great to know that the package DiffEqUncertainty.jl can deal with non-diffeq with general inputs soon. To further explain my previous question, I would like to show the situation through a minimal example as follows

Given a static problem, for example, `y(x) = a * x + b * sin(x)`, where a and b are uncertain scalars, `a = a0 \pm a1` and `b = b0 \pm b1`. What is the expectation [and other moments] of y(x)?

The package MonteCarloMeasurements.jl could do this job using MonteCarlo-based approach. Will the package DiffEqUncertainty.jl offer something like Koopman-based approach or any other approach that is more efficient to deal with the job?

By the way, could you please show me how to plot y(x).

Thank you very much.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 23, 2022, 11:39pm UTC](https://discourse.julialang.org/t/julia-package-dealing-with-propagation-of-uncertainty/84472/4 "2022-07-23T23:39:40Z")

</div>

> [@Firstname\_Lastname](#):
>
> The package MonteCarloMeasurements.jl could do this job using MonteCarlo-based approach. Will the package DiffEqUncertainty.jl offer something like Koopman-based approach or any other approach that is more efficient to deal with the job?

Yes, the upgraded version will be much faster for these kinds of problem where what is required is just the moments of the solution. Propagating the entire probability distribution just to compute the moments is a very expensive way to do the calculation.

For plotting see Plots.jl and Makie.jl
