# Product of probability distribution and nonrandom function

**URL:** https://discourse.julialang.org/t/product-of-probability-distribution-and-nonrandom-function/124622
**Category:** General Usage
**Tags:** distributions
**Created:** [January 10, 2025, 4:49am UTC](https://discourse.julialang.org/t/product-of-probability-distribution-and-nonrandom-function/124622 "2025-01-10T04:49:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rand5](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rand5/32/867_2.png) [@rand5](https://discourse.julialang.org/u/rand5)
#### Post date: [January 10, 2025, 4:49am UTC](https://discourse.julialang.org/t/product-of-probability-distribution-and-nonrandom-function/124622/1 "2025-01-10T04:49:40Z")

</div>

I have a probability distribution, e.g. `Y = Normal()` and would like to scale the distribution (updating its pdf, cdf, etc.) by a nonrandom function, say `f(x) = cdf(Normal(1,2),x)`.

Is there a way to do this and have the the result be a Distributions.jl distribution? I could define `g(x)=pdf.(Y,x)*f(x)`, use rejection sampling to get samples from `g(x)`, then fit a distribution to those data, but it seems a bit convoluted and am wondering if there is a better way. I realize there could be issues if the support of the resulting distribution changes, but in the case of a `Normal()` scaled by the cdf of a Gaussian, this isn’t the case.

Thanks!
