If you want the distribution of the sum of n random variables, you can adapt this code to accept two distributions and recursively compute the n-th convolution product of @a.use List::Util qw/sum/; my @a; # holds the known distribution sub conv { my ($n) = @_; return sum map { ($_ < @a) ? ((($n - $_) < @a) ? $a[$_] * $a[$n - $_] : 0) : 0 } 0 .. $n; }
In reply to Re: Probability sum of random variables
by Prof Vince
in thread Probability sum of random variables
by FFRANK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |