# Solving PDEs over distributions

**URL:** <https://discourse.julialang.org/t/solving-pdes-over-distributions/104480>\
**Category:** Numerics\
**Created:** [October 1, 2023, 11:34pm UTC](https://discourse.julialang.org/t/solving-pdes-over-distributions/104480 "2023-10-01T23:34:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smartalecH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/smartalech/32/32379_2.png) [@smartalecH](https://discourse.julialang.org/u/smartalecH)\
**Post date:** [October 1, 2023, 11:34pm UTC](https://discourse.julialang.org/t/solving-pdes-over-distributions/104480/1 "2023-10-01T23:34:58Z")

</div>

Suppose I have an arbitrary PDE solver I’ve built. This solver solves simple linear problems that look like Ax=b.

Now suppose I specify a _distribution_ of source terms (the b vector). This could be a straightforward probability distribution, or maybe a distribution described by a data-driven model. Has anyone tried to leverage Julia’s type system to cleanly propagate that source distribution through the PDE solver, such that you also get a solution distribution?

To be clear, I’m not looking for a way to Monte Carlo _sample_ this problem; I’m interested in running a single solve (if possible). I’d also like to avoid a _symbolic_ approach (I’m using a discretized PDE solver).

---

<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:** [October 1, 2023, 11:49pm UTC](https://discourse.julialang.org/t/solving-pdes-over-distributions/104480/2 "2023-10-01T23:49:18Z")

</div>

> [@smartalecH](#):
>
> Has anyone tried to leverage Julia’s type system to cleanly propagate that source distribution through the PDE solver, such that you also get a solution distribution?

There are a few ways to do it.

- [Home · MonteCarloMeasurements Documentation](https://baggepinnen.github.io/MonteCarloMeasurements.jl/stable/)
- [Introduction · Measurements](https://juliaphysics.github.io/Measurements.jl/stable/)
- [Overview · PolyChaos.jl](https://docs.sciml.ai/PolyChaos/stable/)

Measurements.jl is the simplest but only linear i.e. propagates normal distribution approximates, which may be too crude for many applications. MonteCarloMeasurements is particle based and no faster than solving N times, but is a nice interface for it. Polynomial chaos expansions are quite a good approach for PDEs and strike a nice balance between nonlinearity and performance, but are a bit more advanced in API as well.
