Say I have some random distret random variable N, and some other random variable X. I want to make a new compund random variable Y as follows.
Y = \sum_{i=1}^{N} X_{i}
where X_i are independent and identically distributed random variables from the same distribution as X. (Sorry for the code block, I have too low rep to post pictures.)
So codewise I'd begin with somethine like
from sympy import abc, stats, S
N = stats.Geometric(name='N', p=S.One/2)
X = stats.Normal(name='X')
or whatever distributions I was interested in for the discrete and summand random variable. I've been looking at the docs and examples, but can't find a way to represent the compund variable I'm interested in. Then be able to invoke stats.E(Y) or stats.variance(Y).
I know I can calculate conditional expected values and variances along with other computations to calculate the "total" expected value and "total" variance. I can do that on my own, but I'd like to verify that work with a direct symbolic construction then invoke.