What algorithm to solve this integral similar to a normal CDF numerically?

126 Views Asked by At

I'm looking to solve this integral numerically. It is a bit similar to a normal CDF.

Integral

z and tau are deterministic.

What kind of algorithm may do the job, ideally to be coded in C/C++? I'm obviously no expert at numerical integration and having a taken a look at the relevant chapter 4 in the Numerical Recipes in C++ I wondered whether Romberg integration, which applies to improper integrals, would do the trick, but I have not gotten any further.

Many thanks in advance for any hints in the right direction.

1

There are 1 best solutions below

2
On

Romberg integration is a very relevant method and the code given in Numerical Recipes is pretty good, so I suggest you go ahead.

Personally, I should however start with a change of variable $s=\frac 1x$ which transform the integral $$\int\frac{e^{-\frac{z^2}{8 s^2}-\frac{s^2}{2}}}{\sqrt{2 \pi }}ds=-\int\frac{e^{-\frac{x^4 z^2+4}{8 x^2}}}{\sqrt{2 \pi } x^2}dx$$ and the infinite bound becomes $0$.

This is a basic trick for improper integrals; it allows to map an infinite range of integration to a finite one.