Distributions (polykin.distributions)¤
convolve_moments ¤
convolve_moments(
q0: float,
q1: float,
q2: float,
r0: float,
r1: float,
r2: float,
) -> tuple[float, float, float]
Compute the first three moments of the convolution of two distributions.
If \(P = Q * R\) is the convolution of \(Q\) and \(R\), defined as:
then the first three moments of \(P\) are related to the moments of \(Q\) and \(R\) by:
where \(p_i\), \(q_i\) and \(r_i\) denote the \(i\)-th moments of \(P\), \(Q\) and \(R\), respectively.
PARAMETER | DESCRIPTION |
---|---|
q0
|
0-th moment of \(Q\).
TYPE:
|
q1
|
1-st moment of \(Q\).
TYPE:
|
q2
|
2-nd moment of \(Q\).
TYPE:
|
r0
|
0-th moment of \(R\).
TYPE:
|
r1
|
1-st moment of \(R\).
TYPE:
|
r2
|
2-nd moment of \(R\).
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[float, float, float]
|
0-th, 1-st and 2-nd moments of \(P=Q*R\). |
Examples:
>>> from polykin.distributions import convolve_moments
>>> convolve_moments(1., 1e2, 2e4, 1., 50., 5e4)
(1.0, 150.0, 80000.0)
Source code in src/polykin/distributions/base.py
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 |
|