Numerical integration of innocent-looking singular integrand

166 Views Asked by At

Consider the rather innocent integral: $$I=\int_{0}^{1}a x^{a-1}dx=1,\quad 0<a<1$$ Numerically, this integral converges awfully slowly, and one must use a recursive method to get anywhere near $I=1$.

Now, step it up a notch: say we have a black-box function $f(x)$, and that we want to calculate: $$I=\int_{0}^{1}a \ f(x)\ x^{a-1}dx=?$$

Is there an efficient way to calculate this numerically?

I was thinking of generating numbers with distribution $p(x)=ax^{a-1}$ (does this even have a name?), but I'm not sure how to go about doing this quickly.

1

There are 1 best solutions below

0
On BEST ANSWER

Simply change variables. Let $u=x^a$; then $du=ax^{a-1}dx$, and your (generalized) integral is $$ I=\int_{0}^{1}f(u^{1/a})du. $$ This may be a form you can integrate analytically, or it can be approximated by choosing values of $u$ uniformly at random within $[0,1]$; then $I=E[f(u^{1/a})]$. Of course, how well this works depends on the form of $f$; but for a constant function ($f(x)=c$) like your first example, it gives the exact answer ($I=c$) immediately.