dcmri.nexpconv#
- dcmri.nexpconv(n, T, t)[source]#
Convolve n identical normalised exponentials analytically
- Parameters:
- Returns:
The result of the convolution as a 1D array.
- Return type:
- Raises:
ValueError – if n<1 and if T<0
Notes
nexpconv
returns the exact analytical result of the following n convolutions:\[g(t) = \frac{e^{-t/T}}{T} \otimes \ldots \otimes \frac{e^{-t/T}}{T}\]The result is a gamma variate function with unit area:
\[g(t) = \frac{1}{\Gamma(n)}\left(\frac{t}{T}\right)^{n-1} \frac{e^{-t/T}}{T}\]Note the gamma-variate function becomes unstable due to numerical overflow at large n and/or short T. This function handles that situation by moving to a numerical solution, but this slows down the computations significantly. Callers should if possible avoid this situation by placing suitable bounds on the parameters.
Example
Import package and create a vector of uniformly sampled time points t with spacing 5.0s:
>>> import dcmri as dc >>> t = 5.0*np.arange(4)
Calculate the convolution of 4 normalised exponentials with time constants 5s:
>>> g = dc.nexpconv(4, 5, t) array([0. , 0.01226265, 0.03608941, 0.04480836])
Examples using dcmri.nexpconv
#
A comparison of convolution functions