Apologies for stating my problem poorly in the first instance, thank you for the help in narrowing down the issue.
Problem
For those interested, it's for the exact unbiased inverse of the generalized Anscombe Transform, as given in this paper: http://dx.doi.org/10.1109/TIP.2012.2202675.
I'm trying to integrate, for a given value of $y$ and $\sigma$, the function
$$ \int_{-\infty}^{+\infty} f_{\sigma}\left ( z \right ) \sum_{k=0}^{\infty}\left ( \frac{y^{k}\mathrm{e}^{-y}}{k!\sqrt{2\pi \sigma^{2}}} \mathrm{e}^{-\frac{\left ( z-k \right )^{2}}{2\sigma^{2}}} \right ) \mathrm{d}z $$
where
$$ f_{\sigma}\left ( z \right ) = \left\{\begin{matrix} 2\sqrt{z+\frac{3}{8}+\sigma^{2}}, & z > -\frac{3}{8}-\sigma^{2}\\ 0, & z \leq -\frac{3}{8}-\sigma^{2} \end{matrix}\right. $$
which gives the equation in the reference below:
$$ \int_{-\infty}^{+\infty} 2\sqrt{z+\frac{3}{8}+\sigma ^{2}}\sum_{k=0}^{\infty}\left ( \frac{y^{k}\mathrm{e}^{-y}}{k!\sqrt{2\pi \sigma^{2}}} \mathrm{e}^{-\frac{\left ( z-k \right )^{2}}{2\sigma^{2}}} \right ) \mathrm{d}z $$
In the reference, the values of the above function are tabulated, presumably in Matlab, for $\sigma \in \left \{ 0.01,...,50 \right \}$ and $y \in \left \{0,...,200 \right \}$. The authors have made this table available for download, but I want to do it myself.
However, I can't get it to work - Mathematica just won't evaluate it:
func[z_, y_, sig_] :=
Piecewise[{{2 Sqrt[z + 3/8 + sig^2]*sig^2],z > -3/8 - sig^2}},0.]*
Sum[((y^k )* Exp[-y])/(k! * Sqrt[2 \[Pi] sig^2]) *
Exp[-((z - k)^2) / (2 sig^2)], {k, 0, Infinity}]
Integrate[func[zNIntegrate[func[z, 5, 2], {z, -Infinity, Infinity}]
Have I made a mistake somewhere? Or misunderstood the integral/problem as given?
EditUpdate
If I try NIntegrate
, for example,
NIntegrate[
2 Sqrt[z + 3/8 + 2^2]*
Sum[((5^k )* Exp[-5])/(k! * Sqrt[2 \[Pi] 2^2]) *
Exp[-((z - k)^2) / (2 2^2)], {k, 0, Infinity}],
{z, -Infinity, Infinity}]
I getA suggestion is to replace the warning
NIntegrate::inumr: "The integrand ... has evaluated to non-numerical values for all sampling points in the region with boundaries {{-[Infinity],0.}}"
Whilst if I try NSum
, I'm warned:infinite sum with an upper limit of ~50 as it converges quickly. This does allow Mathematica to now evaluate the integral.
NSum::nsnum: "Summand (or its derivative) ... is not numerical at point k = 15."