Cross Validated Asked by fluctuation on February 23, 2021
I have a probability density function of the energy $f(E)$ of a distribution of particles. Now, each energy gets shifted according to an angle $theta$: $$E_{after} = E_{before} + g(E_{before}) cos theta$$
The angle $theta$ is different for each particle (a random variable) and distributed according to $f_{theta}(theta) = sin(theta)/2$ with $theta in [0, pi]$, i.e. isotropic in 3 dimensions. The function $g(E)$ is known in general (assume e.g. $g(E) = E$ or $1$ for simplicity).
Given that I know $f(E_{before})$, can I get an expression for $f(E_{after})$?
I assume I have to write it as a distribution in two variables $f(E_{after}, theta)$ and then marginalize over $theta$ but I am not sure how to do this.
A simple example with a $f(E)$ = 1 and $g(E)$ = E looks like this
import numpy as np
import matplotlib.pyplot as plt
size = 10000000
sample = np.random.rand(size)
thetas = np.arccos( -2 * np.random.rand(size) + 1.) #inverse CDF smapling
shifted = sample + sample * np.cos(thetas)
plt.figure()
plt.hist(sample, density = True, bins = 100, alpha = 0.8, label = "original distribution")
plt.hist(shifted, density = True, bins = 100, alpha = 0.8, label = "shifted distribution")
plt.xlabel("energies")
plt.ylabel("pdf")
plt.legend()
What is the analytical expression for the orange distribution?
Renaming $E_{before}$ to $X$, $E_{after}$ to $Y$, and using a capital $Theta$ to denote the random angle variable, we have this expression for the cumulative density function for Y (the cdf), assuming $X$ and $Theta$ are independent:
$$ mathbb{P}(Y < y) = int_{0}^{pi}int_{-infty}^{infty}f_{Theta}(theta)f_X(x)mathbb{1}_{x + g(x)cos(theta)<y}dx dtheta $$
Where $mathbb{1}_A$ is the indicator function for the event $A$.
You can then differentiate this cdf to find the pdf.
Edit: the indicator function is 1 when the condition in its subscript is satisfied and 0 otherwise. What this means in practice is that the limits of the integral should be adjusted to only include regions where the indicator function is 1. For your example, $Y = (1 + cos(Theta))X$, for each $y$ there are 2 cases:
If $X < frac{y}{2}$ then $Y < y$ regardless of the value of $cos(Theta)$. So we integrate over the whole range $(0, 2pi)$ of possible values of $Theta$.
If $X > frac{y}{2}$ then $Y < y$ only if $cos(Theta)<frac{y}{X}-1$, i.e. $Theta > arccos(frac{y}{x}-1)$.
And the joint pdf $f_{X,Theta}(x,theta)$ is uniformly $frac{1}{pi}$.
So the cdf is as below, where the two integrals correspond to the above two cases:
$$ mathbb{P}(Y < y) :=: int_{0}^{frac{y}{2}}int_{0}^{pi}frac{1}{pi}:dtheta:dx :+: int_{frac{y}{2}}^{1}int_{arccos(frac{y}{x}-1)}^{pi}frac{1}{pi}:dtheta : dx\ $$
Correct answer by fblundun on February 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP