Distributions (polykin.distributions)¤
convolve_moments_self ¤
convolve_moments_self(
q: FloatVectorLike, order: int
) -> FloatVector
Compute the moments of the k-th order convolution of a distribution with itself.
If \(P^{(k)}\) is the \(k\)-th order convolution of \(Q\) with itself, defined as:
\[\begin{aligned}
P^{(1)}_n &= Q*Q = \sum_{m=0}^{n} Q_{n-m} Q_{m} \\
P^{(2)}_n &= (Q*Q)*Q = \sum_{m=0}^{n} Q_{n-m} P^{(1)}_{m} \\
P^{(3)}_n &= ((Q*Q)*Q)*Q = \sum_{m=0}^{n} Q_{n-m} P^{(2)}_{m} \\
...
\end{aligned}\]
then the moments of \(P^{(k)}\) are related to the moments of \(Q\) by:
\[\begin{aligned}
p_0 &= q_0^{k+1} \\
p_1 &= (k+1) q_0^k q_1 \\
p_2 &= (k+1) q_0^{k-1} (k q_1^2 +q_0 q_2) \\
\ldots
\end{aligned}\]
where \(p_i\) and \(q_i\) denote the \(i\)-th moments of \(P^{(k)}\) and \(Q\), respectively.
| PARAMETER | DESCRIPTION |
|---|---|
q
|
Moments of \(Q\), denoted \((q_0, q_1, \ldots)\).
TYPE:
|
order
|
Order of the convolution.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FloatVector(N)
|
Moments of \(P^{(k)}=(Q*Q)*...\), denoted \((p_0, p_1, \ldots)\). |
Examples:
>>> from polykin.distributions import convolve_moments_self
>>> convolve_moments_self([1e0, 1e2, 2e4], 2)
array([1.0e+00, 3.0e+02, 1.2e+05])
Source code in src/polykin/distributions/misc.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |